Merge from default ihse-runtestprebuilt-branch
authorerikj
Tue, 18 Sep 2018 16:41:24 -0700
branchihse-runtestprebuilt-branch
changeset 56896 92657d5d3db1
parent 56895 3289d2b19b94 (current diff)
parent 51794 4129f43607cb (diff)
child 56903 e5d66cabcf19
Merge from default
make/jdk/src/classes/build/tools/hasher/Hasher.java
make/jdk/src/classes/build/tools/jarreorder/JarReorder.java
make/mapfiles/libjsig/mapfile-vers-solaris
make/mapfiles/libjsound/mapfile-vers
make/mapfiles/libjvm_db/mapfile-vers
make/mapfiles/libjvm_dtrace/mapfile-vers
src/java.base/windows/conf/tzmappings
src/java.desktop/windows/native/common/awt_makecube.cpp
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java
src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java
test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutHandler.java
test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutWatchdog.java
test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingHeap.java
test/hotspot/jtreg/vmTestbase/vm/share/vmstresser/CompileAndDeoptimize.java
test/hotspot/jtreg/vmTestbase/vm/share/vmstresser/MetaspaceStresser.java
test/jdk/com/sun/jdi/Redefine-g.sh
test/jdk/com/sun/jdi/RedefineAbstractClass.sh
test/jdk/com/sun/jdi/RedefineAddPrivateMethod.sh
test/jdk/com/sun/jdi/RedefineAnnotation.sh
test/jdk/com/sun/jdi/RedefineChangeClassOrder.sh
test/jdk/com/sun/jdi/RedefineClasses.sh
test/jdk/com/sun/jdi/RedefineClearBreakpoint.sh
test/jdk/com/sun/jdi/RedefineImplementor.sh
test/jdk/java/util/ServiceLoader/basic/basic.sh
test/jdk/java/util/zip/ZipFile/deletetempjar.sh
test/jdk/javax/naming/module/basic.sh
test/jdk/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java
test/jdk/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java
test/jdk/lib/testlibrary/jdk/testlibrary/Utils.java
--- a/.hgtags	Tue Sep 18 16:32:39 2018 -0700
+++ b/.hgtags	Tue Sep 18 16:41:24 2018 -0700
@@ -511,3 +511,4 @@
 492b366f8e5784cc4927c2c98f9b8a3f16c067eb jdk-12+8
 31b159f30fb281016c5f0c103552809aeda84063 jdk-12+9
 8f594f75e0547d4ca16649cb3501659e3155e81b jdk-12+10
+f0f5d23449d31f1b3580c8a73313918cafeaefd7 jdk-12+11
--- a/make/Init.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/Init.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -240,6 +240,11 @@
     override BUILD_LOG_PIPE :=
   endif
 
+  ifeq ($(filter dist-clean, $(SEQUENTIAL_TARGETS)), dist-clean)
+    # We can't have a log file if we're about to remove it.
+    override BUILD_LOG_PIPE :=
+  endif
+
   ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
     OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
   endif
--- a/make/Main.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/Main.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -1107,7 +1107,8 @@
 # directory was created by configure and now becomes empty, remove it as well.
 dist-clean: clean
 	($(CD) $(OUTPUTDIR) && \
-	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide)
+	    $(RM) -r *spec.gmk $(CONFIGURESUPPORT_OUTPUTDIR) Makefile compare.sh ide \
+	    configure.log* build.log*)
 	$(if $(filter $(CONF_NAME),$(notdir $(OUTPUTDIR))), \
 	  if test "x`$(LS) $(OUTPUTDIR)`" != x; then \
 	    $(ECHO) "Warning: Not removing non-empty configuration directory for '$(CONF_NAME)'" ; \
--- a/make/ToolsJdk.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/ToolsJdk.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -47,9 +47,6 @@
 TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.compileproperties.CompileProperties
 
-TOOL_JARREORDER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
-    build.tools.jarreorder.JarReorder
-
 TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatecharacter.GenerateCharacter
 
@@ -67,9 +64,6 @@
 TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatecurrencydata.GenerateCurrencyData
 
-TOOL_HASHER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
-    build.tools.hasher.Hasher
-
 TOOL_TZDB = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.tzdb.TzdbZoneRulesCompiler
 
@@ -109,10 +103,6 @@
 TOOL_GENERATELSREQUIVMAPS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatelsrequivmaps.EquivMapsGenerator
 
-TOOL_GENMODULESXML = $(JAVA_SMALL) $(INTERIM_LANGTOOLS_BOOTCLASSPATH) \
-    -cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes) \
-    build.tools.module.GenJdepsModulesXml
-
 TOOL_GENMODULEINFOSOURCE = $(JAVA_SMALL) $(INTERIM_LANGTOOLS_BOOTCLASSPATH) \
     -cp $(call PathList, $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes) \
     build.tools.module.GenModuleInfoSource
--- a/make/autoconf/flags-cflags.m4	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/autoconf/flags-cflags.m4	Tue Sep 18 16:41:24 2018 -0700
@@ -373,6 +373,20 @@
 
   FLAGS_SETUP_CFLAGS_CPU_DEP([BUILD], [OPENJDK_BUILD_])
 
+  COMPILER_FP_CONTRACT_OFF_FLAG="-ffp-contract=off"
+  # Check that the compiler supports -ffp-contract=off flag
+  # Set FDLIBM_CFLAGS to -ffp-contract=off if it does. Empty
+  # otherwise.
+  # These flags are required for GCC-based builds of
+  # fdlibm with optimization without losing precision.
+  # Notably, -ffp-contract=off needs to be added for GCC >= 4.6.
+  if test "x$TOOLCHAIN_TYPE" = xgcc || test "x$TOOLCHAIN_TYPE" = xclang; then
+    FLAGS_COMPILER_CHECK_ARGUMENTS(ARGUMENT: [${COMPILER_FP_CONTRACT_OFF_FLAG}],
+	IF_TRUE: [FDLIBM_CFLAGS=${COMPILER_FP_CONTRACT_OFF_FLAG}],
+	IF_FALSE: [FDLIBM_CFLAGS=""])
+  fi
+  AC_SUBST(FDLIBM_CFLAGS)
+
   # Tests are only ever compiled for TARGET
   CFLAGS_TESTLIB="$CFLAGS_JDKLIB"
   CXXFLAGS_TESTLIB="$CXXFLAGS_JDKLIB"
--- a/make/autoconf/flags-other.m4	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/autoconf/flags-other.m4	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 AC_DEFUN([FLAGS_SETUP_ARFLAGS],
 [
   # FIXME: figure out if we should select AR flags depending on OS or toolchain.
-  if test "x$OPENJDK_TARGET_OS" = xmacosx; then
-    ARFLAGS="-r -mmacosx-version-min=$MACOSX_VERSION_MIN"
-  elif test "x$OPENJDK_TARGET_OS" = xaix; then
+  if test "x$OPENJDK_TARGET_OS" = xaix; then
     ARFLAGS="-X64"
   elif test "x$OPENJDK_TARGET_OS" = xwindows; then
     # lib.exe is used as AR to create static libraries.
--- a/make/autoconf/flags.m4	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/autoconf/flags.m4	Tue Sep 18 16:41:24 2018 -0700
@@ -336,8 +336,12 @@
     CC_OUT_OPTION='-o$(SPACE)'
     # When linking, how to specify the output
     LD_OUT_OPTION='-o$(SPACE)'
-    # When archiving, how to specify the to be create static archive for object files.
-    AR_OUT_OPTION='rcs$(SPACE)'
+    # When archiving, how to specify the destination static archive.
+    if test "x$OPENJDK_TARGET_OS" = xmacosx; then
+      AR_OUT_OPTION='-r -cs$(SPACE)'
+    else
+      AR_OUT_OPTION='-rcs$(SPACE)'
+    fi
   fi
   AC_SUBST(CC_OUT_OPTION)
   AC_SUBST(LD_OUT_OPTION)
--- a/make/autoconf/spec.gmk.in	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/autoconf/spec.gmk.in	Tue Sep 18 16:41:24 2018 -0700
@@ -450,6 +450,7 @@
 LIBJSIG_HASHSTYLE_LDFLAGS := @LIBJSIG_HASHSTYLE_LDFLAGS@
 LIBJSIG_NOEXECSTACK_LDFLAGS := @LIBJSIG_NOEXECSTACK_LDFLAGS@
 
+FDLIBM_CFLAGS := @FDLIBM_CFLAGS@
 JVM_CFLAGS := @JVM_CFLAGS@
 JVM_LDFLAGS := @JVM_LDFLAGS@
 JVM_ASFLAGS := @JVM_ASFLAGS@
--- a/make/autoconf/toolchain.m4	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/autoconf/toolchain.m4	Tue Sep 18 16:41:24 2018 -0700
@@ -232,6 +232,7 @@
       XCODE_VERSION_OUTPUT=`"$XCODEBUILD" -version 2>&1 | $HEAD -n 1`
       $ECHO "$XCODE_VERSION_OUTPUT" | $GREP "Xcode " > /dev/null
       if test $? -ne 0; then
+        AC_MSG_NOTICE([xcodebuild output: $XCODE_VERSION_OUTPUT])
         AC_MSG_ERROR([Failed to determine Xcode version.])
       fi
       XCODE_MAJOR_VERSION=`$ECHO $XCODE_VERSION_OUTPUT | \
--- a/make/copy/Copy-java.base.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/copy/Copy-java.base.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -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 @@
 
 ################################################################################
 
-ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
+ifeq ($(OPENJDK_TARGET_OS), aix)
 
   TZMAPPINGS_SRC := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/conf
 
@@ -183,7 +183,7 @@
 
 TARGETS += $(COPY_NET_PROPERTIES)
 
-ifeq ($(OPENJDK_TARGET_OS), solaris)
+ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux), )
   $(eval $(call SetupCopyFiles, COPY_SDP_CONF, \
       FILES := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template, \
       DEST := $(CONF_DST_DIR)/sdp, \
--- a/make/gensrc/GensrcCLDR.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/gensrc/GensrcCLDR.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -37,9 +37,17 @@
 ZONENAME_TEMPLATE := $(TOPDIR)/src/java.base/share/classes/java/time/format/ZoneName.java.template
 TZDATA_DIR := $(TOPDIR)/make/data/tzdata
 
-$(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
-    $(wildcard $(CLDRSRCDIR)/common/main/en*.xml) \
-    $(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \
+# tzmappings generation for Windows.
+# Since the rule is shared with CLDR_BASEMETAINFO_FILE target, note that
+# just removing the target tzmappings will not recreate the tzmappings file.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  CLDR_WINTZMAPPINGS := $(GENSRC_BASEDIR)/windows/conf/tzmappings
+  $(CLDR_WINTZMAPPINGS): $(CLDR_BASEMETAINFO_FILE)
+endif
+
+$(CLDR_BASEMETAINFO_FILE): $(wildcard $(CLDRSRCDIR)/dtd/*.dtd) \
+    $(wildcard $(CLDRSRCDIR)/main/en*.xml) \
+    $(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
     $(ZONENAME_TEMPLATE) \
     $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(GENSRC_BASEDIR)
@@ -50,14 +58,14 @@
 	    -zntempfile $(ZONENAME_TEMPLATE) \
 	    -tzdatadir $(TZDATA_DIR)
 
-$(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/common/dtd/*.dtd) \
-    $(wildcard $(CLDRSRCDIR)/common/main/*.xml) \
-    $(wildcard $(CLDRSRCDIR)/common/supplemental/*.xml) \
+$(CLDR_METAINFO_FILE): $(wildcard $(CLDRSRCDIR)/dtd/*.dtd) \
+    $(wildcard $(CLDRSRCDIR)/main/*.xml) \
+    $(wildcard $(CLDRSRCDIR)/supplemental/*.xml) \
     $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(GENSRC_DIR)
 	$(TOOL_CLDRCONVERTER) -base $(CLDRSRCDIR) \
 	    -baselocales $(CLDR_BASE_LOCALES) \
 	    -o $(GENSRC_DIR)
 
-GENSRC_JAVA_BASE += $(CLDR_BASEMETAINFO_FILE)
+GENSRC_JAVA_BASE += $(CLDR_BASEMETAINFO_FILE) $(CLDR_WINTZMAPPINGS)
 GENSRC_JDK_LOCALEDATA += $(CLDR_METAINFO_FILE)
--- a/make/hotspot/lib/CompileDtraceLibraries.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/hotspot/lib/CompileDtraceLibraries.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -25,6 +25,10 @@
 
 ifeq ($(call check-jvm-feature, dtrace), true)
   ifeq ($(OPENJDK_TARGET_OS), solaris)
+    JNI_INCLUDE_FLAGS := \
+        -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base \
+        -I$(SUPPORT_OUTPUTDIR)/modules_include/java.base/$(OPENJDK_TARGET_OS_INCLUDE_SUBDIR) \
+        #
 
     ############################################################################
     # Build the stand-alone dtrace libraries.
@@ -34,10 +38,9 @@
         NAME := jvm_dtrace, \
         OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
         SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_dtrace, \
-        CFLAGS := -m64 -G -mt -KPIC, \
+        CFLAGS := $(JNI_INCLUDE_FLAGS) -m64 -G -mt -KPIC -xldscope=hidden, \
         LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
         LIBS := $(LIBDL) -lthread -ldoor, \
-        MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_dtrace/mapfile-vers, \
         OBJECT_DIR := $(LIBJVM_DTRACE_OUTPUTDIR)/objs, \
     ))
 
@@ -48,9 +51,8 @@
         NAME := jvm_db, \
         OUTPUT_DIR := $(JVM_LIB_OUTPUTDIR), \
         SRC := $(TOPDIR)/src/java.base/solaris/native/libjvm_db, \
-        CFLAGS := -I$(DTRACE_GENSRC_DIR) -m64 -G -mt -KPIC, \
+        CFLAGS := -I$(DTRACE_GENSRC_DIR) $(JNI_INCLUDE_FLAGS) -m64 -G -mt -KPIC -xldscope=hidden, \
         LDFLAGS := -m64 -mt -xnolib $(SHARED_LIBRARY_FLAGS), \
-        MAPFILE := $(TOPDIR)/make/mapfiles/libjvm_db/mapfile-vers, \
         OBJECT_DIR := $(LIBJVM_DB_OUTPUTDIR)/objs, \
     ))
 
--- a/make/hotspot/lib/JvmOverrideFiles.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/hotspot/lib/JvmOverrideFiles.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -30,7 +30,7 @@
 # status for individual files on specific platforms.
 
 ifeq ($(TOOLCHAIN_TYPE), gcc)
-  BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments -O0
+  BUILD_LIBJVM_vmStructs.cpp_CXXFLAGS := -fno-var-tracking-assignments
   BUILD_LIBJVM_jvmciCompilerToVM.cpp_CXXFLAGS := -fno-var-tracking-assignments
   BUILD_LIBJVM_jvmciCompilerToVMInit.cpp_CXXFLAGS := -fno-var-tracking-assignments
   BUILD_LIBJVM_assembler_x86.cpp_CXXFLAGS := -Wno-maybe-uninitialized
@@ -38,20 +38,26 @@
   BUILD_LIBJVM_interp_masm_x86.cpp_CXXFLAGS := -Wno-uninitialized
 endif
 
+LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NONE)
+# If the FDLIBM_CFLAGS variable is non-empty we know
+# that the fdlibm-fork in hotspot can get optimized
+# by using -ffp-contract=off on GCC/Clang platforms.
+ifneq ($(FDLIBM_CFLAGS), )
+  LIBJVM_FDLIBM_COPY_OPT_FLAG := $(CXX_O_FLAG_NORM)
+endif
+
 ifeq ($(OPENJDK_TARGET_OS), linux)
   BUILD_LIBJVM_ostream.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
   BUILD_LIBJVM_logFileOutput.cpp_CXXFLAGS := -D_FILE_OFFSET_BITS=64
 
-  ifeq ($(OPENJDK_TARGET_CPU_ARCH), x86)
-    BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
-    BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(CXX_O_FLAG_NONE)
+  BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
+  BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := -DNO_PCH $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
 
-    ifeq ($(TOOLCHAIN_TYPE), clang)
-      JVM_PRECOMPILED_HEADER_EXCLUDE := \
-          sharedRuntimeTrig.cpp \
-          sharedRuntimeTrans.cpp \
-          #
-    endif
+  ifeq ($(TOOLCHAIN_TYPE), clang)
+    JVM_PRECOMPILED_HEADER_EXCLUDE := \
+	sharedRuntimeTrig.cpp \
+	sharedRuntimeTrans.cpp \
+	#
   endif
 
   ifeq ($(OPENJDK_TARGET_CPU), x86)
@@ -120,8 +126,8 @@
 
 else ifeq ($(OPENJDK_TARGET_OS), macosx)
   # The copied fdlibm routines in these files must not be optimized
-  BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
-  BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(CXX_O_FLAG_NONE)
+  BUILD_LIBJVM_sharedRuntimeTrig.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
+  BUILD_LIBJVM_sharedRuntimeTrans.cpp_CXXFLAGS := $(FDLIBM_CFLAGS) $(LIBJVM_FDLIBM_COPY_OPT_FLAG)
   ifeq ($(TOOLCHAIN_TYPE), clang)
     # NOTE: The old build tested clang version to make sure this workaround
     # for the clang bug was still needed.
--- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java	Tue Sep 18 16:41:24 2018 -0700
@@ -69,6 +69,7 @@
     private static String METAZONES_SOURCE_FILE;
     private static String LIKELYSUBTAGS_SOURCE_FILE;
     private static String TIMEZONE_SOURCE_FILE;
+    private static String WINZONES_SOURCE_FILE;
     static String DESTINATION_DIR = "build/gensrc";
 
     static final String LOCALE_NAME_PREFIX = "locale.displayname.";
@@ -91,6 +92,7 @@
 
     private static SupplementDataParseHandler handlerSuppl;
     private static LikelySubtagsParseHandler handlerLikelySubtags;
+    private static WinZonesParseHandler handlerWinZones;
     static SupplementalMetadataParseHandler handlerSupplMeta;
     static NumberingSystemsParseHandler handlerNumbering;
     static MetaZonesParseHandler handlerMetaZones;
@@ -241,6 +243,7 @@
         METAZONES_SOURCE_FILE = CLDR_BASE + "/supplemental/metaZones.xml";
         TIMEZONE_SOURCE_FILE = CLDR_BASE + "/bcp47/timezone.xml";
         SPPL_META_SOURCE_FILE = CLDR_BASE + "/supplemental/supplementalMetadata.xml";
+        WINZONES_SOURCE_FILE = CLDR_BASE + "/supplemental/windowsZones.xml";
 
         if (BASE_LOCALES.isEmpty()) {
             setupBaseLocales("en-US");
@@ -255,9 +258,12 @@
         List<Bundle> bundles = readBundleList();
         convertBundles(bundles);
 
-        // Generate java.time.format.ZoneName.java
         if (isBaseModule) {
+            // Generate java.time.format.ZoneName.java
             generateZoneName();
+
+            // Generate Windows tzmappings
+            generateWindowsTZMappings();
         }
     }
 
@@ -432,6 +438,10 @@
         // Currently interested in deprecated time zone ids and language aliases.
         handlerSupplMeta = new SupplementalMetadataParseHandler();
         parseLDMLFile(new File(SPPL_META_SOURCE_FILE), handlerSupplMeta);
+
+        // Parse windowsZones
+        handlerWinZones = new WinZonesParseHandler();
+        parseLDMLFile(new File(WINZONES_SOURCE_FILE), handlerWinZones);
     }
 
     // Parsers for data in "bcp47" directory
@@ -1088,4 +1098,42 @@
             throw new UncheckedIOException(e);
         }
     }
+
+    // Generate tzmappings for Windows. The format is:
+    //
+    // (Windows Zone Name):(REGION):(Java TZID)
+    //
+    // where:
+    //   Windows Zone Name: arbitrary time zone name string used in Windows
+    //   REGION: ISO3166 or UN M.49 code
+    //   Java TZID: Java's time zone ID
+    //
+    // Note: the entries are alphabetically sorted, *except* the "world" region
+    // code, i.e., "001". It should be the last entry for the same windows time
+    // zone name entries. (cf. TimeZone_md.c)
+    private static void generateWindowsTZMappings() throws Exception {
+        Files.createDirectories(Paths.get(DESTINATION_DIR, "windows", "conf"));
+        Files.write(Paths.get(DESTINATION_DIR, "windows", "conf", "tzmappings"),
+            handlerWinZones.keySet().stream()
+                .map(k -> k + ":" + handlerWinZones.get(k) + ":")
+                .sorted(new Comparator<String>() {
+                    public int compare(String t1, String t2) {
+                        String[] s1 = t1.split(":");
+                        String[] s2 = t2.split(":");
+                        if (s1[0].equals(s2[0])) {
+                            if (s1[1].equals("001")) {
+                                return 1;
+                            } else if (s2[1].equals("001")) {
+                                return -1;
+                            } else {
+                                return s1[1].compareTo(s2[1]);
+                            }
+                        } else {
+                            return s1[0].compareTo(s2[0]);
+                        }
+                    }
+                })
+                .collect(Collectors.toList()),
+            StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING);
+    }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/jdk/src/classes/build/tools/cldrconverter/WinZonesParseHandler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * 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 build.tools.cldrconverter;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.stream.Stream;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * Handles parsing of files in Locale Data Markup Language for
+ * windowsZones.xml
+ */
+
+class WinZonesParseHandler extends AbstractLDMLHandler<Object> {
+    @Override
+    public InputSource resolveEntity(String publicID, String systemID) throws IOException, SAXException {
+        // avoid HTTP traffic to unicode.org
+        if (systemID.startsWith(CLDRConverter.SPPL_LDML_DTD_SYSTEM_ID)) {
+            return new InputSource((new File(CLDRConverter.LOCAL_SPPL_LDML_DTD)).toURI().toString());
+        }
+        return null;
+    }
+
+    @Override
+    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+        switch (qName) {
+        case "mapZone":
+            String zoneName = attributes.getValue("other");
+            String territory = attributes.getValue("territory");
+            String javatz = attributes.getValue("type").replaceFirst("\\s.*", "");
+            put(zoneName + ":" + territory, javatz);
+            pushIgnoredContainer(qName);
+            break;
+        default:
+            // treat anything else as a container
+            pushContainer(qName, attributes);
+            break;
+        }
+    }
+}
--- a/make/jdk/src/classes/build/tools/hasher/Hasher.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,320 +0,0 @@
-/*
- * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  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 build.tools.hasher;
-
-import java.io.*;
-import java.util.*;
-
-
-/**
- * Reads a map in the form of a sequence of key/value-expression pairs from the
- * standard input, attempts to construct a hash map that fits within the given
- * table-size and chain-depth constraints, and, if successful, writes source
- * code to the standard output for a subclass of sun.util.PreHashedMap that
- * implements the map.
- *
- * @see sun.util.PreHashedMap
- *
- * @author Mark Reinhold
- */
-
-public class Hasher {
-
-    static final PrintStream out = System.out;
-    static final PrintStream err = System.err;
-
-    boolean verbose = false;
-
-    List<String> keys = new ArrayList<>();      // Key strings
-    List<String> values = new ArrayList<>();    // Value expressions
-    String pkg = null;                          // Package prefix for generated class
-    String cln = null;                          // Name of generated class
-    String vtype = "String";                    // Value type
-    int maxBits = 11;                           // lg table size
-    int maxDepth = 3;                           // Max chain depth
-    boolean inner = false;                      // Generating an inner class?
-    boolean empty = false;                      // Generating an empty table?
-
-    void usage() {
-        err.println("usage: java Hasher [options] [[pkgName.]ClassName]");
-        err.println("options:");
-        err.println("    -e           generate empty table (ignores value exprs)");
-        err.println("    -i           generate a static inner class");
-        err.println("    -md depth    max chain depth (default 3)");
-        err.println("    -mb bits     max index bits (lg of table size, default 10)");
-        err.println("    -t type      value type (default String)");
-        err.println("    -v           verbose");
-        err.println("Key/value-expression pairs are read from standard input");
-        err.println("If class name is given then source is written to standard output");
-        System.exit(1);
-    }
-
-    Hasher(String[] args) {
-        List<String> as = Arrays.asList(args);
-        for (Iterator<String> i = as.iterator(); i.hasNext();) {
-            String a = i.next();
-            if (a.equals("-e")) {
-                empty = true;
-            } else if (a.equals("-i")) {
-                inner = true;
-            } else if (a.equals("-v")) {
-                verbose = true;
-            } else if (a.equals("-md")) {
-                if (!i.hasNext())
-                    usage();
-                maxDepth = Integer.parseInt(i.next());
-            } else if (a.equals("-mb")) {
-                if (!i.hasNext())
-                    usage();
-                maxBits = Integer.parseInt(i.next());
-            } else if (a.equals("-t")) {
-                if (!i.hasNext())
-                    usage();
-                vtype = i.next();
-            } else if (a.startsWith("-")) {
-                usage();
-            } else {
-                int j = a.lastIndexOf('.');
-                if (j >= 0) {
-                    pkg = a.substring(0, j);
-                    cln = a.substring(j + 1);
-                } else {
-                    cln = a;
-                }
-            }
-        }
-        if (verbose)
-            err.println("pkg=" + pkg + ", cln=" + cln);
-    }
-
-    // Read keys and values
-    //
-    Hasher load() throws IOException {
-        BufferedReader br
-            = new BufferedReader(new InputStreamReader(System.in));
-        for (String ln; (ln = br.readLine()) != null;) {
-            String[] ws = ln.split(",?\\s+", 2);
-            String w = ws[0].replaceAll("\"", "");
-            if (keys.contains(w))
-                throw new RuntimeException("Duplicate word in input: " + w);
-            keys.add(w);
-            if (ws.length < 2)
-                throw new RuntimeException("Missing expression for key " + w);
-            values.add(ws[1]);
-        }
-        return this;
-    }
-
-    Object[] ht;                        // Hash table itself
-    int nb;                             // Number of bits (lg table size)
-    int md;                             // Maximum chain depth
-    int mask;                           // Hash-code mask
-    int shift;                          // Hash-code shift size
-
-    int hash(String w) {
-        return (w.hashCode() >> shift) & mask;
-    }
-
-    // Build a hash table of size 2^nb, shifting the hash code by s bits
-    //
-    void build(int nb, int s) {
-
-        this.nb = nb;
-        this.shift = s;
-        int n = 1 << nb;
-        this.mask = n - 1;
-        ht = new Object[n];
-        int nw = keys.size();
-
-        for (int i = 0; i < nw; i++) {
-            String w = keys.get(i);
-            String v = values.get(i);
-            int h = hash(w);
-            if (ht[h] == null)
-                ht[h] = new Object[] { w, v };
-            else
-                ht[h] = new Object[] { w, v, ht[h] };
-        }
-
-        this.md = 0;
-        for (int i = 0; i < n; i++) {
-            int d = 1;
-            for (Object[] a = (Object[])ht[i];
-                 a != null && a.length > 2;
-                 a = (Object[])a[2], d++);
-            this.md = Math.max(md, d);
-        }
-
-    }
-
-    Hasher build() {
-        // Iterate through acceptable table sizes
-        for (int nb = 2; nb < maxBits; nb++) {
-            // Iterate through possible shift sizes
-            for (int s = 0; s < (32 - nb); s++) {
-                build(nb, s);
-                if (verbose)
-                    err.println("nb=" + nb + " s=" + s + " md=" + md);
-                if (md <= maxDepth) {
-                    // Success
-                    out.flush();
-                    if (verbose) {
-                        if (cln != null)
-                            err.print(cln + ": ");
-                        err.println("Table size " + (1 << nb) + " (" + nb + " bits)"
-                                    + ", shift " + shift
-                                    + ", max chain depth " + md);
-                    }
-                    return this;
-                }
-            }
-        }
-        throw new RuntimeException("Cannot find a suitable size"
-                                   + " within given constraints");
-    }
-
-    // Look for the given key in the hash table
-    //
-    String get(String k) {
-        int h = hash(k);
-        Object[] a = (Object[])ht[h];
-        for (;;) {
-            if (a[0].equals(k))
-                return (String)a[1];
-            if (a.length < 3)
-                return null;
-            a = (Object[])a[2];
-        }
-    }
-
-    // Test that all input keys can be found in the table
-    //
-    Hasher test() {
-        if (verbose)
-            err.println();
-        for (int i = 0, n = keys.size(); i < n; i++) {
-            String w = keys.get(i);
-            String v = get(w);
-            if (verbose)
-                err.println(hash(w) + "\t" + w);
-            if (!v.equals(values.get(i)))
-                throw new Error("Incorrect value: " + w + " --> "
-                                + v + ", should be " + values.get(i));
-        }
-        return this;
-    }
-
-    String ind = "";                    // Indent prefix
-
-    // Generate code for a single table entry
-    //
-    void genEntry(Object[] a, int depth, PrintWriter pw) {
-        Object v = empty ? null : a[1];
-        pw.print("new Object[] { \"" + a[0] + "\", " + v);
-        if (a.length < 3) {
-            pw.print(" }");
-            return;
-        }
-        pw.println(",");
-        pw.print(ind + "                     ");
-        for (int i = 0; i < depth; i++)
-            pw.print("    ");
-        genEntry((Object[])a[2], depth + 1, pw);
-        pw.print(" }");
-    }
-
-    // Generate a PreHashedMap subclass from the computed hash table
-    //
-    Hasher generate() throws IOException {
-        if (cln == null)
-            return this;
-        PrintWriter pw
-            = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out)));
-
-        if (inner)
-            ind = "    ";
-
-        if (!inner && pkg != null) {
-            pw.println();
-            pw.println("package " + pkg + ";");
-            pw.println();
-        }
-
-        if (inner) {
-            pw.println(ind + "private static final class " + cln);
-        } else {
-            pw.println();
-            pw.println("public final class " + cln);
-        }
-        pw.println(ind + "    extends sun.util.PreHashedMap<" + vtype +">");
-        pw.println(ind + "{");
-
-        pw.println();
-        pw.println(ind + "    private static final int ROWS = "
-                   + ht.length + ";");
-        pw.println(ind + "    private static final int SIZE = "
-                   + keys.size() + ";");
-        pw.println(ind + "    private static final int SHIFT = "
-                   + shift + ";");
-        pw.println(ind + "    private static final int MASK = 0x"
-                   + Integer.toHexString(mask) + ";");
-        pw.println();
-
-        pw.println(ind + "    " + (inner ? "private " : "public ")
-                   + cln + "() {");
-        pw.println(ind + "        super(ROWS, SIZE, SHIFT, MASK);");
-        pw.println(ind + "    }");
-        pw.println();
-
-        pw.println(ind + "    protected void init(Object[] ht) {");
-        for (int i = 0; i < ht.length; i++) {
-            if (ht[i] == null)
-                continue;
-            Object[] a = (Object[])ht[i];
-            pw.print(ind + "        ht[" + i + "] = ");
-            genEntry(a, 0, pw);
-            pw.println(";");
-        }
-        pw.println(ind + "    }");
-        pw.println();
-
-        pw.println(ind + "}");
-        if (inner)
-            pw.println();
-
-        pw.close();
-        return this;
-    }
-
-    public static void main(String[] args) throws IOException {
-        new Hasher(args)
-            .load()
-            .build()
-            .test()
-            .generate();
-    }
-
-}
--- a/make/jdk/src/classes/build/tools/jarreorder/JarReorder.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,384 +0,0 @@
-/*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * Read an input file which is output from a java -verbose run,
- * combine with an argument list of files and directories, and
- * write a list of items to be included in a jar file.
- */
-package build.tools.jarreorder;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.io.PrintStream;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-public class JarReorder {
-
-    // To deal with output
-    private PrintStream out;
-
-    private void usage() {
-        String help;
-        help =
-                "Usage:  jar JarReorder [-m] [-o <outputfile>] <order_list> <exclude_list> <file> ...\n"
-                + "   -m            activate module mode, where every direct sub\n"
-                + "                 directory of the current working directory\n"
-                + "                 will be assumed to be a separate source root\n"
-                + "   order_list    is a file containing names of files to load\n"
-                + "                 in order at the end of a jar file unless\n"
-                + "                 excluded in the exclude list.\n"
-                + "   exclude_list  is a file containing names of files/directories\n"
-                + "                 NOT to be included in a jar file.\n"
-                + "\n"
-                + "The order_list or exclude_list may be replaced by a \"-\" if no\n"
-                + "data is to be provided.\n"
-                + "\n"
-                + "   The remaining arguments are files or directories to be included\n"
-                + "   in a jar file, from which will be excluded those entries which\n"
-                + "   appear in the exclude list.\n";
-        System.err.println(help);
-    }
-
-
-    /*
-     * Create the file list to be included in a jar file, such that the
-     * list will appear in a specific order, and allowing certain
-     * files and directories to be excluded.
-     *
-     * Command path arguments are
-     *    - optional -m for module mode.
-     *    - optional -o outputfile
-     *    - name of a file containing a set of files to be included in a jar file.
-     *    - name of a file containing a set of files (or directories) to be
-     *      excluded from the jar file.
-     *    - names of files or directories to be searched for files to include
-     *      in the jar file.
-     */
-    public static void main(String[] args) {
-        JarReorder jr = new JarReorder();
-        jr.run(args);
-    }
-
-    private void run(String args[]) {
-
-        int arglen = args.length;
-        int argpos = 0;
-
-        boolean moduleMode = false;
-
-        if (arglen > 0) {
-            // Check for module mode
-            if (args[argpos].equals("-m")) {
-                moduleMode = true;
-                argpos++;
-                arglen--;
-            }
-            // Look for "-o outputfilename" option
-            if (arglen >= 2 && args[argpos].equals("-o")) {
-                try {
-                    out = new PrintStream(new FileOutputStream(args[argpos+1]));
-                } catch (FileNotFoundException e) {
-                    System.err.println("Error: " + e.getMessage());
-                    e.printStackTrace(System.err);
-                    System.exit(1);
-                }
-                argpos += 2;
-                arglen -= 2;
-            } else {
-                System.err.println("Error: Illegal arg count");
-                System.exit(1);
-            }
-        } else {
-            out = System.out;
-        }
-
-        // Should be 2 or more args left
-        if (arglen <= 2) {
-            usage();
-            System.exit(1);
-        }
-
-        // Read the ordered set of files to be included in rt.jar.
-        // Read the set of files/directories to be excluded from rt.jar.
-        String classListFile = args[argpos];
-        String excludeListFile = args[argpos + 1];
-        argpos += 2;
-        arglen -= 2;
-
-        // If we run module mode, this will contain the list of subdirs to use
-        // as source roots. Otherwise it will just contain the current working
-        // dir.
-        List<File> moduleDirs = findModuleDirs(moduleMode);
-
-        // Create 2 lists and a set of processed files
-        List<String> orderList = readListFromFile(classListFile, true, moduleDirs);
-        List<String> excludeList = readListFromFile(excludeListFile, false, moduleDirs);
-        Set<String> processed = new HashSet<String>();
-
-        // Create set of all files and directories excluded, then expand
-        //   that list completely
-        Set<String> excludeSet = new HashSet<String>(excludeList);
-        Set<String> allFilesExcluded = expand(null, excludeSet, processed);
-
-        // Indicate all these have been processed, orderList too, kept to end.
-        processed.addAll(orderList);
-
-        // The remaining arguments are names of files/directories to be included
-        // in the jar file.
-        Set<String> inputSet = new HashSet<String>();
-        for (int i = 0; i < arglen; ++i) {
-            String name = args[argpos + i];
-            for (File dir : moduleDirs) {
-                String cleanName = cleanPath(new File(dir, name));
-                if ( cleanName != null && cleanName.length() > 0 && !inputSet.contains(cleanName) ) {
-                    inputSet.add(cleanName);
-                }
-            }
-        }
-
-        // Expand file/directory input so we get a complete set (except ordered)
-        //   Should be everything not excluded and not in order list.
-        Set<String> allFilesIncluded = expand(null, inputSet, processed);
-
-        // Create simple sorted list so we can add ordered items at end.
-        List<String> allFiles = new ArrayList<String>(allFilesIncluded);
-        Collections.sort(allFiles);
-
-        // Now add the ordered set to the end of the list.
-        // Add in REVERSE ORDER, so that the first element is closest to
-        // the end (and the index).
-        for (int i = orderList.size() - 1; i >= 0; --i) {
-            String s = orderList.get(i);
-            if (allFilesExcluded.contains(s)) {
-                // Disable this warning until 8005688 is fixed
-                // System.err.println("Included order file " + s
-                //    + " is also excluded, skipping.");
-            } else if (new File(s).exists()) {
-                allFiles.add(s);
-            } else {
-                System.err.println("Included order file " + s
-                    + " missing, skipping.");
-            }
-        }
-
-        // Print final results.
-        for (String str : allFiles) {
-            // If running in module mode, each line must be prepended with a
-            // '-C dir ' which points to the source root where that file is
-            // found.
-            if (moduleMode) {
-                int firstPathSep = str.indexOf(File.separator);
-                String moduleDir;
-                if (firstPathSep < 0) {
-                    moduleDir = ".";
-                } else {
-                    moduleDir = str.substring(0, firstPathSep);
-                }
-                String filePath = str.substring(firstPathSep + 1);
-                out.println("-C " + moduleDir + " " + filePath);
-            } else {
-                out.println(str);
-            }
-        }
-        out.flush();
-        out.close();
-    }
-
-    /*
-     * Read a file containing a list of files and directories into a List.
-     */
-    private List<String> readListFromFile(String fileName,
-            boolean addClassSuffix, List<File> moduleDirs) {
-
-        BufferedReader br = null;
-        List<String> list = new ArrayList<String>();
-        // If you see "-" for the name, just assume nothing was provided.
-        if ("-".equals(fileName)) {
-            return list;
-        }
-        try {
-            br = new BufferedReader(new FileReader(fileName));
-            // Read the input file a path at a time. # in column 1 is a comment.
-            while (true) {
-                String path = br.readLine();
-                if (path == null) {
-                    break;
-                }
-                // Look for comments
-                path = path.trim();
-                if (path.length() == 0
-                        || path.charAt(0) == '#') {
-                    continue;
-                }
-                // Add trailing .class if necessary
-                if (addClassSuffix && !path.endsWith(".class")) {
-                    path = path + ".class";
-                }
-                // Look for file in each module source root
-                boolean pathFound = false;
-                for (File dir : moduleDirs) {
-                    File file = new File(dir, path);
-                    if (file.exists()) {
-                        pathFound = true;
-                        // Normalize the path
-                        String cleanPath = cleanPath(new File(dir, path));
-                        // Add to list
-                        if (cleanPath != null && cleanPath.length() > 0 && !list.contains(cleanPath)) {
-                            list.add(cleanPath);
-                        }
-                    }
-                }
-                if (!pathFound) {
-                    System.err.println("WARNING: Path does not exist as file or directory: " + path);
-                }
-            }
-            br.close();
-        } catch (FileNotFoundException e) {
-            System.err.println("Can't find file \"" + fileName + "\".");
-            System.exit(1);
-        } catch (IOException e) {
-            e.printStackTrace();
-            System.exit(2);
-        }
-        return list;
-    }
-
-    /*
-     * Expands inputSet (files or dirs) into full set of all files that
-     * can be found by recursively descending directories.
-     * @param dir root directory
-     * @param inputSet set of files or dirs to look into
-     * @param processed files or dirs already processed
-     * @return set of files
-     */
-    private Set<String> expand(File dir,
-            Set<String> inputSet,
-            Set<String> processed) {
-        Set<String> includedFiles = new HashSet<String>();
-        if (inputSet.isEmpty()) {
-            return includedFiles;
-        }
-        for (String name : inputSet) {
-            // Depending on start location
-            File f = (dir == null) ? new File(name)
-                    : new File(dir, name);
-            // Normalized path to use
-            String path = cleanPath(f);
-            if (path != null && path.length() > 0
-                    && !processed.contains(path)) {
-                if (f.isFile()) {
-                    // Not in the excludeList, add it to both lists
-                    includedFiles.add(path);
-                    processed.add(path);
-                } else if (f.isDirectory()) {
-                    // Add the directory entries
-                    String[] dirList = f.list();
-                    Set<String> dirInputSet = new HashSet<String>();
-                    for (String x : dirList) {
-                        dirInputSet.add(x);
-                    }
-                    // Process all entries in this directory
-                    Set<String> subList = expand(f, dirInputSet, processed);
-                    includedFiles.addAll(subList);
-                    processed.add(path);
-                }
-            }
-        }
-        return includedFiles;
-    }
-
-    /**
-     * Find all module sub directories to be used as source roots.
-     * @param moduleMode If true, assume sub directories are modules, otherwise
-     *                   just use current working directory.
-     * @return List of all found source roots
-     */
-    private List<File> findModuleDirs(boolean moduleMode) {
-        File cwd = new File(".");
-        List<File> moduleDirs = new ArrayList<File>();
-        if (moduleMode) {
-            for (File f : cwd.listFiles()) {
-                if (f.isDirectory()) {
-                    moduleDirs.add(f);
-                }
-            }
-        } else {
-            moduleDirs.add(cwd);
-        }
-        return moduleDirs;
-    }
-
-    private String cleanPath(File f) {
-        String path = f.getPath();
-        if (f.isFile()) {
-            path = cleanFilePath(path);
-        } else if (f.isDirectory()) {
-            path = cleanDirPath(path);
-        } else {
-            System.err.println("WARNING: Path does not exist as file or directory: " + path);
-            path = null;
-        }
-        return path;
-    }
-
-    private String cleanFilePath(String path) {
-        // Remove leading and trailing whitespace
-        path = path.trim();
-        // Make all / and \ chars one
-        if (File.separatorChar == '/') {
-            path = path.replace('\\', '/');
-        } else {
-            path = path.replace('/', '\\');
-        }
-        // Remove leading ./
-        while (path.startsWith("." + File.separator)) {
-            path = path.substring(2);
-        }
-        return path;
-    }
-
-    private String cleanDirPath(String path) {
-        path = cleanFilePath(path);
-        // Make sure it ends with a file separator
-        if (!path.endsWith(File.separator)) {
-            path = path + File.separator;
-        }
-        // Remove any /./ in the path.
-        if (path.endsWith(File.separator + "." + File.separator)) {
-            path = path.substring(0, path.length() - 2);
-        }
-        return path;
-    }
-
-}
--- a/make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesCompiler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, 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
@@ -65,8 +65,6 @@
 import java.text.ParsePosition;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.NoSuchElementException;
@@ -76,6 +74,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.MatchResult;
 import java.util.regex.Pattern;
+import java.util.stream.Collectors;
 
 /**
  * A compiler that reads a set of TZDB time-zone files and builds a single
@@ -256,8 +255,10 @@
             for (String regionId : regionArray) {
                 out.writeUTF(regionId);
             }
-            // rules  -- hashset -> remove the dup
-            List<ZoneRules> rulesList = new ArrayList<>(new HashSet<>(builtZones.values()));
+            // rules  -- remove the dup
+            List<ZoneRules> rulesList = builtZones.values().stream()
+                .distinct()
+                .collect(Collectors.toList());
             out.writeShort(rulesList.size());
             ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
             for (ZoneRules rules : rulesList) {
--- a/make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/jdk/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -33,8 +33,6 @@
 import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -43,7 +41,7 @@
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TreeSet;
-import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentSkipListMap;
 import java.time.*;
 import java.time.Year;
 import java.time.chrono.IsoChronology;
@@ -131,18 +129,18 @@
     /**
      * Zone region to rules mapping
      */
-    private final Map<String, Object> zones = new ConcurrentHashMap<>();
+    private final Map<String, Object> zones = new ConcurrentSkipListMap<>();
 
     /**
      * compatibility list
      */
-    private static HashSet<String> excludedZones;
+    private static Set<String> excludedZones;
     static {
         // (1) exclude EST, HST and MST. They are supported
         //     via the short-id mapping
         // (2) remove UTC and GMT
         // (3) remove ROC, which is not supported in j.u.tz
-        excludedZones = new HashSet<>(10);
+        excludedZones = new TreeSet<>();
         excludedZones.add("EST");
         excludedZones.add("HST");
         excludedZones.add("MST");
@@ -151,8 +149,8 @@
         excludedZones.add("ROC");
     }
 
-    private Map<String, String> links = new HashMap<>(150);
-    private Map<String, List<RuleLine>> rules = new HashMap<>(500);
+    private Map<String, String> links = new TreeMap<>();
+    private Map<String, List<RuleLine>> rules = new TreeMap<>();
 
     private void load(List<Path> files) throws IOException {
 
--- a/make/langtools/tools/propertiesparser/PropertiesParser.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/langtools/tools/propertiesparser/PropertiesParser.java	Tue Sep 18 16:41:24 2018 -0700
@@ -30,7 +30,7 @@
 
 import java.io.File;
 import java.io.PrintStream;
-import java.util.HashMap;
+import java.util.TreeMap;
 import java.util.Map;
 
 /** Translates a .properties file into a .java file containing an enum-like Java class
@@ -96,12 +96,13 @@
     }
 
     private Map<String, String> parseOptions(String args[]) {
-        Map<String, String> optionsMap = new HashMap<>(args.length);
+        /* Use TreeMap to guarantee stable forEach iteration */
+        Map<String, String> optionsMap = new TreeMap<>();
         for ( int i = 0; i < args.length ; i++ ) {
             if ( "-compile".equals(args[i]) && i+2 < args.length ) {
                 optionsMap.put(args[++i], args[++i]);
             } else {
-                return new HashMap<>();
+                return new TreeMap<>();
             }
         }
         return optionsMap;
--- a/make/launcher/LauncherCommon.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/launcher/LauncherCommon.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -25,19 +25,13 @@
 
 include JdkNativeCompilation.gmk
 
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN)
-else
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-  endif
-  ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib/jli)
+ORIGIN_ARG := $(call SET_EXECUTABLE_ORIGIN,/../lib/jli)
 
-  # Applications expect to be able to link against libjawt without invoking
-  # System.loadLibrary("jawt") first. This was the behaviour described in the
-  # devloper documentation of JAWT and what worked with OpenJDK6.
-  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
-    ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib)
-  endif
+# Applications expect to be able to link against libjawt without invoking
+# System.loadLibrary("jawt") first. This was the behaviour described in the
+# devloper documentation of JAWT and what worked with OpenJDK6.
+ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
+  ORIGIN_ARG += $(call SET_EXECUTABLE_ORIGIN,/../lib)
 endif
 
 # Tell the compiler not to export any functions unless declared so in
@@ -153,8 +147,6 @@
           -framework Foundation \
           -framework SystemConfiguration \
           -lstdc++ -liconv
-    else
-      $1_LIBS += $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
     endif
     $1_LIBS += -framework Cocoa -framework Security \
         -framework ApplicationServices
@@ -195,11 +187,14 @@
           $$($1_LDFLAGS), \
       LDFLAGS_linux := \
           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
+      LDFLAGS_macosx := \
+          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
       LDFLAGS_solaris := $$($1_LDFLAGS_solaris) \
           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/jli, \
       LIBS := $(JDKEXE_LIBS) $$($1_LIBS), \
       LIBS_unix := $$($1_LIBS_unix), \
       LIBS_linux := -lpthread -ljli $(LIBDL), \
+      LIBS_macosx := -ljli, \
       LIBS_solaris := -ljli -lthread $(LIBDL), \
       LIBS_windows := $$($1_WINDOWS_JLI_LIB) \
           $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib \
@@ -215,7 +210,7 @@
   $1 += $$(BUILD_LAUNCHER_$1)
   TARGETS += $$($1)
 
-  ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
+  ifeq ($(OPENJDK_TARGET_OS), aix)
     $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
   endif
 
--- a/make/lib/CoreLibraries.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/lib/CoreLibraries.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -39,59 +39,30 @@
   BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
 endif
 
-ifeq ($(OPENJDK_TARGET_OS), linux)
-  ifeq ($(OPENJDK_TARGET_CPU), ppc64)
-    BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
-  else ifeq ($(OPENJDK_TARGET_CPU), ppc64le)
-    BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
-  else ifeq ($(OPENJDK_TARGET_CPU), s390x)
-    BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
-  else ifeq ($(OPENJDK_TARGET_CPU), aarch64)
-    BUILD_LIBFDLIBM_OPTIMIZATION := HIGH
-  endif
+# If FDLIBM_CFLAGS is non-empty we know that we can optimize
+# fdlibm when adding those extra C flags. Currently GCC,
+# and clang only.
+ifneq ($(FDLIBM_CFLAGS), )
+  BUILD_LIBFDLIBM_OPTIMIZATION := LOW
 endif
 
 LIBFDLIBM_SRC := $(TOPDIR)/src/java.base/share/native/libfdlibm
-LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC)
+LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC) $(FDLIBM_CFLAGS)
 
-ifneq ($(OPENJDK_TARGET_OS), macosx)
-  $(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM, \
-      NAME := fdlibm, \
-      TYPE := STATIC_LIBRARY, \
-      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
-      SRC := $(LIBFDLIBM_SRC), \
-      OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
-      CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
-      CFLAGS_windows_debug := -DLOGGING, \
-      CFLAGS_aix := -qfloat=nomaf, \
-      CFLAGS_linux_ppc64 := -ffp-contract=off, \
-      CFLAGS_linux_ppc64le := -ffp-contract=off, \
-      CFLAGS_linux_s390x := -ffp-contract=off, \
-      CFLAGS_linux_aarch64 := -ffp-contract=off, \
-      DISABLED_WARNINGS_gcc := sign-compare misleading-indentation array-bounds, \
-      DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
-      ARFLAGS := $(ARFLAGS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
-  ))
-
-else
-
-  # On macosx the old build does partial (incremental) linking of fdlibm instead of
-  # a plain static library.
-  $(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM_MAC, \
-      NAME := fdlibm, \
-      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
-      SRC := $(LIBFDLIBM_SRC), \
-      CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
-      LDFLAGS := -nostdlib $(ARFLAGS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
-  ))
-
-  BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
-  $(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
-	$(call install-file)
-
-endif
+$(eval $(call SetupNativeCompilation, BUILD_LIBFDLIBM, \
+    NAME := fdlibm, \
+    TYPE := STATIC_LIBRARY, \
+    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
+    SRC := $(LIBFDLIBM_SRC), \
+    OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
+    CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
+    CFLAGS_windows_debug := -DLOGGING, \
+    CFLAGS_aix := -qfloat=nomaf, \
+    DISABLED_WARNINGS_gcc := sign-compare misleading-indentation array-bounds, \
+    DISABLED_WARNINGS_microsoft := 4146 4244 4018, \
+    ARFLAGS := $(ARFLAGS), \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
+))
 
 ##########################################################################################
 
@@ -140,15 +111,15 @@
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/, \
     LDFLAGS_windows := -delayload:shell32.dll, \
+    LIBS := $(BUILD_LIBFDLIBM_TARGET), \
     LIBS_unix := -ljvm -lverify, \
-    LIBS_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
-    LIBS_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM), \
-    LIBS_aix := $(LIBDL) $(BUILD_LIBFDLIBM) $(LIBM),\
-    LIBS_macosx := -lfdlibm \
-        -framework CoreFoundation \
+    LIBS_linux := $(LIBDL), \
+    LIBS_solaris := -lsocket -lnsl -lscf $(LIBDL), \
+    LIBS_aix := $(LIBDL) $(LIBM),\
+    LIBS_macosx := -framework CoreFoundation \
         -framework Foundation \
         -framework Security -framework SystemConfiguration, \
-    LIBS_windows := jvm.lib $(BUILD_LIBFDLIBM) $(WIN_VERIFY_LIB) \
+    LIBS_windows := jvm.lib $(WIN_VERIFY_LIB) \
         shell32.lib delayimp.lib \
         advapi32.lib version.lib, \
 ))
@@ -309,33 +280,6 @@
 
   TARGETS += $(BUILD_LIBJLI_STATIC)
 
-else ifeq ($(OPENJDK_TARGET_OS), macosx)
-  #
-  # On macosx they do partial (incremental) linking of libjli_static.a
-  # code it here...rather than add support to NativeCompilation
-  # as this is first time I see it
-  $(eval $(call SetupNativeCompilation, BUILD_LIBJLI_STATIC, \
-      NAME := jli_static, \
-      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
-      SRC := $(LIBJLI_SRC_DIRS), \
-      EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
-      EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
-      OPTIMIZATION := HIGH, \
-      CFLAGS := $(LIBJLI_CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \
-          $(addprefix -I, $(LIBJLI_SRC_DIRS)), \
-      LDFLAGS := -nostdlib $(ARFLAGS), \
-      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
-  ))
-
-  ifeq ($(STATIC_BUILD), true)
-    TARGETS += $(BUILD_LIBJLI_STATIC)
-  else
-    $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a: $(BUILD_LIBJLI_STATIC)
-	$(call install-file)
-
-    TARGETS += $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a
-  endif
-
 else ifeq ($(OPENJDK_TARGET_OS), aix)
   # AIX also requires a static libjli because the compiler doesn't support '-rpath'
   $(eval $(call SetupNativeCompilation, BUILD_LIBJLI_STATIC, \
--- a/make/lib/Lib-java.base.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/lib/Lib-java.base.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -128,14 +128,6 @@
 
 ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
   ifeq ($(STATIC_BUILD), false)
-
-    LIBJSIG_MAPFILE := $(wildcard $(TOPDIR)/make/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS))
-
-    ifeq ($(OPENJDK_TARGET_OS), linux)
-      # FIXME: This is probably not what we want to do, but keep it now for compatibility.
-      LIBJSIG_CFLAGS := $(EXPORT_ALL_SYMBOLS)
-    endif
-
     $(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \
         NAME := jsig, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBJSIG_CFLAGS), \
@@ -144,7 +136,6 @@
         LIBS_linux := $(LIBDL), \
         LIBS_solaris := $(LIBDL), \
         LIBS_aix := $(LIBDL), \
-        MAPFILE := $(LIBJSIG_MAPFILE), \
     ))
 
     TARGETS += $(BUILD_LIBJSIG)
@@ -204,3 +195,14 @@
 
   TARGETS += $(JAVA_BASE_EXPORT_SYMBOL_FILE)
 endif
+
+################################################################################
+# Copy tzmappings file for Windows
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  $(eval $(call SetupCopyFiles, COPY_TZMAPPINGS, \
+      FILES := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/windows/conf/tzmappings, \
+      DEST := $(call FindLibDirForModule, $(MODULE)), \
+  ))
+  TARGETS += $(COPY_TZMAPPINGS)
+endif 
--- a/make/lib/Lib-java.instrument.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/lib/Lib-java.instrument.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -55,21 +55,21 @@
         -L$(call FindLibDirForModule, java.base)/jli, \
     LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli) \
         -L$(call FindLibDirForModule, java.base)/jli, \
-    LDFLAGS_macosx := -Wl$(COMMA)-all_load, \
+    LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN,/jli) \
+        -L$(call FindLibDirForModule, java.base)/jli, \
     LDFLAGS_aix := -L$(SUPPORT_OUTPUTDIR)/native/java.base, \
     LIBS := $(JDKLIB_LIBS), \
     LIBS_unix := -ljava -ljvm $(LIBZ_LIBS), \
     LIBS_linux := -ljli $(LIBDL), \
     LIBS_solaris := -ljli $(LIBDL), \
     LIBS_aix := -liconv -ljli_static $(LIBDL), \
-    LIBS_macosx := -liconv -framework Cocoa -framework Security \
-        -framework ApplicationServices \
-        $(call FindStaticLib, java.base, jli_static), \
+    LIBS_macosx := -ljli -liconv -framework Cocoa -framework Security \
+        -framework ApplicationServices, \
     LIBS_windows := jvm.lib $(WIN_JAVA_LIB) advapi32.lib \
         $(call FindStaticLib, java.base, jli_static), \
 ))
 
-ifneq ($(filter $(OPENJDK_TARGET_OS), macosx windows aix), )
+ifneq ($(filter $(OPENJDK_TARGET_OS), windows aix), )
   $(BUILD_LIBINSTRUMENT): $(call FindStaticLib, java.base, jli_static)
 else
   $(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, jli, /jli)
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Tue Sep 18 16:41:24 2018 -0700
@@ -52,7 +52,7 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBSA, \
     NAME := saproc, \
-    OPTIMIZATION := NONE, \
+    OPTIMIZATION := HIGH, \
     DISABLED_WARNINGS_microsoft := 4267, \
     DISABLED_WARNINGS_gcc := sign-compare, \
     DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
--- a/make/mapfiles/libjsig/mapfile-vers-solaris	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#
-# 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.
-#  
-#
-
-# Define library interface.
-
-SUNWprivate_1.1 {
-        global:
-            JVM_begin_signal_setting;
-            JVM_end_signal_setting;
-            JVM_get_signal_action;
-            sigaction;
-            signal;
-            sigset;
-        local:
-                *;
-};
--- a/make/mapfiles/libjsound/mapfile-vers	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,83 +0,0 @@
-#
-# 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.  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.
-#
-
-# Define library interface.
-
-SUNWprivate_1.1 {
-    global:
-		Java_com_sun_media_sound_DirectAudioDevice_nAvailable;
-		Java_com_sun_media_sound_DirectAudioDevice_nClose;
-		Java_com_sun_media_sound_DirectAudioDevice_nFlush;
-		Java_com_sun_media_sound_DirectAudioDevice_nGetBufferSize;
-		Java_com_sun_media_sound_DirectAudioDevice_nGetBytePosition;
-		Java_com_sun_media_sound_DirectAudioDevice_nGetFormats;
-		Java_com_sun_media_sound_DirectAudioDevice_nIsStillDraining;
-		Java_com_sun_media_sound_DirectAudioDevice_nOpen;
-		Java_com_sun_media_sound_DirectAudioDevice_nRead;
-		Java_com_sun_media_sound_DirectAudioDevice_nRequiresServicing;
-		Java_com_sun_media_sound_DirectAudioDevice_nService;
-		Java_com_sun_media_sound_DirectAudioDevice_nSetBytePosition;
-		Java_com_sun_media_sound_DirectAudioDevice_nStart;
-		Java_com_sun_media_sound_DirectAudioDevice_nStop;
-		Java_com_sun_media_sound_DirectAudioDevice_nWrite;
-		Java_com_sun_media_sound_DirectAudioDeviceProvider_nGetNumDevices;
-		Java_com_sun_media_sound_DirectAudioDeviceProvider_nNewDirectAudioDeviceInfo;
-		Java_com_sun_media_sound_MidiInDevice_nClose;
-		Java_com_sun_media_sound_MidiInDevice_nGetMessages;
-		Java_com_sun_media_sound_MidiInDevice_nGetTimeStamp;
-		Java_com_sun_media_sound_MidiInDevice_nOpen;
-		Java_com_sun_media_sound_MidiInDevice_nStart;
-		Java_com_sun_media_sound_MidiInDevice_nStop;
-		Java_com_sun_media_sound_MidiInDeviceProvider_nGetDescription;
-		Java_com_sun_media_sound_MidiInDeviceProvider_nGetName;
-		Java_com_sun_media_sound_MidiInDeviceProvider_nGetNumDevices;
-		Java_com_sun_media_sound_MidiInDeviceProvider_nGetVendor;
-		Java_com_sun_media_sound_MidiInDeviceProvider_nGetVersion;
-		Java_com_sun_media_sound_MidiOutDevice_nClose;
-		Java_com_sun_media_sound_MidiOutDevice_nGetTimeStamp;
-		Java_com_sun_media_sound_MidiOutDevice_nOpen;
-		Java_com_sun_media_sound_MidiOutDevice_nSendLongMessage;
-		Java_com_sun_media_sound_MidiOutDevice_nSendShortMessage;
-		Java_com_sun_media_sound_MidiOutDeviceProvider_nGetDescription;
-		Java_com_sun_media_sound_MidiOutDeviceProvider_nGetName;
-		Java_com_sun_media_sound_MidiOutDeviceProvider_nGetNumDevices;
-		Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVendor;
-		Java_com_sun_media_sound_MidiOutDeviceProvider_nGetVersion;
-		Java_com_sun_media_sound_Platform_nIsBigEndian;
-		Java_com_sun_media_sound_PortMixer_nClose;
-		Java_com_sun_media_sound_PortMixer_nControlGetFloatValue;
-		Java_com_sun_media_sound_PortMixer_nControlGetIntValue;
-		Java_com_sun_media_sound_PortMixer_nControlSetFloatValue;
-		Java_com_sun_media_sound_PortMixer_nControlSetIntValue;
-		Java_com_sun_media_sound_PortMixer_nGetControls;
-		Java_com_sun_media_sound_PortMixer_nGetPortCount;
-		Java_com_sun_media_sound_PortMixer_nGetPortName;
-		Java_com_sun_media_sound_PortMixer_nGetPortType;
-		Java_com_sun_media_sound_PortMixer_nOpen;
-		Java_com_sun_media_sound_PortMixerProvider_nGetNumDevices;
-		Java_com_sun_media_sound_PortMixerProvider_nNewPortMixerInfo;
-    local:
-        *;
-};
--- a/make/mapfiles/libjvm_db/mapfile-vers	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-#
-
-#
-# Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-# Define library interface.
-
-SUNWprivate_1.1 {
-        global:
-            Jagent_create;
-	    Jagent_destroy;
-	    Jframe_iter;
-	    #Jget_vframe;
-	    #Jlookup_by_regs;
-        local:
-                *;
-};
--- a/make/mapfiles/libjvm_dtrace/mapfile-vers	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#
-
-#
-# Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#  
-#
-
-# Define library interface for JVM-DTrace interface
-
-SUNWprivate_1.1 {
-        global:
-            jvm_attach;
-            jvm_get_last_error;
-            jvm_enable_dtprobes;
-            jvm_detach;
-        local:
-                *;
-};
--- a/make/scripts/compare.sh	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/scripts/compare.sh	Tue Sep 18 16:41:24 2018 -0700
@@ -65,6 +65,59 @@
 . "$COMPARE_EXCEPTIONS_INCLUDE"
 
 ################################################################################
+#
+# Disassembly diff filters. These filters try to filter out ephemeral parts of the
+# disassembly, such as hard-coded addresses, to be able to catch "actual" differences.
+
+if [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
+  if [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then
+    DIS_DIFF_FILTER="$SED \
+        -e 's/^[0-9a-f]\{16\}/<ADDR>:/' \
+        -e 's/^ *[0-9a-f]\{3,12\}:/  <ADDR>:/' \
+        -e 's/:	[0-9a-f][0-9a-f]\( [0-9a-f][0-9a-f]\)\{2,10\}/:	<NUMS>/' \
+        -e 's/\$[a-zA-Z0-9_\$]\{15\}\./<SYM>./' \
+        -e 's/, [0-9a-fx\-]\{1,8\}/, <ADDR>/g' \
+        -e 's/0x[0-9a-f]\{1,8\}/<HEX>/g' \
+        -e 's/\! [0-9a-f]\{1,8\} /! <ADDR> /' \
+        -e 's/call  [0-9a-f]\{4,7\}/call  <ADDR>/' \
+        -e 's/%hi(0),/%hi(<HEX>),/' \
+        "
+  elif [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+    # Random strings looking like this differ: <.XAKoKoPIac2W0OA.
+    DIS_DIFF_FILTER="$SED \
+        -e 's/<\.[A-Za-z0-9]\{\15}\./<.SYM./' \
+        "
+  fi
+elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+  if [ "$OPENJDK_TARGET_CPU" = "x86" ]; then
+    DIS_DIFF_FILTER="$SED -r \
+        -e 's/^  [0-9A-F]{16}: //' \
+        -e 's/^  [0-9A-F]{8}: /  <ADDR>: /' \
+        -e 's/(offset \?\?)_C@_.*/\1<SYM>/' \
+        -e 's/[@?][A-Za-z0-9_]{1,25}/<SYM>/' \
+        -e 's/([-,+])[0-9A-F]{2,16}/\1<HEXSTR>/g' \
+        -e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
+        -e 's/: ([a-z]{2}[a-z ]{2})        [0-9A-F]{2,16}h?$/: \1        <HEXSTR>/' \
+        -e 's/_20[0-9]{2}_[0-1][0-9]_[0-9]{2}/_<DATE>/' \
+        "
+  elif [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
+    DIS_DIFF_FILTER="$SED -r \
+        -e 's/^  [0-9A-F]{16}: //' \
+        -e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
+        -e 's/([,+])[0-9A-F]{2,16}h/\1<HEXSTR>/' \
+        -e 's/([a-z]{2}[a-z ]{2})        [0-9A-F]{4,16}$/\1        <HEXSTR>/' \
+        -e 's/\[\?\?_C@_.*/[<SYM>]/' \
+        "
+  fi
+elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
+  DIS_DIFF_FILTER="LANG=C $SED \
+      -e 's/0x[0-9a-f]\{3,16\}/<HEXSTR>/g' -e 's/^[0-9a-f]\{12,20\}/<ADDR>/' \
+      -e 's/-20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]-[0-2][0-9]\{5\}/<DATE>/g' \
+      -e 's/), built on .*/), <DATE>/' \
+      "
+fi
+
+################################################################################
 # Compare text files and ignore specific differences:
 #
 #  * Timestamps in Java sources generated by idl2java
--- a/make/scripts/compare_exceptions.sh.incl	Tue Sep 18 16:32:39 2018 -0700
+++ b/make/scripts/compare_exceptions.sh.incl	Tue Sep 18 16:41:24 2018 -0700
@@ -36,550 +36,37 @@
 # Diff exceptions
 
 if [ "$OPENJDK_TARGET_OS" = "linux" ]; then
-
-  STRIP_BEFORE_COMPARE="
-      "
-
   ACCEPTED_BIN_DIFF="
-      ./lib/client/libjsig.so
-      ./lib/client/libjvm.so
-      ./lib/libattach.so
-      ./lib/libdt_socket.so
-      ./lib/libinstrument.so
-      ./lib/libjsdt.so
-      ./lib/libjsig.so
-      ./lib/libmanagement.so
-      ./lib/libnet.so
-      ./lib/libnpt.so
-      ./lib/libverify.so
-      ./lib/minimal/libjsig.so
-      ./lib/minimal/libjvm.so
-      ./lib/server/libjsig.so
       ./lib/server/libjvm.so
-      ./bin/idlj
-      ./bin/jar
-      ./bin/jarsigner
-      ./bin/java
-      ./bin/javac
-      ./bin/javadoc
-      ./bin/javap
-      ./bin/jdeps
-      ./bin/jcmd
-      ./bin/jconsole
-      ./bin/jdb
-      ./bin/jhsdb
-      ./bin/jimage
-      ./bin/jinfo
-      ./bin/jjs
-      ./bin/jlink
-      ./bin/jmap
-      ./bin/jmod
-      ./bin/jps
-      ./bin/jrunscript
-      ./bin/jsadebugd
-      ./bin/jshell
-      ./bin/jstack
-      ./bin/jstat
-      ./bin/jstatd
-      ./bin/keytool
-      ./bin/orbd
-      ./bin/pack200
-      ./bin/rmic
-      ./bin/rmid
-      ./bin/rmiregistry
-      ./bin/schemagen
-      ./bin/serialver
-      ./bin/servertool
-      ./bin/tnameserv
-      ./bin/wsgen
-      ./bin/wsimport
-      ./bin/xjc
       "
-
-  if [ "$OPENJDK_TARGET_CPU" = "arm" ]; then
-    # NOTE: When comparing the old and new hotspot builds, the link time
-    # optimization makes good comparisons impossible. Fulldump compare always
-    # fails and disassembly can end up with some functions in different order.
-    # So for now, accept the difference but put a limit on the size. The
-    # different order of functions shouldn't result in a very big diff.
-    KNOWN_FULLDUMP_DIFF="
-        ./lib/minimal/libjvm.so
-        "
-
-    # Link time optimization adds random numbers to symbol names
-    NEED_DIS_DIFF_FILTER="
-        ./lib/minimal/libjvm.so
-        "
-    DIS_DIFF_FILTER="$SED -r \
-        -e 's/\.[0-9]+/.X/g' \
-        -e 's/\t[0-9a-f]{4} [0-9a-f]{4} /\tXXXX XXXX /' \
-        -e 's/\t[0-9a-f]{5,} /\t<HEX> /' \
-        "
-    KNOWN_DIS_DIFF="
-        ./lib/minimal/libjvm.so
-        "
-    MAX_KNOWN_DIS_DIFF_SIZE="3000"
-
-    NEED_SYMBOLS_DIFF_FILTER="
-        ./lib/minimal/libjvm.so
-        "
-    SYMBOLS_DIFF_FILTER="$SED -r \
-        -e 's/\.[0-9]+/.X/g'
-        "
-  fi
-fi
-
-if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
-
-  STRIP_BEFORE_COMPARE="
-      "
-
+elif [ "$OPENJDK_TARGET_OS" = "solaris" ]; then
+  SKIP_BIN_DIFF="true"
+  SKIP_FULLDUMP_DIFF="true"
+  MAX_KNOWN_DIS_DIFF_SIZE="3000"
   SORT_SYMBOLS="
-      ./lib/server/libjvm.so
       ./lib/libfontmanager.so
       ./lib/libjimage.so
-      ./lib/libsaproc.so
       ./lib/libunpack.so
+      ./lib/server/libjvm.so
       ./bin/unpack200
       "
-
-  SKIP_BIN_DIFF="true"
-
-  ACCEPTED_SMALL_SIZE_DIFF="
-      ./lib/jli/libjli.so
-      ./lib/jspawnhelper
-      ./lib/libJdbcOdbc.so
-      ./lib/libattach.so
-      ./lib/libawt.so
-      ./lib/libawt_headless.so
-      ./lib/libawt_xawt.so
-      ./lib/libdcpr.so
-      ./lib/libdt_socket.so
-      ./lib/libfontmanager.so
-      ./lib/libinstrument.so
-      ./lib/libj2gss.so
-      ./lib/libj2pcsc.so
-      ./lib/libj2pkcs11.so
-      ./lib/libj2ucrypto.so
-      ./lib/libjaas_unix.so
-      ./lib/libjava.so
-      ./lib/libjawt.so
-      ./lib/libjdwp.so
-      ./lib/libjpeg.so
-      ./lib/libjsdt.so
-      ./lib/libjsound.so
-      ./lib/libkcms.so
-      ./lib/liblcms.so
-      ./lib/libmanagement.so
-      ./lib/libmlib_image.so
-      ./lib/libnet.so
-      ./lib/libnio.so
-      ./lib/libnpt.so
-      ./lib/libsctp.so
-      ./lib/libsplashscreen.so
-      ./lib/libsunec.so
-      ./lib/libsunwjdga.so
-      ./lib/libunpack.so
-      ./lib/libverify.so
-      ./lib/libzip.so
-      ./lib/server/64/libjvm_db.so
-      ./lib/server/64/libjvm_dtrace.so
-      ./lib/server/libjvm.so
-      ./lib/server/libjvm_db.so
-      ./lib/server/libjvm_dtrace.so
-      ./bin/idlj
-      ./bin/jar
-      ./bin/jarsigner
-      ./bin/java
-      ./bin/javac
-      ./bin/javadoc
-      ./bin/javap
-      ./bin/jdeps
-      ./bin/jcmd
-      ./bin/jconsole
-      ./bin/jdb
-      ./bin/jimage
-      ./bin/jinfo
-      ./bin/jjs
-      ./bin/jlink
-      ./bin/jmap
-      ./bin/jmod
-      ./bin/jps
-      ./bin/jrunscript
-      ./bin/jsadebugd
-      ./bin/jstack
-      ./bin/jstat
-      ./bin/jstatd
-      ./bin/keytool
-      ./bin/orbd
-      ./bin/pack200
-      ./bin/rmic
-      ./bin/rmid
-      ./bin/rmiregistry
-      ./bin/schemagen
-      ./bin/serialver
-      ./bin/servertool
-      ./bin/tnameserv
-      ./bin/unpack200
-      ./bin/wsgen
-      ./bin/wsimport
-      ./bin/xjc
-      "
-
-  SKIP_FULLDUMP_DIFF="true"
-
-  # Random strings looking like this differ: <.XAKoKoPIac2W0OA.
-  DIS_DIFF_FILTER="$SED \
-      -e 's/<\.[A-Za-z0-9]\{\15}\./<.SYM./' \
-      "
-
-fi
-
-if [ "$OPENJDK_TARGET_OS" = "solaris" ] && [ "$OPENJDK_TARGET_CPU" = "sparcv9" ]; then
-
-  STRIP_BEFORE_COMPARE="
-      "
-
-  SORT_SYMBOLS="
-      ./lib/libjsig.so
+  KNOWN_DIS_DIFF="
       ./lib/libfontmanager.so
-      ./lib/libjimage.so
-      ./lib/libsaproc.so
-      ./lib/libunpack.so
-      ./lib/server/libjvm.so
-      ./lib/server/libjvm_dtrace.so
-      ./bin/unpack200
-      "
-
-  SKIP_BIN_DIFF="true"
-
-  ACCEPTED_SMALL_SIZE_DIFF="
-      ./lib/client/libjvm.so
-      ./lib/jli/libjli.so
-      ./lib/jspawnhelper
-      ./lib/libJdbcOdbc.so
-      ./lib/libattach.so
-      ./lib/libawt.so
-      ./lib/libawt_headless.so
-      ./lib/libawt_xawt.so
-      ./lib/libdcpr.so
-      ./lib/libdt_socket.so
-      ./lib/libfontmanager.so
-      ./lib/libinstrument.so
-      ./lib/libj2gss.so
-      ./lib/libj2pcsc.so
-      ./lib/libj2pkcs11.so
-      ./lib/libj2ucrypto.so
-      ./lib/libjaas_unix.so
-      ./lib/libjava.so
-      ./lib/libjawt.so
-      ./lib/libjdwp.so
-      ./lib/libjpeg.so
-      ./lib/libjsdt.so
-      ./lib/libjsound.so
-      ./lib/libkcms.so
-      ./lib/liblcms.so
-      ./lib/libmanagement.so
-      ./lib/libmlib_image.so
-      ./lib/libmlib_image_v.so
-      ./lib/libnet.so
-      ./lib/libnio.so
-      ./lib/libnpt.so
-      ./lib/libsctp.so
-      ./lib/libsplashscreen.so
-      ./lib/libsunec.so
-      ./lib/libsunwjdga.so
-      ./lib/libunpack.so
-      ./lib/libverify.so
-      ./lib/libzip.so
-      ./lib/server/libjvm.so
-      ./bin/idlj
-      ./bin/jar
-      ./bin/jarsigner
-      ./bin/java
-      ./bin/javac
-      ./bin/javadoc
-      ./bin/javap
-      ./bin/jdeps
-      ./bin/jcmd
-      ./bin/jconsole
-      ./bin/jdb
-      ./bin/jimage
-      ./bin/jinfo
-      ./bin/jjs
-      ./bin/jlink
-      ./bin/jmap
-      ./bin/jmod
-      ./bin/jps
-      ./bin/jrunscript
-      ./bin/jsadebugd
-      ./bin/jstack
-      ./bin/jstat
-      ./bin/jstatd
-      ./bin/keytool
-      ./bin/orbd
-      ./bin/pack200
-      ./bin/rmic
-      ./bin/rmid
-      ./bin/rmiregistry
-      ./bin/schemagen
-      ./bin/serialver
-      ./bin/servertool
-      ./bin/tnameserv
-      ./bin/unpack200
-      ./bin/wsgen
-      ./bin/wsimport
-      ./bin/xjc
-      "
-
-  DIS_DIFF_FILTER="$SED \
-      -e 's/^[0-9a-f]\{16\}/<ADDR>:/' \
-      -e 's/^ *[0-9a-f]\{3,12\}:/  <ADDR>:/' \
-      -e 's/:	[0-9a-f][0-9a-f]\( [0-9a-f][0-9a-f]\)\{2,10\}/:	<NUMS>/' \
-      -e 's/\$[a-zA-Z0-9_\$]\{15\}\./<SYM>./' \
-      -e 's/, [0-9a-fx\-]\{1,8\}/, <ADDR>/g' \
-      -e 's/0x[0-9a-f]\{1,8\}/<HEX>/g' \
-      -e 's/\! [0-9a-f]\{1,8\} /! <ADDR> /' \
-      -e 's/call  [0-9a-f]\{4,7\}/call  <ADDR>/' \
-      -e 's/%hi(0),/%hi(<HEX>),/' \
-      "
-
-  KNOWN_DIS_DIFF="
       ./lib/libsaproc.so
   "
-
-  MAX_KNOWN_DIS_DIFF_SIZE="3000"
-
-  # On slowdebug the disassembly can differ randomly.
-  if [ "$DEBUG_LEVEL" = "slowdebug" ]; then
-    ACCEPTED_DIS_DIFF="
-        ./lib/libfontmanager.so
-        ./lib/server/libjvm.so
-    "
-  fi
-
+elif [ "$OPENJDK_TARGET_OS" = "windows" ]; then
+  SKIP_BIN_DIFF="true"
   SKIP_FULLDUMP_DIFF="true"
-
-fi
-
-
-if [ "$OPENJDK_TARGET_OS" = "windows" ]; then
-
   ACCEPTED_JARZIP_CONTENTS="
-      /modules_libs/java.security.jgss/w2k_lsa_auth.diz
       /modules_libs/java.security.jgss/w2k_lsa_auth.pdb
       /modules_libs/java.security.jgss/w2k_lsa_auth.map
       /modules_libs/java.security.jgss/w2k_lsa_auth.dll
       "
-
-  # Probably should add all libs here
-  ACCEPTED_SMALL_SIZE_DIFF="
-      ./bin/attach.dll
-      ./bin/jsoundds.dll
-      ./bin/client/jvm.dll
-      ./bin/server/jvm.dll
-      ./bin/idlj.exe
-      ./bin/jar.exe
-      ./bin/jarsigner.exe
-      ./bin/java-rmi.exe
-      ./bin/java.exe
-      ./bin/javac.exe
-      ./bin/javadoc.exe
-      ./bin/javap.exe
-      ./bin/jdeps.exe
-      ./bin/javaw.exe
-      ./bin/jcmd.exe
-      ./bin/jconsole.exe
-      ./bin/jdb.exe
-      ./bin/jimage.exe
-      ./bin/jinfo.exe
-      ./bin/jjs.exe
-      ./bin/jlink.exe
-      ./bin/jmap.exe
-      ./bin/jmod.exe
-      ./bin/jps.exe
-      ./bin/jrunscript.exe
-      ./bin/jsadebugd.exe
-      ./bin/jstack.exe
-      ./bin/jstat.exe
-      ./bin/jstatd.exe
-      ./bin/keytool.exe
-      ./bin/kinit.exe
-      ./bin/klist.exe
-      ./bin/ktab.exe
-      ./bin/orbd.exe
-      ./bin/pack200.exe
-      ./bin/rmic.exe
-      ./bin/rmid.exe
-      ./bin/rmiregistry.exe
-      ./bin/schemagen.exe
-      ./bin/serialver.exe
-      ./bin/servertool.exe
-      ./bin/tnameserv.exe
-      ./bin/unpack200.exe
-      ./bin/wsgen.exe
-      ./bin/wsimport.exe
-      ./bin/xjc.exe
-      "
-
-  SORT_SYMBOLS="
-      ./bin/fontmanager.dll
-      "
-
-  ACCEPTED_DIS_DIFF="
-      ./bin/jabswitch.exe
-      ./bin/fontmanager.dll
-      "
-
-  if [ "$OPENJDK_TARGET_CPU" = "x86" ]; then
-    DIS_DIFF_FILTER="$SED -r \
-        -e 's/^  [0-9A-F]{16}: //' \
-        -e 's/^  [0-9A-F]{8}: /  <ADDR>: /' \
-        -e 's/(offset \?\?)_C@_.*/\1<SYM>/' \
-        -e 's/[@?][A-Za-z0-9_]{1,25}/<SYM>/' \
-        -e 's/([-,+])[0-9A-F]{2,16}/\1<HEXSTR>/g' \
-        -e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
-        -e 's/: ([a-z]{2}[a-z ]{2})        [0-9A-F]{2,16}h?$/: \1        <HEXSTR>/' \
-        -e 's/_20[0-9]{2}_[0-1][0-9]_[0-9]{2}/_<DATE>/' \
-        "
-  elif [ "$OPENJDK_TARGET_CPU" = "x86_64" ]; then
-    DIS_DIFF_FILTER="$SED -r \
-        -e 's/^  [0-9A-F]{16}: //' \
-        -e 's/\[[0-9A-F]{4,16}h\]/[<HEXSTR>]/' \
-        -e 's/([,+])[0-9A-F]{2,16}h/\1<HEXSTR>/' \
-        -e 's/([a-z]{2}[a-z ]{2})        [0-9A-F]{4,16}$/\1        <HEXSTR>/' \
-        -e 's/\[\?\?_C@_.*/[<SYM>]/' \
-        "
-  fi
-
-  SKIP_BIN_DIFF="true"
-  SKIP_FULLDUMP_DIFF="true"
-
-  # NOTE: When comparing the old and new hotspot builds, the server jvm.dll
-  # cannot be made equal in disassembly. Some functions just always end up
-  # in different order. So for now, accept the difference but put a limit
-  # on the size. The different order of functions shouldn't result in a very
-  # big diff.
-  KNOWN_DIS_DIFF="
-      ./bin/server/jvm.dll
-      "
-  MAX_KNOWN_DIS_DIFF_SIZE="2000000"
-fi
-
-
-if [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
-
-  ACCEPTED_JARZIP_CONTENTS="
-      /META-INF/INDEX.LIST
-      "
-
+elif [ "$OPENJDK_TARGET_OS" = "macosx" ]; then
   ACCEPTED_BIN_DIFF="
-      ./bin/idlj
-      ./bin/jar
-      ./bin/jarsigner
-      ./bin/java
-      ./bin/javac
-      ./bin/javadoc
-      ./bin/javap
-      ./bin/javaws
-      ./bin/jdeps
-      ./bin/jcmd
-      ./bin/jconsole
-      ./bin/jdb
-      ./bin/jimage
-      ./bin/jinfo
-      ./bin/jjs
-      ./bin/jlink
-      ./bin/jmap
-      ./bin/jmod
-      ./bin/jps
-      ./bin/jrunscript
-      ./bin/jsadebugd
-      ./bin/jstack
-      ./bin/jstat
-      ./bin/jstatd
-      ./bin/keytool
-      ./bin/orbd
-      ./bin/pack200
-      ./bin/rmic
-      ./bin/rmid
-      ./bin/rmiregistry
-      ./bin/schemagen
-      ./bin/serialver
-      ./bin/servertool
-      ./bin/tnameserv
-      ./bin/wsgen
-      ./bin/wsimport
-      ./bin/xjc
-      ./Contents/Home/bin/_javaws
-      ./Contents/Home/bin/javaws
-      ./Contents/Home/bin/idlj
-      ./Contents/Home/bin/servertool
-      ./Contents/Home/lib/shortcuts/JavaWSApplicationStub
-      ./Contents/Home/lib/jli/libjli.dylib
-      ./Contents/Home/lib/jspawnhelper
-      ./Contents/Home/lib/libAppleScriptEngine.dylib
-      ./Contents/Home/lib/libattach.dylib
-      ./Contents/Home/lib/libawt_lwawt.dylib
-      ./Contents/Home/lib/libdeploy.dylib
-      ./Contents/Home/lib/libdt_socket.dylib
-      ./Contents/Home/lib/libinstrument.dylib
-      ./Contents/Home/lib/libjdwp.dylib
-      ./Contents/Home/lib/libjsdt.dylib
-      ./Contents/Home/lib/libjsig.dylib
-      ./Contents/Home/lib/libmanagement.dylib
-      ./Contents/Home/lib/libnpjp2.dylib
-      ./Contents/Home/lib/libosx.dylib
-      ./Contents/Home/lib/libosxapp.dylib
-      ./Contents/Home/lib/libosxui.dylib
-      ./Contents/Home/lib/libverify.dylib
-      ./Contents/Home/lib/libsaproc.dylib
-      ./Contents/Home/lib/libsplashscreen.dylib
-      ./Contents/Home/lib/server/libjsig.dylib
-      ./Contents/Home/lib/server/libjvm.dylib
-      ./Contents/Home/lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel
-      ./Contents/Resources/JavaControlPanelHelper
-      ./Contents/Resources/JavaUpdater.app/Contents/MacOS/JavaUpdater
-      ./Contents/Resources/JavawsLauncher.app/Contents/MacOS/JavawsLauncher
-      ./lib/shortcuts/JavaWSApplicationStub
-      ./lib/jli/libjli.dylib
-      ./lib/jspawnhelper
-      ./lib/libAppleScriptEngine.dylib
-      ./lib/libattach.dylib
       ./lib/libawt_lwawt.dylib
-      ./lib/libdeploy.dylib
-      ./lib/libdt_socket.dylib
-      ./lib/libinstrument.dylib
-      ./lib/libjdwp.dylib
-      ./lib/libjsdt.dylib
-      ./lib/libjsig.dylib
-      ./lib/libmanagement.dylib
-      ./lib/libnpjp2.dylib
-      ./lib/libosx.dylib
       ./lib/libosxapp.dylib
       ./lib/libosxui.dylib
-      ./lib/libverify.dylib
-      ./lib/libsaproc.dylib
-      ./lib/libsplashscreen.dylib
-      ./lib/server/libjsig.dylib
       ./lib/server/libjvm.dylib
-      ./lib/deploy/JavaControlPanel.prefPane/Contents/MacOS/JavaControlPanel
-      ./Versions/A/Resources/finish_installation.app/Contents/MacOS/finish_installation
-      ./Versions/A/Sparkle
       "
-
-  SORT_SYMBOLS="
-      ./Contents/Home/lib/libsaproc.dylib
-      ./lib/libsaproc.dylib
-      ./lib/libjsig.dylib
-      "
-
-  ACCEPTED_SMALL_SIZE_DIFF="$ACCEPTED_BIN_DIFF"
-
-  DIS_DIFF_FILTER="LANG=C $SED \
-      -e 's/0x[0-9a-f]\{3,16\}/<HEXSTR>/g' -e 's/^[0-9a-f]\{12,20\}/<ADDR>/' \
-      -e 's/-20[0-9][0-9]-[0-1][0-9]-[0-3][0-9]-[0-2][0-9]\{5\}/<DATE>/g' \
-      -e 's/), built on .*/), <DATE>/' \
-      "
-
 fi
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -2356,7 +2356,7 @@
 
   // FMLA/FMLS - Vector - Scalar
   INSN(fmlavs, 0, 0b0001);
-  INSN(fmlsvs, 0, 0b0001);
+  INSN(fmlsvs, 0, 0b0101);
   // FMULX - Vector - Scalar
   INSN(fmulxvs, 1, 0b1001);
 
--- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1569,7 +1569,6 @@
   }
   Register newval = as_reg(op->new_value());
   Register cmpval = as_reg(op->cmp_value());
-  Label succeed, fail, around;
 
   if (op->code() == lir_cas_obj) {
     if (UseCompressedOops) {
--- a/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -64,7 +64,7 @@
   const int aligned_mask = BytesPerWord -1;
   const int hdr_offset = oopDesc::mark_offset_in_bytes();
   assert(hdr != obj && hdr != disp_hdr && obj != disp_hdr, "registers must be different");
-  Label done, fail;
+  Label done;
   int null_check_offset = -1;
 
   verify_oop(obj);
--- a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -615,7 +615,7 @@
   // Runtime will return true if the nmethod has been deoptimized during
   // the patching process. In that case we must do a deopt reexecute instead.
 
-  Label reexecuteEntry, cont;
+  Label cont;
 
   __ cbz(r0, cont);                                 // have we deoptimized?
 
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -5431,7 +5431,7 @@
 
   BLOCK_COMMENT("zero_words {");
   cmp(cnt, (u1)zero_words_block_size);
-  Label around, done, done16;
+  Label around;
   br(LO, around);
   {
     RuntimeAddress zero_blocks =  RuntimeAddress(StubRoutines::aarch64::zero_blocks());
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1004,7 +1004,7 @@
           br(LT, Z_IS_LESS_THAN_TWO24B);
           fmuld(v1, v18, v17);                               // twon24*z
           frintzd(v1, v1);                                   // v1 = (double)(int)(v1)
-          fmaddd(v2, v10, v1, v18);
+          fmsubd(v2, v10, v1, v18);
           fcvtzdw(tmp3, v1);                                 // (int)fw
           fcvtzdw(tmp2, v2);                                 // double to int
           strw(tmp2, Address(iqBase, jz, Address::lsl(2)));
--- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -634,7 +634,7 @@
   //      r11 < MacroAssembler::zero_words_block_size.
 
   address generate_zero_blocks() {
-    Label store_pair, loop_store_pair, done;
+    Label done;
     Label base_aligned;
 
     Register base = r10, cnt = r11;
@@ -1039,7 +1039,7 @@
     int direction = is_backwards ? -1 : 1;
     int unit = wordSize * direction;
 
-    Label Lpair, Lword, Lint, Lshort, Lbyte;
+    Label Lword, Lint, Lshort, Lbyte;
 
     assert(granularity
            && granularity <= sizeof (jlong), "Impossible granularity in copy_memory_small");
@@ -1096,7 +1096,7 @@
 
     // <= 96 bytes do inline. Direction doesn't matter because we always
     // load all the data before writing anything
-    Label copy4, copy8, copy16, copy32, copy80, copy128, copy_big, finish;
+    Label copy4, copy8, copy16, copy32, copy80, copy_big, finish;
     const Register t2 = r5, t3 = r6, t4 = r7, t5 = r8;
     const Register t6 = r9, t7 = r10, t8 = r11, t9 = r12;
     const Register send = r17, dend = r18;
@@ -1966,7 +1966,7 @@
                                 address int_copy_entry, address oop_copy_entry,
                                 address long_copy_entry, address checkcast_copy_entry) {
 
-    Label L_failed, L_failed_0, L_objArray;
+    Label L_failed, L_objArray;
     Label L_copy_bytes, L_copy_shorts, L_copy_ints, L_copy_longs;
 
     // Input registers
@@ -4366,7 +4366,7 @@
     Register ch1 = rscratch1, ch2 = rscratch2, first = tmp3;
 
     __ push(spilled_regs, sp);
-    Label L_LOOP, L_LOOP_PROCEED, L_SMALL, L_HAS_ZERO, L_SMALL_MATCH_LOOP,
+    Label L_LOOP, L_LOOP_PROCEED, L_SMALL, L_HAS_ZERO,
         L_HAS_ZERO_LOOP, L_CMP_LOOP, L_CMP_LOOP_NOMATCH, L_SMALL_PROCEED,
         L_SMALL_HAS_ZERO_LOOP, L_SMALL_CMP_LOOP_NOMATCH, L_SMALL_CMP_LOOP,
         L_POST_LOOP, L_CMP_LOOP_LAST_CMP, L_HAS_ZERO_LOOP_NOMATCH,
--- a/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1450,7 +1450,7 @@
   // and result handler will pick it up
 
   {
-    Label no_oop, not_weak, store_result;
+    Label no_oop;
     __ adr(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
     __ cmp(t, result_handler);
     __ br(Assembler::NE, no_oop);
--- a/src/hotspot/cpu/arm/arm.ad	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/arm/arm.ad	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -1639,7 +1639,7 @@
   %}
 
   enc_class enc_String_Equals(R0RegP str1, R1RegP str2, R2RegI cnt, iRegI result, iRegI tmp1, iRegI tmp2) %{
-    Label Lword_loop, Lpost_word, Lchar, Lchar_loop, Ldone, Lequal;
+    Label Lchar, Lchar_loop, Ldone, Lequal;
     MacroAssembler _masm(&cbuf);
 
     Register   str1_reg = $str1$$Register;
@@ -1701,7 +1701,7 @@
   %}
 
   enc_class enc_Array_Equals(R0RegP ary1, R1RegP ary2, iRegI tmp1, iRegI tmp2, iRegI tmp3, iRegI result) %{
-    Label Lvector, Ldone, Lloop, Lequal;
+    Label Ldone, Lloop, Lequal;
     MacroAssembler _masm(&cbuf);
 
     Register   ary1_reg = $ary1$$Register;
--- a/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -370,7 +370,6 @@
   }
 
   assert(oopDesc::mark_offset_in_bytes() == 0, "Required by atomic instructions");
-  Label retry;
 
   // Load displaced header and object from the lock
   ldr(hdr, Address(disp_hdr, mark_offset));
--- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -260,7 +260,7 @@
 
   add(count_temp, count_temp, 1);
 
-  Label L_loop, L_setnz_and_fail, L_fail;
+  Label L_loop, L_fail;
 
   // Top of search loop
   bind(L_loop);
--- a/src/hotspot/cpu/arm/methodHandles_arm.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -446,7 +446,6 @@
       }
 
       // given intf, index, and recv klass, dispatch to the implementation method
-      Label L_no_such_interface;
       __ lookup_interface_method(temp1_recv_klass, temp3_intf,
                                  // note: next two args must be the same:
                                  rbx_index, rbx_method,
--- a/src/hotspot/cpu/arm/sharedRuntime_arm.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -1566,7 +1566,7 @@
   const Register disp_hdr    = AARCH64_ONLY(R22) NOT_AARCH64(altFP_7_11);
   const Register tmp         = AARCH64_ONLY(R23) NOT_AARCH64(R8);
 
-  Label slow_lock, slow_lock_biased, lock_done, fast_lock, leave;
+  Label slow_lock, slow_lock_biased, lock_done, fast_lock;
   if (method->is_synchronized()) {
     // The first argument is a handle to sync object (a class or an instance)
     __ ldr(sync_obj, Address(R1));
@@ -1686,7 +1686,7 @@
   __ b(reguard, eq);
   __ bind(reguard_done);
 
-  Label slow_unlock, unlock_done, retry;
+  Label slow_unlock, unlock_done;
   if (method->is_synchronized()) {
     __ ldr(sync_obj, Address(sync_handle));
 
--- a/src/hotspot/cpu/ppc/assembler_ppc.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/assembler_ppc.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -521,6 +521,19 @@
     XXLOR_OPCODE   = (60u << OPCODE_SHIFT |  146u << 3),
     XXLXOR_OPCODE  = (60u << OPCODE_SHIFT |  154u << 3),
     XXLEQV_OPCODE  = (60u << OPCODE_SHIFT |  186u << 3),
+    XVDIVSP_OPCODE = (60u << OPCODE_SHIFT |   88u << 3),
+    XVDIVDP_OPCODE = (60u << OPCODE_SHIFT |  120u << 3),
+    XVABSSP_OPCODE = (60u << OPCODE_SHIFT |  409u << 2),
+    XVABSDP_OPCODE = (60u << OPCODE_SHIFT |  473u << 2),
+    XVNEGSP_OPCODE = (60u << OPCODE_SHIFT |  441u << 2),
+    XVNEGDP_OPCODE = (60u << OPCODE_SHIFT |  505u << 2),
+    XVSQRTSP_OPCODE= (60u << OPCODE_SHIFT |  139u << 2),
+    XVSQRTDP_OPCODE= (60u << OPCODE_SHIFT |  203u << 2),
+    XSCVDPSPN_OPCODE=(60u << OPCODE_SHIFT |  267u << 2),
+    XVADDDP_OPCODE = (60u << OPCODE_SHIFT |   96u << 3),
+    XVSUBDP_OPCODE = (60u << OPCODE_SHIFT |  104u << 3),
+    XVMULSP_OPCODE = (60u << OPCODE_SHIFT |   80u << 3),
+    XVMULDP_OPCODE = (60u << OPCODE_SHIFT |  112u << 3),
 
     // Vector Permute and Formatting
     VPKPX_OPCODE   = (4u  << OPCODE_SHIFT |  782u     ),
@@ -574,6 +587,7 @@
     VADDUBS_OPCODE = (4u  << OPCODE_SHIFT |  512u     ),
     VADDUWS_OPCODE = (4u  << OPCODE_SHIFT |  640u     ),
     VADDUHS_OPCODE = (4u  << OPCODE_SHIFT |  576u     ),
+    VADDFP_OPCODE  = (4u  << OPCODE_SHIFT |   10u     ),
     VSUBCUW_OPCODE = (4u  << OPCODE_SHIFT | 1408u     ),
     VSUBSHS_OPCODE = (4u  << OPCODE_SHIFT | 1856u     ),
     VSUBSBS_OPCODE = (4u  << OPCODE_SHIFT | 1792u     ),
@@ -581,9 +595,11 @@
     VSUBUBM_OPCODE = (4u  << OPCODE_SHIFT | 1024u     ),
     VSUBUWM_OPCODE = (4u  << OPCODE_SHIFT | 1152u     ),
     VSUBUHM_OPCODE = (4u  << OPCODE_SHIFT | 1088u     ),
+    VSUBUDM_OPCODE = (4u  << OPCODE_SHIFT | 1216u     ),
     VSUBUBS_OPCODE = (4u  << OPCODE_SHIFT | 1536u     ),
     VSUBUWS_OPCODE = (4u  << OPCODE_SHIFT | 1664u     ),
     VSUBUHS_OPCODE = (4u  << OPCODE_SHIFT | 1600u     ),
+    VSUBFP_OPCODE  = (4u  << OPCODE_SHIFT |   74u     ),
 
     VMULESB_OPCODE = (4u  << OPCODE_SHIFT |  776u     ),
     VMULEUB_OPCODE = (4u  << OPCODE_SHIFT |  520u     ),
@@ -592,7 +608,9 @@
     VMULOSB_OPCODE = (4u  << OPCODE_SHIFT |  264u     ),
     VMULOUB_OPCODE = (4u  << OPCODE_SHIFT |    8u     ),
     VMULOSH_OPCODE = (4u  << OPCODE_SHIFT |  328u     ),
+    VMULOSW_OPCODE = (4u  << OPCODE_SHIFT |  392u     ),
     VMULOUH_OPCODE = (4u  << OPCODE_SHIFT |   72u     ),
+    VMULUWM_OPCODE = (4u  << OPCODE_SHIFT |  137u     ),
     VMHADDSHS_OPCODE=(4u  << OPCODE_SHIFT |   32u     ),
     VMHRADDSHS_OPCODE=(4u << OPCODE_SHIFT |   33u     ),
     VMLADDUHM_OPCODE=(4u  << OPCODE_SHIFT |   34u     ),
@@ -602,6 +620,7 @@
     VMSUMSHS_OPCODE= (4u  << OPCODE_SHIFT |   41u     ),
     VMSUMUHM_OPCODE= (4u  << OPCODE_SHIFT |   38u     ),
     VMSUMUHS_OPCODE= (4u  << OPCODE_SHIFT |   39u     ),
+    VMADDFP_OPCODE = (4u  << OPCODE_SHIFT |   46u     ),
 
     VSUMSWS_OPCODE = (4u  << OPCODE_SHIFT | 1928u     ),
     VSUM2SWS_OPCODE= (4u  << OPCODE_SHIFT | 1672u     ),
@@ -657,6 +676,7 @@
     VSRAB_OPCODE   = (4u  << OPCODE_SHIFT |  772u     ),
     VSRAW_OPCODE   = (4u  << OPCODE_SHIFT |  900u     ),
     VSRAH_OPCODE   = (4u  << OPCODE_SHIFT |  836u     ),
+    VPOPCNTW_OPCODE= (4u  << OPCODE_SHIFT | 1923u     ),
 
     // Vector Floating-Point
     // not implemented yet
@@ -2059,6 +2079,7 @@
   inline void vaddubs(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vadduws(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vadduhs(  VectorRegister d, VectorRegister a, VectorRegister b);
+  inline void vaddfp(   VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsubcuw(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsubshs(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsubsbs(  VectorRegister d, VectorRegister a, VectorRegister b);
@@ -2066,9 +2087,11 @@
   inline void vsububm(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsubuwm(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsubuhm(  VectorRegister d, VectorRegister a, VectorRegister b);
+  inline void vsubudm(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsububs(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsubuws(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsubuhs(  VectorRegister d, VectorRegister a, VectorRegister b);
+  inline void vsubfp(   VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vmulesb(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vmuleub(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vmulesh(  VectorRegister d, VectorRegister a, VectorRegister b);
@@ -2076,7 +2099,9 @@
   inline void vmulosb(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vmuloub(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vmulosh(  VectorRegister d, VectorRegister a, VectorRegister b);
+  inline void vmulosw(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vmulouh(  VectorRegister d, VectorRegister a, VectorRegister b);
+  inline void vmuluwm(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vmhaddshs(VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
   inline void vmhraddshs(VectorRegister d,VectorRegister a, VectorRegister b, VectorRegister c);
   inline void vmladduhm(VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
@@ -2086,6 +2111,7 @@
   inline void vmsumshs( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
   inline void vmsumuhm( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
   inline void vmsumuhs( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
+  inline void vmaddfp(  VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c);
   inline void vsumsws(  VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsum2sws( VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsum4sbs( VectorRegister d, VectorRegister a, VectorRegister b);
@@ -2146,6 +2172,7 @@
   inline void vsrab(    VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsraw(    VectorRegister d, VectorRegister a, VectorRegister b);
   inline void vsrah(    VectorRegister d, VectorRegister a, VectorRegister b);
+  inline void vpopcntw( VectorRegister d, VectorRegister b);
   // Vector Floating-Point not implemented yet
   inline void mtvscr(   VectorRegister b);
   inline void mfvscr(   VectorRegister d);
@@ -2168,6 +2195,19 @@
   inline void xxlor(    VectorSRegister d, VectorSRegister a, VectorSRegister b);
   inline void xxlxor(   VectorSRegister d, VectorSRegister a, VectorSRegister b);
   inline void xxleqv(   VectorSRegister d, VectorSRegister a, VectorSRegister b);
+  inline void xvdivsp(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
+  inline void xvdivdp(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
+  inline void xvabssp(  VectorSRegister d, VectorSRegister b);
+  inline void xvabsdp(  VectorSRegister d, VectorSRegister b);
+  inline void xvnegsp(  VectorSRegister d, VectorSRegister b);
+  inline void xvnegdp(  VectorSRegister d, VectorSRegister b);
+  inline void xvsqrtsp( VectorSRegister d, VectorSRegister b);
+  inline void xvsqrtdp( VectorSRegister d, VectorSRegister b);
+  inline void xscvdpspn(VectorSRegister d, VectorSRegister b);
+  inline void xvadddp(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
+  inline void xvsubdp(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
+  inline void xvmulsp(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
+  inline void xvmuldp(  VectorSRegister d, VectorSRegister a, VectorSRegister b);
 
   // VSX Extended Mnemonics
   inline void xxspltd(  VectorSRegister d, VectorSRegister a, int x);
--- a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -769,7 +769,20 @@
 inline void Assembler::xxlor(   VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLOR_OPCODE  | vsrt(d) | vsra(a) | vsrb(b)); }
 inline void Assembler::xxlxor(  VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLXOR_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
 inline void Assembler::xxleqv(  VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLEQV_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
-inline void Assembler::mtvrd(    VectorRegister d, Register a)               { emit_int32( MTVSRD_OPCODE  | vsrt(d->to_vsr()) | ra(a)); }
+inline void Assembler::xvdivsp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVSP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
+inline void Assembler::xvdivdp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
+inline void Assembler::xvabssp( VectorSRegister d, VectorSRegister b)                    { emit_int32( XVABSSP_OPCODE | vsrt(d) | vsrb(b)); }
+inline void Assembler::xvabsdp( VectorSRegister d, VectorSRegister b)                    { emit_int32( XVABSDP_OPCODE | vsrt(d) | vsrb(b)); }
+inline void Assembler::xvnegsp( VectorSRegister d, VectorSRegister b)                    { emit_int32( XVNEGSP_OPCODE | vsrt(d) | vsrb(b)); }
+inline void Assembler::xvnegdp( VectorSRegister d, VectorSRegister b)                    { emit_int32( XVNEGDP_OPCODE | vsrt(d) | vsrb(b)); }
+inline void Assembler::xvsqrtsp(VectorSRegister d, VectorSRegister b)                    { emit_int32( XVSQRTSP_OPCODE| vsrt(d) | vsrb(b)); }
+inline void Assembler::xvsqrtdp(VectorSRegister d, VectorSRegister b)                    { emit_int32( XVSQRTDP_OPCODE| vsrt(d) | vsrb(b)); }
+inline void Assembler::xscvdpspn(VectorSRegister d, VectorSRegister b)                   { emit_int32( XSCVDPSPN_OPCODE | vsrt(d) | vsrb(b)); }
+inline void Assembler::xvadddp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVADDDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
+inline void Assembler::xvsubdp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVSUBDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
+inline void Assembler::xvmulsp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMULSP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
+inline void Assembler::xvmuldp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVMULDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); }
+inline void Assembler::mtvrd(   VectorRegister d, Register a)               { emit_int32( MTVSRD_OPCODE  | vsrt(d->to_vsr()) | ra(a)); }
 inline void Assembler::mfvrd(   Register        a, VectorRegister d)         { emit_int32( MFVSRD_OPCODE  | vsrt(d->to_vsr()) | ra(a)); }
 inline void Assembler::mtvrwz(  VectorRegister  d, Register a)               { emit_int32( MTVSRWZ_OPCODE | vsrt(d->to_vsr()) | ra(a)); }
 inline void Assembler::mfvrwz(  Register        a, VectorRegister d)         { emit_int32( MFVSRWZ_OPCODE | vsrt(d->to_vsr()) | ra(a)); }
@@ -833,6 +846,7 @@
 inline void Assembler::vaddubs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUBS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vadduws( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUWS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vadduhs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDUHS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
+inline void Assembler::vaddfp(  VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VADDFP_OPCODE  | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsubcuw( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBCUW_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsubshs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBSHS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsubsbs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBSBS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
@@ -840,9 +854,11 @@
 inline void Assembler::vsububm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBUBM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsubuwm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBUWM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsubuhm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBUHM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
+inline void Assembler::vsubudm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBUDM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsububs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBUBS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsubuws( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBUWS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsubuhs( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBUHS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
+inline void Assembler::vsubfp(  VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUBFP_OPCODE  | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vmulesb( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULESB_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vmuleub( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULEUB_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vmulesh( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULESH_OPCODE | vrt(d) | vra(a) | vrb(b)); }
@@ -850,7 +866,9 @@
 inline void Assembler::vmulosb( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULOSB_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vmuloub( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULOUB_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vmulosh( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULOSH_OPCODE | vrt(d) | vra(a) | vrb(b)); }
+inline void Assembler::vmulosw( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULOSW_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vmulouh( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULOUH_OPCODE | vrt(d) | vra(a) | vrb(b)); }
+inline void Assembler::vmuluwm( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VMULUWM_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vmhaddshs(VectorRegister d,VectorRegister a, VectorRegister b, VectorRegister c) { emit_int32( VMHADDSHS_OPCODE | vrt(d) | vra(a) | vrb(b)| vrc(c)); }
 inline void Assembler::vmhraddshs(VectorRegister d,VectorRegister a,VectorRegister b, VectorRegister c) { emit_int32( VMHRADDSHS_OPCODE| vrt(d) | vra(a) | vrb(b)| vrc(c)); }
 inline void Assembler::vmladduhm(VectorRegister d,VectorRegister a, VectorRegister b, VectorRegister c) { emit_int32( VMLADDUHM_OPCODE | vrt(d) | vra(a) | vrb(b)| vrc(c)); }
@@ -860,6 +878,7 @@
 inline void Assembler::vmsumshs(VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c) { emit_int32( VMSUMSHS_OPCODE  | vrt(d) | vra(a) | vrb(b)| vrc(c)); }
 inline void Assembler::vmsumuhm(VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c) { emit_int32( VMSUMUHM_OPCODE  | vrt(d) | vra(a) | vrb(b)| vrc(c)); }
 inline void Assembler::vmsumuhs(VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c) { emit_int32( VMSUMUHS_OPCODE  | vrt(d) | vra(a) | vrb(b)| vrc(c)); }
+inline void Assembler::vmaddfp( VectorRegister d, VectorRegister a, VectorRegister b, VectorRegister c) { emit_int32( VMADDFP_OPCODE   | vrt(d) | vra(a) | vrb(b)| vrc(c)); }
 inline void Assembler::vsumsws( VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUMSWS_OPCODE  | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsum2sws(VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUM2SWS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsum4sbs(VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSUM4SBS_OPCODE | vrt(d) | vra(a) | vrb(b)); }
@@ -921,6 +940,7 @@
 inline void Assembler::vsrab(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSRAB_OPCODE    | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsraw(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSRAW_OPCODE    | vrt(d) | vra(a) | vrb(b)); }
 inline void Assembler::vsrah(   VectorRegister d, VectorRegister a, VectorRegister b) { emit_int32( VSRAH_OPCODE    | vrt(d) | vra(a) | vrb(b)); }
+inline void Assembler::vpopcntw(VectorRegister d, VectorRegister b)                   { emit_int32( VPOPCNTW_OPCODE | vrt(d) | vrb(b)); }
 inline void Assembler::mtvscr(  VectorRegister b)                                     { emit_int32( MTVSCR_OPCODE   | vrb(b)); }
 inline void Assembler::mfvscr(  VectorRegister d)                                     { emit_int32( MFVSCR_OPCODE   | vrt(d)); }
 
--- a/src/hotspot/cpu/ppc/ppc.ad	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/ppc.ad	Tue Sep 18 16:41:24 2018 -0700
@@ -908,6 +908,7 @@
 // ----------------------------
 
 reg_class vs_reg(
+  // Attention: Only these ones are saved & restored at safepoint by RegisterSaver.
   VSR32,
   VSR33,
   VSR34,
@@ -928,18 +929,7 @@
   VSR49,
   VSR50,
   VSR51
-//  VSR52,     // nv!
-//  VSR53,     // nv!
-//  VSR54,     // nv!
-//  VSR55,     // nv!
-//  VSR56,     // nv!
-//  VSR57,     // nv!
-//  VSR58,     // nv!
-//  VSR59,     // nv!
-//  VSR60,     // nv!
-//  VSR61,     // nv!
-//  VSR62,     // nv!
-//  VSR63      // nv!
+  // VSR52-VSR63 // nv!
 );
 
  %}
@@ -2234,9 +2224,35 @@
   case Op_StrEquals:
     return SpecialStringEquals;
   case Op_StrIndexOf:
-    return SpecialStringIndexOf;
   case Op_StrIndexOfChar:
     return SpecialStringIndexOf;
+  case Op_AddVB:
+  case Op_AddVS:
+  case Op_AddVI:
+  case Op_AddVF:
+  case Op_AddVD:
+  case Op_SubVB:
+  case Op_SubVS:
+  case Op_SubVI:
+  case Op_SubVF:
+  case Op_SubVD:
+  case Op_MulVS:
+  case Op_MulVF:
+  case Op_MulVD:
+  case Op_DivVF:
+  case Op_DivVD:
+  case Op_AbsVF:
+  case Op_AbsVD:
+  case Op_NegVF:
+  case Op_NegVD:
+  case Op_SqrtVF:
+  case Op_SqrtVD:
+  case Op_AddVL:
+  case Op_SubVL:
+  case Op_MulVI:
+    return SuperwordUseVSX;
+  case Op_PopCountVI:
+    return (SuperwordUseVSX && UsePopCountInstruction);
   }
 
   return true;  // Per default match rules are supported.
@@ -10017,7 +10033,7 @@
 
 // Single-precision sqrt.
 instruct sqrtF_reg(regF dst, regF src) %{
-  match(Set dst (ConvD2F (SqrtD (ConvF2D src))));
+  match(Set dst (SqrtF src));
   predicate(VM_Version::has_fsqrts());
   ins_cost(DEFAULT_COST);
 
@@ -13666,6 +13682,7 @@
 instruct mtvsrwz(vecX temp1, iRegIsrc src) %{
   effect(DEF temp1, USE src);
 
+  format %{ "MTVSRWZ $temp1, $src \t// Move to 16-byte register" %}
   size(4);
   ins_encode %{
     __ mtvsrwz($temp1$$VectorSRegister, $src$$Register);
@@ -13676,6 +13693,7 @@
 instruct xxspltw(vecX dst, vecX src, immI8 imm1) %{
   effect(DEF dst, USE src, USE imm1);
 
+  format %{ "XXSPLTW $dst, $src, $imm1 \t// Splat word" %}
   size(4);
   ins_encode %{
     __ xxspltw($dst$$VectorSRegister, $src$$VectorSRegister, $imm1$$constant);
@@ -13683,6 +13701,17 @@
   ins_pipe(pipe_class_default);
 %}
 
+instruct xscvdpspn_regF(vecX dst, regF src) %{
+  effect(DEF dst, USE src);
+
+  format %{ "XSCVDPSPN $dst, $src \t// Convert scalar single precision to vector single precision" %}
+  size(4);
+  ins_encode %{
+    __ xscvdpspn($dst$$VectorSRegister, $src$$FloatRegister->to_vsr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
 //---------- Replicate Vector Instructions ------------------------------------
 
 // Insrdi does replicate if src == dst.
@@ -13989,6 +14018,303 @@
 %}
 
 
+//----------Vector Arithmetic Instructions--------------------------------------
+
+// Vector Addition Instructions
+
+instruct vadd16B_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (AddVB src1 src2));
+  predicate(n->as_Vector()->length() == 16);
+  format %{ "VADDUBM  $dst,$src1,$src2\t// add packed16B" %}
+  size(4);
+  ins_encode %{
+    __ vaddubm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vadd8S_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (AddVS src1 src2));
+  predicate(n->as_Vector()->length() == 8);
+  format %{ "VADDUHM  $dst,$src1,$src2\t// add packed8S" %}
+  size(4);
+  ins_encode %{
+    __ vadduhm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vadd4I_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (AddVI src1 src2));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "VADDUWM  $dst,$src1,$src2\t// add packed4I" %}
+  size(4);
+  ins_encode %{
+    __ vadduwm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vadd4F_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (AddVF src1 src2));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "VADDFP  $dst,$src1,$src2\t// add packed4F" %}
+  size(4);
+  ins_encode %{
+    __ vaddfp($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vadd2L_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (AddVL src1 src2));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "VADDUDM  $dst,$src1,$src2\t// add packed2L" %}
+  size(4);
+  ins_encode %{
+    __ vaddudm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vadd2D_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (AddVD src1 src2));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "XVADDDP  $dst,$src1,$src2\t// add packed2D" %}
+  size(4);
+  ins_encode %{
+    __ xvadddp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Vector Subtraction Instructions
+
+instruct vsub16B_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (SubVB src1 src2));
+  predicate(n->as_Vector()->length() == 16);
+  format %{ "VSUBUBM  $dst,$src1,$src2\t// sub packed16B" %}
+  size(4);
+  ins_encode %{
+    __ vsububm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vsub8S_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (SubVS src1 src2));
+  predicate(n->as_Vector()->length() == 8);
+  format %{ "VSUBUHM  $dst,$src1,$src2\t// sub packed8S" %}
+  size(4);
+  ins_encode %{
+    __ vsubuhm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vsub4I_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (SubVI src1 src2));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "VSUBUWM  $dst,$src1,$src2\t// sub packed4I" %}
+  size(4);
+  ins_encode %{
+    __ vsubuwm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vsub4F_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (SubVF src1 src2));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "VSUBFP  $dst,$src1,$src2\t// sub packed4F" %}
+  size(4);
+  ins_encode %{
+    __ vsubfp($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vsub2L_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (SubVL src1 src2));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "VSUBUDM  $dst,$src1,$src2\t// sub packed2L" %}
+  size(4);
+  ins_encode %{
+    __ vsubudm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vsub2D_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (SubVD src1 src2));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "XVSUBDP  $dst,$src1,$src2\t// sub packed2D" %}
+  size(4);
+  ins_encode %{
+    __ xvsubdp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Vector Multiplication Instructions
+
+instruct vmul8S_reg(vecX dst, vecX src1, vecX src2, vecX tmp) %{
+  match(Set dst (MulVS src1 src2));
+  predicate(n->as_Vector()->length() == 8);
+  effect(TEMP tmp);
+  format %{ "VSPLTISH  $tmp,0\t// mul packed8S" %}
+  format %{ "VMLADDUHM  $dst,$src1,$src2\t// mul packed8S" %}
+  size(8);
+  ins_encode %{
+    __ vspltish($tmp$$VectorSRegister->to_vr(), 0);
+    __ vmladduhm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr(), $tmp$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vmul4I_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (MulVI src1 src2));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "VMULUWM  $dst,$src1,$src2\t// mul packed4I" %}
+  size(4);
+  ins_encode %{
+    __ vmuluwm($dst$$VectorSRegister->to_vr(), $src1$$VectorSRegister->to_vr(), $src2$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vmul4F_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (MulVF src1 src2));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "XVMULSP  $dst,$src1,$src2\t// mul packed4F" %}
+  size(4);
+  ins_encode %{
+    __ xvmulsp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vmul2D_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (MulVD src1 src2));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "XVMULDP  $dst,$src1,$src2\t// mul packed2D" %}
+  size(4);
+  ins_encode %{
+    __ xvmuldp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Vector Division Instructions
+
+instruct vdiv4F_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (DivVF src1 src2));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "XVDIVSP  $dst,$src1,$src2\t// div packed4F" %}
+  size(4);
+  ins_encode %{
+    __ xvdivsp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vdiv2D_reg(vecX dst, vecX src1, vecX src2) %{
+  match(Set dst (DivVD src1 src2));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "XVDIVDP  $dst,$src1,$src2\t// div packed2D" %}
+  size(4);
+  ins_encode %{
+    __ xvdivdp($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Vector Absolute Instructions
+
+instruct vabs4F_reg(vecX dst, vecX src) %{
+  match(Set dst (AbsVF src));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "XVABSSP $dst,$src\t// absolute packed4F" %}
+  size(4);
+  ins_encode %{
+    __ xvabssp($dst$$VectorSRegister, $src$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vabs2D_reg(vecX dst, vecX src) %{
+  match(Set dst (AbsVD src));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "XVABSDP $dst,$src\t// absolute packed2D" %}
+  size(4);
+  ins_encode %{
+    __ xvabsdp($dst$$VectorSRegister, $src$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Vector Negate Instructions
+
+instruct vneg4F_reg(vecX dst, vecX src) %{
+  match(Set dst (NegVF src));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "XVNEGSP $dst,$src\t// negate packed4F" %}
+  size(4);
+  ins_encode %{
+    __ xvnegsp($dst$$VectorSRegister, $src$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vneg2D_reg(vecX dst, vecX src) %{
+  match(Set dst (NegVD src));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "XVNEGDP $dst,$src\t// negate packed2D" %}
+  size(4);
+  ins_encode %{
+    __ xvnegdp($dst$$VectorSRegister, $src$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Vector Square Root Instructions
+
+instruct vsqrt4F_reg(vecX dst, vecX src) %{
+  match(Set dst (SqrtVF src));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "XVSQRTSP $dst,$src\t// sqrt packed4F" %}
+  size(4);
+  ins_encode %{
+    __ xvsqrtsp($dst$$VectorSRegister, $src$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+instruct vsqrt2D_reg(vecX dst, vecX src) %{
+  match(Set dst (SqrtVD src));
+  predicate(n->as_Vector()->length() == 2);
+  format %{ "XVSQRTDP  $dst,$src\t// sqrt packed2D" %}
+  size(4);
+  ins_encode %{
+    __ xvsqrtdp($dst$$VectorSRegister, $src$$VectorSRegister);
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+// Vector Population Count Instructions
+
+instruct vpopcnt4I_reg(vecX dst, vecX src) %{
+  match(Set dst (PopCountVI src));
+  predicate(n->as_Vector()->length() == 4);
+  format %{ "VPOPCNTW $dst,$src\t// pop count packed4I" %}
+  size(4);
+  ins_encode %{
+    __ vpopcntw($dst$$VectorSRegister->to_vr(), $src$$VectorSRegister->to_vr());
+  %}
+  ins_pipe(pipe_class_default);
+%}
+
+
 //----------Overflow Math Instructions-----------------------------------------
 
 // Note that we have to make sure that XER.SO is reset before using overflow instructions.
@@ -14047,24 +14373,16 @@
   ins_pipe(pipe_class_default);
 %}
 
-
 instruct repl4F_reg_Ex(vecX dst, regF src) %{
   match(Set dst (ReplicateF src));
   predicate(n->as_Vector()->length() == 4);
-  ins_cost(2 * MEMORY_REF_COST + DEFAULT_COST);
-  expand %{
-    stackSlotL tmpS;
-    iRegIdst tmpI;
-    iRegLdst tmpL;
+  ins_cost(DEFAULT_COST);
+  expand %{
     vecX tmpV;
     immI8  zero %{ (int)  0 %}
 
-    moveF2I_reg_stack(tmpS, src);   // Move float to stack.
-    moveF2I_stack_reg(tmpI, tmpS);  // Move stack to int reg.
-    moveReg(tmpL, tmpI);             // Move int to long reg.
-    repl32(tmpL);                    // Replicate bitpattern.
-    mtvsrd(tmpV, tmpL);
-    xxpermdi(dst, tmpV, tmpV, zero);
+    xscvdpspn_regF(tmpV, src);
+    xxspltw(dst, tmpV, zero);
   %}
 %}
 
@@ -14091,17 +14409,13 @@
 instruct repl2D_reg_Ex(vecX dst, regD src) %{
   match(Set dst (ReplicateD src));
   predicate(n->as_Vector()->length() == 2);
-  expand %{
-    stackSlotL tmpS;
-    iRegLdst tmpL;
-    iRegLdst tmp;
-    vecX tmpV;
-    immI8  zero %{ (int)  0 %}
-    moveD2L_reg_stack(tmpS, src);
-    moveD2L_stack_reg(tmpL, tmpS);
-    mtvsrd(tmpV, tmpL);
-    xxpermdi(dst, tmpV, tmpV, zero);
-  %}
+
+  format %{ "XXPERMDI      $dst, $src, $src, 0 \t// Splat doubleword" %}
+  size(4);
+  ins_encode %{
+    __ xxpermdi($dst$$VectorSRegister, $src$$FloatRegister->to_vsr(), $src$$FloatRegister->to_vsr(), 0);
+  %}
+  ins_pipe(pipe_class_default);
 %}
 
 instruct repl2D_immI0(vecX dst, immI_0 zero) %{
@@ -14132,7 +14446,7 @@
   predicate(false);
   effect(DEF dst, USE src);
 
-  format %{ "MTVSRD      $dst, $src \t// Move to 16-byte register"%}
+  format %{ "MTVSRD      $dst, $src \t// Move to 16-byte register" %}
   size(4);
   ins_encode %{
     __ mtvsrd($dst$$VectorSRegister, $src$$Register);
@@ -14143,7 +14457,7 @@
 instruct xxspltd(vecX dst, vecX src, immI8 zero) %{
   effect(DEF dst, USE src, USE zero);
 
-  format %{ "XXSPLATD      $dst, $src, $zero \t// Permute 16-byte register"%}
+  format %{ "XXSPLATD      $dst, $src, $zero \t// Splat doubleword" %}
   size(4);
   ins_encode %{
     __ xxpermdi($dst$$VectorSRegister, $src$$VectorSRegister, $src$$VectorSRegister, $zero$$constant);
@@ -14154,7 +14468,7 @@
 instruct xxpermdi(vecX dst, vecX src1, vecX src2, immI8 zero) %{
   effect(DEF dst, USE src1, USE src2, USE zero);
 
-  format %{ "XXPERMDI      $dst, $src1, $src2, $zero \t// Permute 16-byte register"%}
+  format %{ "XXPERMDI      $dst, $src1, $src2, $zero \t// Splat doubleword" %}
   size(4);
   ins_encode %{
     __ xxpermdi($dst$$VectorSRegister, $src1$$VectorSRegister, $src2$$VectorSRegister, $zero$$constant);
--- a/src/hotspot/cpu/ppc/register_definitions_ppc.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/register_definitions_ppc.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,4 +32,6 @@
 
 REGISTER_DEFINITION(FloatRegister, fnoreg);
 
+REGISTER_DEFINITION(VectorRegister, vnoreg);
+
 REGISTER_DEFINITION(VectorSRegister, vsnoreg);
--- a/src/hotspot/cpu/ppc/register_ppc.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/register_ppc.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -26,11 +26,6 @@
 #include "precompiled.hpp"
 #include "register_ppc.hpp"
 
-const int ConcreteRegisterImpl::max_gpr = RegisterImpl::number_of_registers * 2;
-const int ConcreteRegisterImpl::max_fpr = ConcreteRegisterImpl::max_gpr +
-                                          FloatRegisterImpl::number_of_registers * 2;
-const int ConcreteRegisterImpl::max_cnd = ConcreteRegisterImpl::max_fpr +
-                                          ConditionRegisterImpl::number_of_registers;
 
 const char* RegisterImpl::name() const {
   const char* names[number_of_registers] = {
@@ -90,8 +85,20 @@
   return is_valid() ? names[encoding()] : "vsnoreg";
 }
 
+// Method to convert a FloatRegister to a Vector-Scalar Register (VectorSRegister)
+VectorSRegister FloatRegisterImpl::to_vsr() const {
+  if (this == fnoreg) { return vsnoreg; }
+  return as_VectorSRegister(encoding());
+}
+
 // Method to convert a VectorRegister to a Vector-Scalar Register (VectorSRegister)
 VectorSRegister VectorRegisterImpl::to_vsr() const {
-  if (this == vnoreg) { return vsnoregi; }
+  if (this == vnoreg) { return vsnoreg; }
   return as_VectorSRegister(encoding() + 32);
 }
+
+// Method to convert a VectorSRegister to a Vector Register (VectorRegister)
+VectorRegister VectorSRegisterImpl::to_vr() const {
+  if (this == vsnoreg) { return vnoreg; }
+  return as_VectorRegister(encoding() - 32);
+}
--- a/src/hotspot/cpu/ppc/register_ppc.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/register_ppc.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2017 SAP SE. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -241,6 +241,10 @@
 
 #endif // DONT_USE_REGISTER_DEFINES
 
+// Forward declaration
+// Use VectorSRegister as a shortcut.
+class VectorSRegisterImpl;
+typedef VectorSRegisterImpl* VectorSRegister;
 
 // Use FloatRegister as shortcut
 class FloatRegisterImpl;
@@ -270,6 +274,9 @@
   bool is_valid() const { return (0 <= value() && value() < number_of_registers); }
 
   const char* name() const;
+
+  // convert to VSR
+  VectorSRegister to_vsr() const;
 };
 
 // The float registers of the PPC architecture
@@ -398,11 +405,6 @@
   return (VectorRegister)(intptr_t)encoding;
 }
 
-// Forward declaration
-// Use VectorSRegister as a shortcut.
-class VectorSRegisterImpl;
-typedef VectorSRegisterImpl* VectorSRegister;
-
 // The implementation of vector registers for the Power architecture
 class VectorRegisterImpl: public AbstractRegisterImpl {
  public:
@@ -515,11 +517,15 @@
 
   // accessors
   int encoding() const { assert(is_valid(), "invalid register"); return value(); }
+  inline VMReg as_VMReg();
 
   // testers
   bool is_valid() const { return 0 <=  value() &&  value() < number_of_registers; }
 
   const char* name() const;
+
+  // convert to VR
+  VectorRegister to_vr() const;
 };
 
 // The Vector-Scalar (VSX) registers of the POWER architecture.
@@ -592,7 +598,7 @@
 CONSTANT_REGISTER_DECLARATION(VectorSRegister, VSR63, (63));
 
 #ifndef DONT_USE_REGISTER_DEFINES
-#define vsnoregi ((VectorSRegister)(vsnoreg_VectorSRegisterEnumValue))
+#define vsnoreg ((VectorSRegister)(vsnoreg_VectorSRegisterEnumValue))
 #define VSR0    ((VectorSRegister)(   VSR0_VectorSRegisterEnumValue))
 #define VSR1    ((VectorSRegister)(   VSR1_VectorSRegisterEnumValue))
 #define VSR2    ((VectorSRegister)(   VSR2_VectorSRegisterEnumValue))
@@ -668,21 +674,16 @@
 class ConcreteRegisterImpl : public AbstractRegisterImpl {
  public:
   enum {
+    max_gpr = RegisterImpl::number_of_registers * 2,
+    max_fpr = max_gpr + FloatRegisterImpl::number_of_registers * 2,
+    max_vsr = max_fpr + VectorSRegisterImpl::number_of_registers,
+    max_cnd = max_vsr + ConditionRegisterImpl::number_of_registers,
+    max_spr = max_cnd + SpecialRegisterImpl::number_of_registers,
     // This number must be large enough to cover REG_COUNT (defined by c2) registers.
     // There is no requirement that any ordering here matches any ordering c2 gives
     // it's optoregs.
-    number_of_registers =
-      ( RegisterImpl::number_of_registers +
-        FloatRegisterImpl::number_of_registers )
-      * 2                                          // register halves
-      + ConditionRegisterImpl::number_of_registers // condition code registers
-      + SpecialRegisterImpl::number_of_registers   // special registers
-      + VectorSRegisterImpl::number_of_registers   // VSX registers
+    number_of_registers = max_spr
   };
-
-  static const int max_gpr;
-  static const int max_fpr;
-  static const int max_cnd;
 };
 
 // Common register declarations used in assembler code.
--- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -75,10 +75,12 @@
                          int* out_frame_size_in_bytes,
                          bool generate_oop_map,
                          int return_pc_adjustment,
-                         ReturnPCLocation return_pc_location);
+                         ReturnPCLocation return_pc_location,
+                         bool save_vectors = false);
   static void    restore_live_registers_and_pop_frame(MacroAssembler* masm,
                          int frame_size_in_bytes,
-                         bool restore_ctr);
+                         bool restore_ctr,
+                         bool save_vectors = false);
 
   static void push_frame_and_save_argument_registers(MacroAssembler* masm,
                          Register r_temp,
@@ -97,14 +99,16 @@
   // Constants and data structures:
 
   typedef enum {
-    int_reg           = 0,
-    float_reg         = 1,
-    special_reg       = 2
+    int_reg,
+    float_reg,
+    special_reg,
+    vs_reg
   } RegisterType;
 
   typedef enum {
     reg_size          = 8,
     half_reg_size     = reg_size / 2,
+    vs_reg_size       = 16
   } RegisterConstants;
 
   typedef struct {
@@ -115,15 +119,18 @@
 };
 
 
-#define RegisterSaver_LiveSpecialReg(regname) \
-  { RegisterSaver::special_reg, regname->encoding(), regname->as_VMReg() }
-
 #define RegisterSaver_LiveIntReg(regname) \
   { RegisterSaver::int_reg,     regname->encoding(), regname->as_VMReg() }
 
 #define RegisterSaver_LiveFloatReg(regname) \
   { RegisterSaver::float_reg,   regname->encoding(), regname->as_VMReg() }
 
+#define RegisterSaver_LiveSpecialReg(regname) \
+  { RegisterSaver::special_reg, regname->encoding(), regname->as_VMReg() }
+
+#define RegisterSaver_LiveVSReg(regname) \
+  { RegisterSaver::vs_reg,      regname->encoding(), regname->as_VMReg() }
+
 static const RegisterSaver::LiveRegType RegisterSaver_LiveRegs[] = {
   // Live registers which get spilled to the stack. Register
   // positions in this array correspond directly to the stack layout.
@@ -201,14 +208,42 @@
   RegisterSaver_LiveIntReg(   R28 ),
   RegisterSaver_LiveIntReg(   R29 ),
   RegisterSaver_LiveIntReg(   R30 ),
-  RegisterSaver_LiveIntReg(   R31 ), // must be the last register (see save/restore functions below)
+  RegisterSaver_LiveIntReg(   R31 )  // must be the last register (see save/restore functions below)
 };
 
+static const RegisterSaver::LiveRegType RegisterSaver_LiveVSRegs[] = {
+  //
+  // live vector scalar registers (optional, only these ones are used by C2):
+  //
+  RegisterSaver_LiveVSReg( VSR32 ),
+  RegisterSaver_LiveVSReg( VSR33 ),
+  RegisterSaver_LiveVSReg( VSR34 ),
+  RegisterSaver_LiveVSReg( VSR35 ),
+  RegisterSaver_LiveVSReg( VSR36 ),
+  RegisterSaver_LiveVSReg( VSR37 ),
+  RegisterSaver_LiveVSReg( VSR38 ),
+  RegisterSaver_LiveVSReg( VSR39 ),
+  RegisterSaver_LiveVSReg( VSR40 ),
+  RegisterSaver_LiveVSReg( VSR41 ),
+  RegisterSaver_LiveVSReg( VSR42 ),
+  RegisterSaver_LiveVSReg( VSR43 ),
+  RegisterSaver_LiveVSReg( VSR44 ),
+  RegisterSaver_LiveVSReg( VSR45 ),
+  RegisterSaver_LiveVSReg( VSR46 ),
+  RegisterSaver_LiveVSReg( VSR47 ),
+  RegisterSaver_LiveVSReg( VSR48 ),
+  RegisterSaver_LiveVSReg( VSR49 ),
+  RegisterSaver_LiveVSReg( VSR50 ),
+  RegisterSaver_LiveVSReg( VSR51 )
+};
+
+
 OopMap* RegisterSaver::push_frame_reg_args_and_save_live_registers(MacroAssembler* masm,
                          int* out_frame_size_in_bytes,
                          bool generate_oop_map,
                          int return_pc_adjustment,
-                         ReturnPCLocation return_pc_location) {
+                         ReturnPCLocation return_pc_location,
+                         bool save_vectors) {
   // Push an abi_reg_args-frame and store all registers which may be live.
   // If requested, create an OopMap: Record volatile registers as
   // callee-save values in an OopMap so their save locations will be
@@ -218,15 +253,16 @@
   // If return_pc_adjustment != 0 adjust the return pc by return_pc_adjustment.
   // Updated return pc is returned in R31 (if not return_pc_is_pre_saved).
 
-  int i;
-  int offset;
-
   // calcualte frame size
   const int regstosave_num       = sizeof(RegisterSaver_LiveRegs) /
                                    sizeof(RegisterSaver::LiveRegType);
-  const int register_save_size   = regstosave_num * reg_size;
+  const int vsregstosave_num     = save_vectors ? (sizeof(RegisterSaver_LiveVSRegs) /
+                                                   sizeof(RegisterSaver::LiveRegType))
+                                                : 0;
+  const int register_save_size   = regstosave_num * reg_size + vsregstosave_num * vs_reg_size;
   const int frame_size_in_bytes  = align_up(register_save_size, frame::alignment_in_bytes)
                                    + frame::abi_reg_args_size;
+
   *out_frame_size_in_bytes       = frame_size_in_bytes;
   const int frame_size_in_slots  = frame_size_in_bytes / sizeof(jint);
   const int register_save_offset = frame_size_in_bytes - register_save_size;
@@ -236,17 +272,18 @@
 
   BLOCK_COMMENT("push_frame_reg_args_and_save_live_registers {");
 
-  // Save some registers in the last slots of the not yet pushed frame so that we
-  // can use them as scratch regs.
-  __ std(R31, -  reg_size, R1_SP);
-  __ std(R30, -2*reg_size, R1_SP);
-  assert(-reg_size == register_save_offset - frame_size_in_bytes + ((regstosave_num-1)*reg_size),
-         "consistency check");
+  // push a new frame
+  __ push_frame(frame_size_in_bytes, noreg);
+
+  // Save some registers in the last (non-vector) slots of the new frame so we
+  // can use them as scratch regs or to determine the return pc.
+  __ std(R31, frame_size_in_bytes -   reg_size - vsregstosave_num * vs_reg_size, R1_SP);
+  __ std(R30, frame_size_in_bytes - 2*reg_size - vsregstosave_num * vs_reg_size, R1_SP);
 
   // save the flags
   // Do the save_LR_CR by hand and adjust the return pc if requested.
   __ mfcr(R30);
-  __ std(R30, _abi(cr), R1_SP);
+  __ std(R30, frame_size_in_bytes + _abi(cr), R1_SP);
   switch (return_pc_location) {
     case return_pc_is_lr: __ mflr(R31); break;
     case return_pc_is_pre_saved: assert(return_pc_adjustment == 0, "unsupported"); break;
@@ -257,14 +294,12 @@
     if (return_pc_adjustment != 0) {
       __ addi(R31, R31, return_pc_adjustment);
     }
-    __ std(R31, _abi(lr), R1_SP);
+    __ std(R31, frame_size_in_bytes + _abi(lr), R1_SP);
   }
 
-  // push a new frame
-  __ push_frame(frame_size_in_bytes, R30);
-
   // save all registers (ints and floats)
-  offset = register_save_offset;
+  int offset = register_save_offset;
+
   for (int i = 0; i < regstosave_num; i++) {
     int reg_num  = RegisterSaver_LiveRegs[i].reg_num;
     int reg_type = RegisterSaver_LiveRegs[i].reg_type;
@@ -302,6 +337,22 @@
     offset += reg_size;
   }
 
+  for (int i = 0; i < vsregstosave_num; i++) {
+    int reg_num  = RegisterSaver_LiveVSRegs[i].reg_num;
+    int reg_type = RegisterSaver_LiveVSRegs[i].reg_type;
+
+    __ li(R30, offset);
+    __ stxvd2x(as_VectorSRegister(reg_num), R30, R1_SP);
+
+    if (generate_oop_map) {
+      map->set_callee_saved(VMRegImpl::stack2reg(offset>>2),
+                            RegisterSaver_LiveVSRegs[i].vmreg);
+    }
+    offset += vs_reg_size;
+  }
+
+  assert(offset == frame_size_in_bytes, "consistency check");
+
   BLOCK_COMMENT("} push_frame_reg_args_and_save_live_registers");
 
   // And we're done.
@@ -313,18 +364,22 @@
 // saved.
 void RegisterSaver::restore_live_registers_and_pop_frame(MacroAssembler* masm,
                                                          int frame_size_in_bytes,
-                                                         bool restore_ctr) {
-  int i;
-  int offset;
+                                                         bool restore_ctr,
+                                                         bool save_vectors) {
   const int regstosave_num       = sizeof(RegisterSaver_LiveRegs) /
                                    sizeof(RegisterSaver::LiveRegType);
-  const int register_save_size   = regstosave_num * reg_size;
+  const int vsregstosave_num     = save_vectors ? (sizeof(RegisterSaver_LiveVSRegs) /
+                                                   sizeof(RegisterSaver::LiveRegType))
+                                                : 0;
+  const int register_save_size   = regstosave_num * reg_size + vsregstosave_num * vs_reg_size;
+
   const int register_save_offset = frame_size_in_bytes - register_save_size;
 
   BLOCK_COMMENT("restore_live_registers_and_pop_frame {");
 
   // restore all registers (ints and floats)
-  offset = register_save_offset;
+  int offset = register_save_offset;
+
   for (int i = 0; i < regstosave_num; i++) {
     int reg_num  = RegisterSaver_LiveRegs[i].reg_num;
     int reg_type = RegisterSaver_LiveRegs[i].reg_type;
@@ -356,14 +411,30 @@
     offset += reg_size;
   }
 
-  // pop the frame
-  __ pop_frame();
-
-  // restore the flags
-  __ restore_LR_CR(R31);
+  for (int i = 0; i < vsregstosave_num; i++) {
+    int reg_num  = RegisterSaver_LiveVSRegs[i].reg_num;
+    int reg_type = RegisterSaver_LiveVSRegs[i].reg_type;
+
+    __ li(R31, offset);
+    __ lxvd2x(as_VectorSRegister(reg_num), R31, R1_SP);
+
+    offset += vs_reg_size;
+  }
+
+  assert(offset == frame_size_in_bytes, "consistency check");
+
+  // restore link and the flags
+  __ ld(R31, frame_size_in_bytes + _abi(lr), R1_SP);
+  __ mtlr(R31);
+
+  __ ld(R31, frame_size_in_bytes + _abi(cr), R1_SP);
+  __ mtcr(R31);
 
   // restore scratch register's value
-  __ ld(R31, -reg_size, R1_SP);
+  __ ld(R31, frame_size_in_bytes - reg_size - vsregstosave_num * vs_reg_size, R1_SP);
+
+  // pop the frame
+  __ addi(R1_SP, R1_SP, frame_size_in_bytes);
 
   BLOCK_COMMENT("} restore_live_registers_and_pop_frame");
 }
@@ -447,15 +518,13 @@
 
 // Restore the registers that might be holding a result.
 void RegisterSaver::restore_result_registers(MacroAssembler* masm, int frame_size_in_bytes) {
-  int i;
-  int offset;
   const int regstosave_num       = sizeof(RegisterSaver_LiveRegs) /
                                    sizeof(RegisterSaver::LiveRegType);
-  const int register_save_size   = regstosave_num * reg_size;
+  const int register_save_size   = regstosave_num * reg_size; // VS registers not relevant here.
   const int register_save_offset = frame_size_in_bytes - register_save_size;
 
   // restore all result registers (ints and floats)
-  offset = register_save_offset;
+  int offset = register_save_offset;
   for (int i = 0; i < regstosave_num; i++) {
     int reg_num  = RegisterSaver_LiveRegs[i].reg_num;
     int reg_type = RegisterSaver_LiveRegs[i].reg_type;
@@ -479,6 +548,8 @@
     }
     offset += reg_size;
   }
+
+  assert(offset == frame_size_in_bytes, "consistency check");
 }
 
 // Is vector's size (in bytes) bigger than a size saved by default?
@@ -3109,12 +3180,14 @@
     __ tabort_();
   }
 
+  bool save_vectors = (poll_type == POLL_AT_VECTOR_LOOP);
+
   // Save registers, fpu state, and flags. Set R31 = return pc.
   map = RegisterSaver::push_frame_reg_args_and_save_live_registers(masm,
                                                                    &frame_size_in_bytes,
                                                                    /*generate_oop_map=*/ true,
                                                                    /*return_pc_adjustment=*/0,
-                                                                   return_pc_location);
+                                                                   return_pc_location, save_vectors);
 
   // The following is basically a call_VM. However, we need the precise
   // address of the call in order to generate an oopmap. Hence, we do all the
@@ -3148,7 +3221,7 @@
   // Exception pending
   RegisterSaver::restore_live_registers_and_pop_frame(masm,
                                                       frame_size_in_bytes,
-                                                      /*restore_ctr=*/true);
+                                                      /*restore_ctr=*/true, save_vectors);
 
   BLOCK_COMMENT("  Jump to forward_exception_entry.");
   // Jump to forward_exception_entry, with the issuing PC in LR
@@ -3175,7 +3248,7 @@
   // Normal exit, restore registers and exit.
   RegisterSaver::restore_live_registers_and_pop_frame(masm,
                                                       frame_size_in_bytes,
-                                                      /*restore_ctr=*/true);
+                                                      /*restore_ctr=*/true, save_vectors);
 
   __ blr();
 
--- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -2758,7 +2758,6 @@
     Label L_doLast;
     Label L_do44;
     Label L_do52;
-    Label L_do60;
 
     Register from           = R3_ARG1;  // source array address
     Register to             = R4_ARG2;  // destination array address
@@ -3296,8 +3295,8 @@
     const Register cs        = R27;
 
     // Labels
-    Label SKIP_LSHIFT, SKIP_DIAGONAL_SUM, SKIP_ADDONE, SKIP_MULADD, SKIP_LOOP_SQUARE;
-    Label LOOP_LSHIFT, LOOP_DIAGONAL_SUM, LOOP_ADDONE, LOOP_MULADD, LOOP_SQUARE;
+    Label SKIP_LSHIFT, SKIP_DIAGONAL_SUM, SKIP_ADDONE, SKIP_LOOP_SQUARE;
+    Label LOOP_LSHIFT, LOOP_DIAGONAL_SUM, LOOP_ADDONE, LOOP_SQUARE;
 
     // Save non-volatile regs (frameless).
     int current_offs = -8;
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -3880,7 +3880,6 @@
 void TemplateTable::arraylength() {
   transition(atos, itos);
 
-  Label LnoException;
   __ verify_oop(R17_tos);
   __ null_check_throw(R17_tos, arrayOopDesc::length_offset_in_bytes(), R11_scratch1);
   __ lwa(R17_tos, arrayOopDesc::length_offset_in_bytes(), R17_tos);
@@ -4081,7 +4080,7 @@
                     found_same_obj  = CCR1,
                     reached_limit   = CCR6;
   {
-    Label Lloop, Lentry;
+    Label Lloop;
     Register Rlimit = Rcurrent_monitor;
 
     // Set up search loop - start with topmost monitor.
--- a/src/hotspot/cpu/ppc/vmreg_ppc.inline.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/ppc/vmreg_ppc.inline.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2013 SAP SE. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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
@@ -28,16 +28,21 @@
 
 inline VMReg RegisterImpl::as_VMReg() {
   if (this == noreg) return VMRegImpl::Bad();
+  // Two halfs, multiply by 2.
   return VMRegImpl::as_VMReg(encoding() << 1);
 }
 
-// Since we don't have two halfs here, don't multiply by 2.
-inline VMReg ConditionRegisterImpl::as_VMReg() {
+inline VMReg FloatRegisterImpl::as_VMReg() {
+  // Two halfs, multiply by 2.
+  return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr);
+}
+
+inline VMReg VectorSRegisterImpl::as_VMReg() {
   return VMRegImpl::as_VMReg((encoding()) + ConcreteRegisterImpl::max_fpr);
 }
 
-inline VMReg FloatRegisterImpl::as_VMReg() {
-  return VMRegImpl::as_VMReg((encoding() << 1) + ConcreteRegisterImpl::max_gpr);
+inline VMReg ConditionRegisterImpl::as_VMReg() {
+  return VMRegImpl::as_VMReg((encoding()) + ConcreteRegisterImpl::max_vsr);
 }
 
 inline VMReg SpecialRegisterImpl::as_VMReg() {
--- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -465,19 +465,8 @@
       z_xihf(r1, -1);
     }
   } else { // Distinct src and dst registers.
-    if (VM_Version::has_DistinctOpnds()) {
-      load_const_optimized(r1, -1);
-      z_xgrk(r1, r2, r1);
-    } else {
-      if (wide) {
-        z_lgr(r1, r2);
-        z_xilf(r1, -1);
-        z_xihf(r1, -1);
-      } else {
-        z_lr(r1, r2);
-        z_xilf(r1, -1);
-      }
-    }
+    load_const_optimized(r1, -1);
+    z_xgr(r1, r2);
   }
 }
 
@@ -1158,8 +1147,10 @@
 // Make sure to keep code size constant -> no value-dependent optimizations.
 // Do not kill condition code.
 void MacroAssembler::load_const(Register t, long x) {
-  Assembler::z_iihf(t, (int)(x >> 32));
-  Assembler::z_iilf(t, (int)(x & 0xffffffff));
+  // Note: Right shift is only cleanly defined for unsigned types
+  //       or for signed types with nonnegative values.
+  Assembler::z_iihf(t, (long)((unsigned long)x >> 32));
+  Assembler::z_iilf(t, (long)((unsigned long)x & 0xffffffffUL));
 }
 
 // Load a 32bit constant into a 64bit register, sign-extend or zero-extend.
@@ -1256,8 +1247,10 @@
 // CPU-version dependend patching of load_const.
 void MacroAssembler::patch_const(address a, long x) {
   assert(is_load_const(a), "not a load of a constant");
-  set_imm32((address)a, (int) ((x >> 32) & 0xffffffff));
-  set_imm32((address)(a + 6), (int)(x & 0xffffffff));
+  // Note: Right shift is only cleanly defined for unsigned types
+  //       or for signed types with nonnegative values.
+  set_imm32((address)a, (long)((unsigned long)x >> 32));
+  set_imm32((address)(a + 6), (long)((unsigned long)x & 0xffffffffUL));
 }
 
 // Patching the value of CPU version dependent load_const_32to64 sequence.
@@ -1461,13 +1454,17 @@
 
   // 64 bit value: | part1 | part2 | part3 | part4 |
   // At least one part is not zero!
-  int part1 = ((x >> 32) & 0xffff0000) >> 16;
-  int part2 = (x >> 32) & 0x0000ffff;
-  int part3 = (x & 0xffff0000) >> 16;
-  int part4 = (x & 0x0000ffff);
+  // Note: Right shift is only cleanly defined for unsigned types
+  //       or for signed types with nonnegative values.
+  int part1 = (int)((unsigned long)x >> 48) & 0x0000ffff;
+  int part2 = (int)((unsigned long)x >> 32) & 0x0000ffff;
+  int part3 = (int)((unsigned long)x >> 16) & 0x0000ffff;
+  int part4 = (int)x & 0x0000ffff;
+  int part12 = (int)((unsigned long)x >> 32);
+  int part34 = (int)x;
 
   // Lower word only (unsigned).
-  if ((part1 == 0) && (part2 == 0)) {
+  if (part12 == 0) {
     if (part3 == 0) {
       if (emit) z_llill(t, part4);
       return 4;
@@ -1476,12 +1473,12 @@
       if (emit) z_llilh(t, part3);
       return 4;
     }
-    if (emit) z_llilf(t, (int)(x & 0xffffffff));
+    if (emit) z_llilf(t, part34);
     return 6;
   }
 
   // Upper word only.
-  if ((part3 == 0) && (part4 == 0)) {
+  if (part34 == 0) {
     if (part1 == 0) {
       if (emit) z_llihl(t, part2);
       return 4;
@@ -1490,13 +1487,13 @@
       if (emit) z_llihh(t, part1);
       return 4;
     }
-    if (emit) z_llihf(t, (int)(x >> 32));
+    if (emit) z_llihf(t, part12);
     return 6;
   }
 
   // Lower word only (signed).
   if ((part1 == 0x0000ffff) && (part2 == 0x0000ffff) && ((part3 & 0x00008000) != 0)) {
-    if (emit) z_lgfi(t, (int)(x & 0xffffffff));
+    if (emit) z_lgfi(t, part34);
     return 6;
   }
 
@@ -1511,7 +1508,7 @@
       len += 4;
     }
   } else {
-    if (emit) z_llihf(t, (int)(x >> 32));
+    if (emit) z_llihf(t, part12);
     len += 6;
   }
 
@@ -1524,7 +1521,7 @@
       len += 4;
     }
   } else {
-    if (emit) z_iilf(t, (int)(x & 0xffffffff));
+    if (emit) z_iilf(t, part34);
     len += 6;
   }
   return len;
@@ -3082,7 +3079,7 @@
   // Input registers must not overlap.
   // Also check for R1 which is explicitely used here.
   assert_different_registers(Z_R1, Rsubklass, Rsuperklass, Rarray_ptr, Rlength);
-  NearLabel L_fallthrough, L_loop;
+  NearLabel L_fallthrough;
   int label_nulls = 0;
   if (L_success == NULL) { L_success = &L_fallthrough; label_nulls++; }
   if (L_failure == NULL) { L_failure = &L_fallthrough; label_nulls++; }
--- a/src/hotspot/cpu/s390/stubGenerator_s390.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/s390/stubGenerator_s390.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -285,11 +285,6 @@
       // Just pop the topmost frame ...
       //
 
-      Label ret_is_object;
-      Label ret_is_long;
-      Label ret_is_float;
-      Label ret_is_double;
-
       // Restore frame pointer.
       __ z_lg(r_entryframe_fp, _z_abi(callers_sp), Z_SP);
       // Pop frame. Done here to minimize stalls.
--- a/src/hotspot/cpu/s390/templateTable_s390.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -3785,7 +3785,6 @@
   Label slow_case;
   Label done;
   Label initialize_header;
-  Label allocate_shared;
 
   BLOCK_COMMENT("TemplateTable::_new {");
   __ get_2_byte_integer_at_bcp(offset/*dest*/, 1, InterpreterMacroAssembler::Unsigned);
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -2648,8 +2648,6 @@
      inc_counter((address) counters->total_entry_count_addr(), Rmark, Rscratch);
    }
 
-   Label Egress ;
-
    // Aggressively avoid the Store-before-CAS penalty
    // Defer the store into box->dhw until after the CAS
    Label IsInflated, Recursive ;
@@ -4171,7 +4169,7 @@
   Label L_main_loop_prologue;
   Label L_fold_512b, L_fold_512b_loop, L_fold_128b;
   Label L_fold_tail, L_fold_tail_loop;
-  Label L_8byte_fold_loop, L_8byte_fold_check;
+  Label L_8byte_fold_check;
 
   const Register tmp[CRC32_TMP_REG_NUM] = {L0, L1, L2, L3, L4, L5, L6, G1, I0, I1, I2, I3, I4, I5, I7, O4, O5, G3};
 
--- a/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -166,7 +166,6 @@
   Register G3_Klass = G3_scratch;
   Register G5_icholder = G5;  // Passed in as an argument
   Register G4_interface = G4_scratch;
-  Label search;
 
   // Entry arguments:
   //  G5_interface: Interface
--- a/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1778,7 +1778,6 @@
     __ bind(profile_cast_success);
     __ mov_metadata(mdo, md->constant_encoding());
     __ load_klass(recv, obj);
-    Label update_done;
     type_profile_helper(mdo, md, data, recv, success);
     __ jmp(*success);
 
@@ -1861,7 +1860,6 @@
       __ bind(profile_cast_success);
       __ mov_metadata(mdo, md->constant_encoding());
       __ load_klass(recv, value);
-      Label update_done;
       type_profile_helper(mdo, md, data, recv, &done);
       __ jmpb(done);
 
@@ -3048,7 +3046,6 @@
 
   // if we don't know anything, just go through the generic arraycopy
   if (default_type == NULL) {
-    Label done;
     // save outgoing arguments on stack in case call to System.arraycopy is needed
     // HACK ALERT. This code used to push the parameters in a hardwired fashion
     // for interpreter calling conventions. Now we have to do it in new style conventions.
--- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -957,7 +957,7 @@
   // Runtime will return true if the nmethod has been deoptimized during
   // the patching process. In that case we must do a deopt reexecute instead.
 
-  Label reexecuteEntry, cont;
+  Label cont;
 
   __ testptr(rax, rax);                                 // have we deoptimized?
   __ jcc(Assembler::equal, cont);                       // no
--- a/src/hotspot/cpu/x86/interp_masm_x86.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -170,7 +170,7 @@
 void InterpreterMacroAssembler::profile_return_type(Register mdp, Register ret, Register tmp) {
   assert_different_registers(mdp, ret, tmp, _bcp_register);
   if (ProfileInterpreter && MethodData::profile_return()) {
-    Label profile_continue, done;
+    Label profile_continue;
 
     test_method_data_pointer(mdp, profile_continue);
 
@@ -204,7 +204,7 @@
 
 void InterpreterMacroAssembler::profile_parameters_type(Register mdp, Register tmp1, Register tmp2) {
   if (ProfileInterpreter && MethodData::profile_parameters()) {
-    Label profile_continue, done;
+    Label profile_continue;
 
     test_method_data_pointer(mdp, profile_continue);
 
@@ -1703,12 +1703,12 @@
     bind(next_test);
 
     if (test_for_null_also) {
-      Label found_null;
       // Failed the equality check on item[n]...  Test for null.
       testptr(reg2, reg2);
       if (start_row == last_row) {
         // The only thing left to do is handle the null case.
         if (non_profiled_offset >= 0) {
+          Label found_null;
           jccb(Assembler::zero, found_null);
           // Item did not match any saved item and there is no empty row for it.
           // Increment total counter to indicate polymorphic case.
@@ -1720,6 +1720,7 @@
         }
         break;
       }
+      Label found_null;
       // Since null is rare, make it be the branch-taken case.
       jcc(Assembler::zero, found_null);
 
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -7982,7 +7982,7 @@
                                    Register rtmp, XMMRegister xtmp) {
   ShortBranchVerifier sbv(this);
   assert_different_registers(to, value, count, rtmp);
-  Label L_exit, L_skip_align1, L_skip_align2, L_fill_byte;
+  Label L_exit;
   Label L_fill_2_bytes, L_fill_4_bytes;
 
   int shift = -1;
@@ -8017,8 +8017,10 @@
   cmpl(count, 2<<shift); // Short arrays (< 8 bytes) fill by element
   jcc(Assembler::below, L_fill_4_bytes); // use unsigned cmp
   if (!UseUnalignedLoadStores && !aligned && (t == T_BYTE || t == T_SHORT)) {
+    Label L_skip_align2;
     // align source address at 4 bytes address boundary
     if (t == T_BYTE) {
+      Label L_skip_align1;
       // One byte misalignment happens only for byte arrays
       testptr(to, 1);
       jccb(Assembler::zero, L_skip_align1);
@@ -8183,6 +8185,7 @@
   jccb(Assembler::zero, L_fill_2_bytes);
   movl(Address(to, 0), value);
   if (t == T_BYTE || t == T_SHORT) {
+    Label L_fill_byte;
     addptr(to, 4);
     BIND(L_fill_2_bytes);
     // fill trailing 2 bytes
@@ -8246,7 +8249,7 @@
   negptr(len);
 
   if (UseSSE42Intrinsics || UseAVX >= 2) {
-    Label L_chars_8_check, L_copy_8_chars, L_copy_8_chars_exit;
+    Label L_copy_8_chars, L_copy_8_chars_exit;
     Label L_chars_16_check, L_copy_16_chars, L_copy_16_chars_exit;
 
     if (UseAVX >= 2) {
@@ -8812,9 +8815,8 @@
 void MacroAssembler::vectorized_mismatch(Register obja, Register objb, Register length, Register log2_array_indxscale,
   Register result, Register tmp1, Register tmp2, XMMRegister rymm0, XMMRegister rymm1, XMMRegister rymm2){
   assert(UseSSE42Intrinsics, "SSE4.2 must be enabled.");
-  Label VECTOR64_LOOP, VECTOR64_TAIL, VECTOR64_NOT_EQUAL, VECTOR32_TAIL;
-  Label VECTOR32_LOOP, VECTOR16_LOOP, VECTOR8_LOOP, VECTOR4_LOOP;
-  Label VECTOR16_TAIL, VECTOR8_TAIL, VECTOR4_TAIL;
+  Label VECTOR16_LOOP, VECTOR8_LOOP, VECTOR4_LOOP;
+  Label VECTOR8_TAIL, VECTOR4_TAIL;
   Label VECTOR32_NOT_EQUAL, VECTOR16_NOT_EQUAL, VECTOR8_NOT_EQUAL, VECTOR4_NOT_EQUAL;
   Label SAME_TILL_END, DONE;
   Label BYTES_LOOP, BYTES_TAIL, BYTES_NOT_EQUAL;
@@ -8827,6 +8829,8 @@
 
   if ((UseAVX > 2) &&
       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);
@@ -8848,7 +8852,7 @@
     testq(tmp1, tmp1);
     jcc(Assembler::zero, SAME_TILL_END);
 
-    bind(VECTOR64_TAIL);
+    //bind(VECTOR64_TAIL);
     // AVX512 code to compare upto 63 byte vectors.
     // Save k1
     kmovql(k3, k1);
@@ -8881,6 +8885,7 @@
   jcc(Assembler::less, VECTOR4_TAIL);
 
   if (UseAVX >= 2) {
+    Label VECTOR16_TAIL, VECTOR32_LOOP;
 
     cmpq(length, 16);
     jcc(Assembler::equal, VECTOR16_LOOP);
@@ -9231,7 +9236,7 @@
  */
 void MacroAssembler::square_to_len(Register x, Register len, Register z, Register zlen, Register tmp1, Register tmp2, Register tmp3, Register tmp4, Register tmp5, Register rdxReg, Register raxReg) {
 
-  Label L_second_loop, L_second_loop_exit, L_third_loop, L_third_loop_exit, fifth_loop, fifth_loop_exit, L_last_x, L_multiply;
+  Label L_second_loop, L_second_loop_exit, L_third_loop, L_third_loop_exit, L_last_x, L_multiply;
   push(tmp1);
   push(tmp2);
   push(tmp3);
--- a/src/hotspot/cpu/x86/macroAssembler_x86_cos.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_cos.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -185,7 +185,7 @@
   Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1;
   Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1;
   Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1;
-  Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, B1_2, B1_3, B1_4, B1_5, start;
+  Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, B1_2, B1_4, start;
 
   assert_different_registers(r8, r9, r10, r11, eax, ecx, edx);
 
@@ -756,9 +756,7 @@
 
 void MacroAssembler::fast_cos(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) {
   Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
-  Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2;
-  Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2;
-  Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start;
+  Label start;
 
   assert_different_registers(tmp, eax, ecx, edx);
 
--- a/src/hotspot/cpu/x86/macroAssembler_x86_exp.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_exp.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -483,7 +483,7 @@
   Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
   Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2;
   Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2;
-  Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start;
+  Label L_2TAG_PACKET_12_0_2, start;
 
   assert_different_registers(tmp, eax, ecx, edx);
   jmp(start);
--- a/src/hotspot/cpu/x86/macroAssembler_x86_log.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_log.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -186,7 +186,7 @@
   Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
   Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2;
   Label L_2TAG_PACKET_8_0_2;
-  Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start;
+  Label B1_3, B1_5, start;
 
   assert_different_registers(tmp1, tmp2, eax, ecx, edx);
   jmp(start);
--- a/src/hotspot/cpu/x86/macroAssembler_x86_log10.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_log10.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -198,7 +198,7 @@
 void MacroAssembler::fast_log10(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register r11) {
   Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
   Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2;
-  Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, B1_2, B1_3, B1_4, B1_5, start;
+  Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, B1_2, B1_3, B1_5, start;
 
   assert_different_registers(r11, eax, ecx, edx);
 
--- a/src/hotspot/cpu/x86/macroAssembler_x86_sin.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_sin.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -383,7 +383,7 @@
   Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1;
   Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1;
   Label L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1;
-  Label L_2TAG_PACKET_12_0_1, B1_1, B1_2, B1_4, start;
+  Label L_2TAG_PACKET_12_0_1, B1_4, start;
 
   assert_different_registers(tmp1, tmp2, tmp3, tmp4, eax, ebx, ecx, edx);
   address ONEHALF = StubRoutines::x86::_ONEHALF_addr();
@@ -1673,7 +1673,7 @@
   Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12;
   Label B1_13, B1_14, B1_15, B1_16, B1_17, B1_18, B1_19, B1_20, B1_21, B1_22, B1_23;
   Label B1_24, B1_25, B1_26, B1_27, B1_28, B1_29, B1_30, B1_31, B1_32, B1_33, B1_34;
-  Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_44, B1_45, B1_46;
+  Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_46;
 
   assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp);
 
--- a/src/hotspot/cpu/x86/macroAssembler_x86_tan.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_tan.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -501,7 +501,7 @@
   Label L_2TAG_PACKET_0_0_1, L_2TAG_PACKET_1_0_1, L_2TAG_PACKET_2_0_1, L_2TAG_PACKET_3_0_1;
   Label L_2TAG_PACKET_4_0_1, L_2TAG_PACKET_5_0_1, L_2TAG_PACKET_6_0_1, L_2TAG_PACKET_7_0_1;
   Label L_2TAG_PACKET_8_0_1, L_2TAG_PACKET_9_0_1, L_2TAG_PACKET_10_0_1, L_2TAG_PACKET_11_0_1;
-  Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1, B1_2, B1_3, B1_4, B1_5, start;
+  Label L_2TAG_PACKET_12_0_1, L_2TAG_PACKET_13_0_1, L_2TAG_PACKET_14_0_1, B1_2, B1_4, start;
 
   address ONEHALF = (address)_ONEHALF_tan;
   address MUL16 = (address)_MUL16;
@@ -1089,7 +1089,7 @@
   Label B1_1, B1_2, B1_3, B1_4, B1_5, B1_6, B1_7, B1_8, B1_9, B1_10, B1_11, B1_12;
   Label B1_13, B1_14, B1_15, B1_16, B1_17, B1_18, B1_19, B1_20, B1_21, B1_22, B1_23;
   Label B1_24, B1_25, B1_26, B1_27, B1_28, B1_29, B1_30, B1_31, B1_32, B1_33, B1_34;
-  Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_41, B1_42, B1_43, B1_44, B1_45, B1_46;
+  Label B1_35, B1_36, B1_37, B1_38, B1_39, B1_40, B1_43;
 
   assert_different_registers(ebx, eax, ecx, edx, esi, edi, ebp, esp);
 
@@ -1966,9 +1966,8 @@
 void MacroAssembler::fast_tan(XMMRegister xmm0, XMMRegister xmm1, XMMRegister xmm2, XMMRegister xmm3, XMMRegister xmm4, XMMRegister xmm5, XMMRegister xmm6, XMMRegister xmm7, Register eax, Register ecx, Register edx, Register tmp) {
 
   Label L_2TAG_PACKET_0_0_2, L_2TAG_PACKET_1_0_2, L_2TAG_PACKET_2_0_2, L_2TAG_PACKET_3_0_2;
-  Label L_2TAG_PACKET_4_0_2, L_2TAG_PACKET_5_0_2, L_2TAG_PACKET_6_0_2, L_2TAG_PACKET_7_0_2;
-  Label L_2TAG_PACKET_8_0_2, L_2TAG_PACKET_9_0_2, L_2TAG_PACKET_10_0_2, L_2TAG_PACKET_11_0_2;
-  Label L_2TAG_PACKET_12_0_2, L_2TAG_PACKET_13_0_2, B1_3, B1_5, start;
+  Label L_2TAG_PACKET_4_0_2;
+  Label start;
 
   assert_different_registers(tmp, eax, ecx, edx);
 
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -3492,8 +3492,13 @@
   // No exception case
   __ bind(noException);
 
-  Label no_adjust, bail, no_prefix, not_special;
+  Label no_adjust;
+#ifdef ASSERT
+  Label bail;
+#endif
   if (SafepointMechanism::uses_thread_local_poll() && !cause_return) {
+    Label no_prefix, not_special;
+
     // If our stashed return pc was modified by the runtime we avoid touching it
     __ cmpptr(rbx, Address(rbp, wordSize));
     __ jccb(Assembler::notEqual, no_adjust);
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1171,6 +1171,8 @@
   // Registers r9 and r10 are used to save rdi and rsi on Windows, which latter
   // are non-volatile.  r9 and r10 should not be used by the caller.
   //
+  DEBUG_ONLY(bool regs_in_thread;)
+
   void setup_arg_regs(int nargs = 3) {
     const Register saved_rdi = r9;
     const Register saved_rsi = r10;
@@ -1191,9 +1193,11 @@
     assert(c_rarg0 == rdi && c_rarg1 == rsi && c_rarg2 == rdx && c_rarg3 == rcx,
            "unexpected argument registers");
 #endif
+    DEBUG_ONLY(regs_in_thread = false;)
   }
 
   void restore_arg_regs() {
+    assert(!regs_in_thread, "wrong call to restore_arg_regs");
     const Register saved_rdi = r9;
     const Register saved_rsi = r10;
 #ifdef _WIN64
@@ -1202,6 +1206,38 @@
 #endif
   }
 
+  // This is used in places where r10 is a scratch register, and can
+  // be adapted if r9 is needed also.
+  void setup_arg_regs_using_thread() {
+    const Register saved_r15 = r9;
+#ifdef _WIN64
+    __ mov(saved_r15, r15);  // r15 is callee saved and needs to be restored
+    __ get_thread(r15_thread);
+    assert(c_rarg0 == rcx && c_rarg1 == rdx && c_rarg2 == r8 && c_rarg3 == r9,
+           "unexpected argument registers");
+    __ movptr(Address(r15_thread, in_bytes(JavaThread::windows_saved_rdi_offset())), rdi);
+    __ movptr(Address(r15_thread, in_bytes(JavaThread::windows_saved_rsi_offset())), rsi);
+
+    __ mov(rdi, rcx); // c_rarg0
+    __ mov(rsi, rdx); // c_rarg1
+    __ mov(rdx, r8);  // c_rarg2
+#else
+    assert(c_rarg0 == rdi && c_rarg1 == rsi && c_rarg2 == rdx && c_rarg3 == rcx,
+           "unexpected argument registers");
+#endif
+    DEBUG_ONLY(regs_in_thread = true;)
+  }
+
+  void restore_arg_regs_using_thread() {
+    assert(regs_in_thread, "wrong call to restore_arg_regs");
+    const Register saved_r15 = r9;
+#ifdef _WIN64
+    __ get_thread(r15_thread);
+    __ movptr(rsi, Address(r15_thread, in_bytes(JavaThread::windows_saved_rsi_offset())));
+    __ movptr(rdi, Address(r15_thread, in_bytes(JavaThread::windows_saved_rdi_offset())));
+    __ mov(r15, saved_r15);  // r15 is callee saved and needs to be restored
+#endif
+  }
 
   // Copy big chunks forward
   //
@@ -1829,8 +1865,8 @@
       BLOCK_COMMENT("Entry:");
     }
 
-    setup_arg_regs(); // from => rdi, to => rsi, count => rdx
-                      // r9 and r10 may be used to save non-volatile registers
+    setup_arg_regs_using_thread(); // from => rdi, to => rsi, count => rdx
+                                   // r9 is used to save r15_thread
 
     DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_DISJOINT;
     if (dest_uninitialized) {
@@ -1870,7 +1906,7 @@
 
   __ BIND(L_exit);
     bs->arraycopy_epilogue(_masm, decorators, type, from, to, dword_count);
-    restore_arg_regs();
+    restore_arg_regs_using_thread();
     inc_counter_np(SharedRuntime::_jint_array_copy_ctr); // Update counter after rscratch1 is free
     __ vzeroupper();
     __ xorptr(rax, rax); // return 0
@@ -1906,7 +1942,7 @@
     StubCodeMark mark(this, "StubRoutines", name);
     address start = __ pc();
 
-    Label L_copy_bytes, L_copy_8_bytes, L_copy_2_bytes, L_exit;
+    Label L_copy_bytes, L_copy_8_bytes, L_exit;
     const Register from        = rdi;  // source array address
     const Register to          = rsi;  // destination array address
     const Register count       = rdx;  // elements count
@@ -1923,8 +1959,8 @@
     }
 
     array_overlap_test(nooverlap_target, Address::times_4);
-    setup_arg_regs(); // from => rdi, to => rsi, count => rdx
-                      // r9 and r10 may be used to save non-volatile registers
+    setup_arg_regs_using_thread(); // from => rdi, to => rsi, count => rdx
+                                   // r9 is used to save r15_thread
 
     DecoratorSet decorators = IN_HEAP | IS_ARRAY;
     if (dest_uninitialized) {
@@ -1963,7 +1999,7 @@
     if (is_oop) {
       __ jmp(L_exit);
     }
-    restore_arg_regs();
+    restore_arg_regs_using_thread();
     inc_counter_np(SharedRuntime::_jint_array_copy_ctr); // Update counter after rscratch1 is free
     __ xorptr(rax, rax); // return 0
     __ vzeroupper();
@@ -1975,7 +2011,7 @@
 
   __ BIND(L_exit);
     bs->arraycopy_epilogue(_masm, decorators, type, from, to, dword_count);
-    restore_arg_regs();
+    restore_arg_regs_using_thread();
     inc_counter_np(SharedRuntime::_jint_array_copy_ctr); // Update counter after rscratch1 is free
     __ xorptr(rax, rax); // return 0
     __ vzeroupper();
@@ -2026,8 +2062,8 @@
       BLOCK_COMMENT("Entry:");
     }
 
-    setup_arg_regs(); // from => rdi, to => rsi, count => rdx
-                      // r9 and r10 may be used to save non-volatile registers
+    setup_arg_regs_using_thread(); // from => rdi, to => rsi, count => rdx
+                                     // r9 is used to save r15_thread
     // 'from', 'to' and 'qword_count' are now valid
 
     DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_DISJOINT;
@@ -2058,7 +2094,7 @@
     if (is_oop) {
       __ jmp(L_exit);
     } else {
-      restore_arg_regs();
+      restore_arg_regs_using_thread();
       inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); // Update counter after rscratch1 is free
       __ xorptr(rax, rax); // return 0
       __ vzeroupper();
@@ -2071,7 +2107,7 @@
 
     __ BIND(L_exit);
     bs->arraycopy_epilogue(_masm, decorators, type, from, to, qword_count);
-    restore_arg_regs();
+    restore_arg_regs_using_thread();
     if (is_oop) {
       inc_counter_np(SharedRuntime::_oop_array_copy_ctr); // Update counter after rscratch1 is free
     } else {
@@ -2119,8 +2155,8 @@
     }
 
     array_overlap_test(nooverlap_target, Address::times_8);
-    setup_arg_regs(); // from => rdi, to => rsi, count => rdx
-                      // r9 and r10 may be used to save non-volatile registers
+    setup_arg_regs_using_thread(); // from => rdi, to => rsi, count => rdx
+                                   // r9 is used to save r15_thread
     // 'from', 'to' and 'qword_count' are now valid
 
     DecoratorSet decorators = IN_HEAP | IS_ARRAY | ARRAYCOPY_DISJOINT;
@@ -2147,7 +2183,7 @@
     if (is_oop) {
       __ jmp(L_exit);
     } else {
-      restore_arg_regs();
+      restore_arg_regs_using_thread();
       inc_counter_np(SharedRuntime::_jlong_array_copy_ctr); // Update counter after rscratch1 is free
       __ xorptr(rax, rax); // return 0
       __ vzeroupper();
@@ -2160,7 +2196,7 @@
 
     __ BIND(L_exit);
     bs->arraycopy_epilogue(_masm, decorators, type, from, to, qword_count);
-    restore_arg_regs();
+    restore_arg_regs_using_thread();
     if (is_oop) {
       inc_counter_np(SharedRuntime::_oop_array_copy_ctr); // Update counter after rscratch1 is free
     } else {
@@ -2276,11 +2312,22 @@
     enum {
       saved_r13_offset,
       saved_r14_offset,
+      saved_r10_offset,
       saved_rbp_offset
     };
     __ subptr(rsp, saved_rbp_offset * wordSize);
     __ movptr(Address(rsp, saved_r13_offset * wordSize), r13);
     __ movptr(Address(rsp, saved_r14_offset * wordSize), r14);
+    __ movptr(Address(rsp, saved_r10_offset * wordSize), r10);
+
+#ifdef ASSERT
+      Label L2;
+      __ get_thread(r14);
+      __ cmpptr(r15_thread, r14);
+      __ jcc(Assembler::equal, L2);
+      __ stop("StubRoutines::call_stub: r15_thread is modified by call");
+      __ bind(L2);
+#endif // ASSERT
 
     // check that int operands are properly extended to size_t
     assert_clean_int(length, rax);
@@ -2372,6 +2419,7 @@
     __ BIND(L_done);
     __ movptr(r13, Address(rsp, saved_r13_offset * wordSize));
     __ movptr(r14, Address(rsp, saved_r14_offset * wordSize));
+    __ movptr(r10, Address(rsp, saved_r10_offset * wordSize));
     restore_arg_regs();
     inc_counter_np(SharedRuntime::_checkcast_array_copy_ctr); // Update counter after rscratch1 is free
     __ leave(); // required for proper stackwalking of RuntimeStub frame
@@ -3848,7 +3896,7 @@
     Label L__incCounter[3][6]; //for 6 blocks
     Label L__incCounter_single[3]; //for single block, key128, key192, key256
     Label L_processTail_insr[3], L_processTail_4_insr[3], L_processTail_2_insr[3], L_processTail_1_insr[3], L_processTail_exit_insr[3];
-    Label L_processTail_extr[3], L_processTail_4_extr[3], L_processTail_2_extr[3], L_processTail_1_extr[3], L_processTail_exit_extr[3];
+    Label L_processTail_4_extr[3], L_processTail_2_extr[3], L_processTail_1_extr[3], L_processTail_exit_extr[3];
 
     Label L_exit;
 
@@ -5197,9 +5245,9 @@
     BLOCK_COMMENT("Entry:");
     __ enter(); // required for proper stackwalking of RuntimeStub frame
 
-       setup_arg_regs(4); // x => rdi, len => rsi, z => rdx
-                          // zlen => rcx
-                          // r9 and r10 may be used to save non-volatile registers
+    setup_arg_regs(4); // x => rdi, len => rsi, z => rdx
+                       // zlen => rcx
+                       // r9 and r10 may be used to save non-volatile registers
     __ movptr(r8, rdx);
     __ square_to_len(x, len, z, zlen, tmp1, tmp2, tmp3, tmp4, tmp5, rdx, rax);
 
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1171,7 +1171,7 @@
   // and result handler will pick it up
 
   {
-    Label no_oop, not_weak, store_result;
+    Label no_oop;
     __ lea(t, ExternalAddress(AbstractInterpreter::result_handler(T_OBJECT)));
     __ cmpptr(t, Address(rbp, frame::interpreter_frame_result_handler_offset*wordSize));
     __ jcc(Assembler::notEqual, no_oop);
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -2875,7 +2875,7 @@
 
   const Address field(obj, off, Address::times_1, 0*wordSize);
 
-  Label Done, notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
+  Label Done, notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj;
 
   __ shrl(flags, ConstantPoolCacheEntry::tos_state_shift);
   // Make sure we don't need to mask edx after the above shift
@@ -2981,6 +2981,7 @@
 
   __ bind(notFloat);
 #ifdef ASSERT
+  Label notDouble;
   __ cmpl(flags, dtos);
   __ jcc(Assembler::notEqual, notDouble);
 #endif
@@ -3132,7 +3133,7 @@
   NOT_LP64( const Address hi(obj, off, Address::times_1, 1*wordSize);)
 
   Label notByte, notBool, notInt, notShort, notChar,
-        notLong, notFloat, notObj, notDouble;
+        notLong, notFloat, notObj;
 
   __ shrl(flags, ConstantPoolCacheEntry::tos_state_shift);
 
@@ -3286,6 +3287,7 @@
 
   __ bind(notFloat);
 #ifdef ASSERT
+  Label notDouble;
   __ cmpl(flags, dtos);
   __ jcc(Assembler::notEqual, notDouble);
 #endif
--- a/src/hotspot/os/windows/include/jvm_md.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/os/windows/include/jvm_md.h	Tue Sep 18 16:41:24 2018 -0700
@@ -63,7 +63,7 @@
 #include <stddef.h>  /* For uintptr_t */
 #include <stdlib.h>
 
-#define JVM_MAXPATHLEN _MAX_PATH
+#define JVM_MAXPATHLEN 1024
 
 #define JVM_R_OK    4
 #define JVM_W_OK    2
--- a/src/hotspot/os_cpu/windows_x86/thread_windows_x86.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/os_cpu/windows_x86/thread_windows_x86.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,8 +26,15 @@
 #define OS_CPU_WINDOWS_X86_VM_THREAD_WINDOWS_X86_HPP
 
  private:
+  // On windows, in the stubGenerator, there's nowhere to save callee saved regs
+  address          _windows_saved_rsi;
+  address          _windows_saved_rdi;
+
   void pd_initialize() {
     _anchor.clear();
+
+    _windows_saved_rsi = NULL;
+    _windows_saved_rdi = NULL;
   }
 
   frame pd_last_frame();
@@ -52,6 +59,8 @@
 
    bool pd_get_top_frame_for_profiling(frame* fr_addr, void* ucontext, bool isInJava);
 
+  static ByteSize windows_saved_rsi_offset() { return byte_offset_of(JavaThread, _windows_saved_rsi); }
+  static ByteSize windows_saved_rdi_offset() { return byte_offset_of(JavaThread, _windows_saved_rdi); }
 private:
   bool pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava);
 
--- a/src/hotspot/share/aot/aotCodeHeap.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -38,6 +38,7 @@
 #include "oops/method.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/os.hpp"
+#include "runtime/safepointVerifiers.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/vm_operations.hpp"
 
@@ -298,15 +299,25 @@
 void AOTCodeHeap::publish_aot(const methodHandle& mh, AOTMethodData* method_data, int code_id) {
   // The method may be explicitly excluded by the user.
   // Or Interpreter uses an intrinsic for this method.
-  if (CompilerOracle::should_exclude(mh) || !AbstractInterpreter::can_be_compiled(mh)) {
+  // Or method has breakpoints.
+  if (CompilerOracle::should_exclude(mh) ||
+      !AbstractInterpreter::can_be_compiled(mh) ||
+      (mh->number_of_breakpoints() > 0)) {
     return;
   }
+  // Make sure no break points were set in the method in case of a safepoint
+  // in the following code until aot code is registered.
+  NoSafepointVerifier nsv;
 
   address code = method_data->_code;
   const char* name = method_data->_name;
   aot_metadata* meta = method_data->_meta;
 
   if (meta->scopes_pcs_begin() == meta->scopes_pcs_end()) {
+    // Switch off NoSafepointVerifier because log_info() may cause safepoint
+    // and it is fine because aot code will not be registered here.
+    PauseNoSafepointVerifier pnsv(&nsv);
+
     // When the AOT compiler compiles something big we fail to generate metadata
     // in CodeInstaller::gather_metadata. In that case the scopes_pcs_begin == scopes_pcs_end.
     // In all successful cases we always have 2 entries of scope pcs.
@@ -343,6 +354,7 @@
 #endif
     Method::set_code(mh, aot);
     if (PrintAOT || (PrintCompilation && PrintAOT)) {
+      PauseNoSafepointVerifier pnsv(&nsv); // aot code is registered already
       aot->print_on(tty, NULL);
     }
     // Publish oop only after we are visible to CompiledMethodIterator
@@ -918,16 +930,6 @@
 }
 #endif
 
-void AOTCodeHeap::flush_evol_dependents_on(InstanceKlass* dependee) {
-  for (int index = 0; index < _method_count; index++) {
-    if (_code_to_aot[index]._state != in_use) {
-      continue; // Skip uninitialized entries.
-    }
-    AOTCompiledMethod* aot = _code_to_aot[index]._aot;
-    aot->flush_evol_dependents_on(dependee);
-  }
-}
-
 void AOTCodeHeap::metadata_do(void f(Metadata*)) {
   for (int index = 0; index < _method_count; index++) {
     if (_code_to_aot[index]._state != in_use) {
--- a/src/hotspot/share/aot/aotCodeHeap.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/aot/aotCodeHeap.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -283,8 +283,6 @@
 
   DEBUG_ONLY( int verify_icholder_relocations(); )
 
-  void flush_evol_dependents_on(InstanceKlass* dependee);
-
   void alive_methods_do(void f(CompiledMethod* nm));
 
 #ifndef PRODUCT
--- a/src/hotspot/share/aot/aotCompiledMethod.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -243,16 +243,6 @@
 }
 #endif // TIERED
 
-// We don't have full dependencies for AOT methods, so flushing is
-// more conservative than for nmethods.
-void AOTCompiledMethod::flush_evol_dependents_on(InstanceKlass* dependee) {
-  if (is_java_method()) {
-    clear_inline_caches();
-    mark_for_deoptimization();
-    make_not_entrant();
-  }
-}
-
 // Iterate over metadata calling this function.   Used by RedefineClasses
 // Copied from nmethod::metadata_do
 void AOTCompiledMethod::metadata_do(void f(Metadata*)) {
--- a/src/hotspot/share/aot/aotCompiledMethod.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/aot/aotCompiledMethod.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -238,11 +238,6 @@
   address get_original_pc(const frame* fr) { return *orig_pc_addr(fr); }
   void    set_original_pc(const frame* fr, address pc) { *orig_pc_addr(fr) = pc; }
 
-#ifdef HOTSWAP
-  // Flushing and deoptimization in case of evolution
-  void flush_evol_dependents_on(InstanceKlass* dependee);
-#endif // HOTSWAP
-
   virtual void metadata_do(void f(Metadata*));
 
   bool metadata_got_contains(Metadata **p) {
--- a/src/hotspot/share/aot/aotLoader.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/aot/aotLoader.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -47,6 +47,13 @@
     return;
   }
   if (UseAOT) {
+    if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
+      if (PrintAOT) {
+        warning("JVMTI capability to hotswap and post breakpoint is not compatible with AOT (switching AOT off)");
+      }
+      FLAG_SET_DEFAULT(UseAOT, false);
+      return;
+    }
     FOR_ALL_AOT_HEAPS(heap) {
       (*heap)->load_klass_data(ik, thread);
     }
@@ -54,6 +61,7 @@
 }
 
 uint64_t AOTLoader::get_saved_fingerprint(InstanceKlass* ik) {
+  assert(UseAOT, "called only when AOT is enabled");
   if (ik->is_unsafe_anonymous()) {
     // don't even bother
     return 0;
@@ -67,24 +75,6 @@
   return 0;
 }
 
-bool AOTLoader::find_klass(InstanceKlass* ik) {
-  FOR_ALL_AOT_HEAPS(heap) {
-    if ((*heap)->find_klass(ik) != NULL) {
-      return true;
-    }
-  }
-  return false;
-}
-
-bool AOTLoader::contains(address p) {
-  FOR_ALL_AOT_HEAPS(heap) {
-    if ((*heap)->contains(p)) {
-      return true;
-    }
-  }
-  return false;
-}
-
 void AOTLoader::oops_do(OopClosure* f) {
   if (UseAOT) {
     FOR_ALL_AOT_HEAPS(heap) {
@@ -101,15 +91,6 @@
   }
 }
 
-// Flushing and deoptimization in case of evolution
-void AOTLoader::flush_evol_dependents_on(InstanceKlass* dependee) {
-  // make non entrant and mark for deoptimization
-  FOR_ALL_AOT_HEAPS(heap) {
-    (*heap)->flush_evol_dependents_on(dependee);
-  }
-  Deoptimization::deoptimize_dependents();
-}
-
 /**
  * List of core modules for which we search for shared libraries.
  */
@@ -139,6 +120,14 @@
       return;
     }
 
+    if (JvmtiExport::can_hotswap_or_post_breakpoint()) {
+      if (PrintAOT) {
+        warning("JVMTI capability to hotswap and post breakpoint is not compatible with AOT (switching AOT off)");
+      }
+      FLAG_SET_DEFAULT(UseAOT, false);
+      return;
+    }
+
     // -Xint is not compatible with AOT
     if (Arguments::is_interpreter_only()) {
       if (PrintAOT) {
--- a/src/hotspot/share/aot/aotLoader.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/aot/aotLoader.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -59,20 +59,13 @@
   static void universe_init() NOT_AOT_RETURN;
   static void set_narrow_oop_shift() NOT_AOT_RETURN;
   static void set_narrow_klass_shift() NOT_AOT_RETURN;
-  static bool contains(address p) NOT_AOT({ return false; });
   static void load_for_klass(InstanceKlass* ik, Thread* thread) NOT_AOT_RETURN;
-  static bool find_klass(InstanceKlass* ik) NOT_AOT({ return false; });
   static uint64_t get_saved_fingerprint(InstanceKlass* ik) NOT_AOT({ return 0; });
   static void oops_do(OopClosure* f) NOT_AOT_RETURN;
   static void metadata_do(void f(Metadata*)) NOT_AOT_RETURN;
 
   NOT_PRODUCT( static void print_statistics() NOT_AOT_RETURN; )
 
-#ifdef HOTSWAP
-  // Flushing and deoptimization in case of evolution
-  static void flush_evol_dependents_on(InstanceKlass* dependee) NOT_AOT_RETURN;
-#endif // HOTSWAP
-
   static bool reconcile_dynamic_invoke(InstanceKlass* holder, int index, Method* adapter_method, Klass *appendix_klass) NOT_AOT({ return true; });
 };
 
--- a/src/hotspot/share/ci/ciMethodData.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/ci/ciMethodData.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -187,8 +187,13 @@
   for (uint row = 0; row < row_limit(); row++) {
     Klass* k = data->as_ReceiverTypeData()->receiver(row);
     if (k != NULL) {
-      ciKlass* klass = CURRENT_ENV->get_klass(k);
-      set_receiver(row, klass);
+      if (k->is_loader_alive()) {
+        ciKlass* klass = CURRENT_ENV->get_klass(k);
+        set_receiver(row, klass);
+      } else {
+        // With concurrent class unloading, the MDO could have stale metadata; override it
+        clear_row(row);
+      }
     }
   }
 }
--- a/src/hotspot/share/classfile/classLoaderData.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -157,6 +157,7 @@
   if (!h_class_loader.is_null()) {
     _class_loader = _handles.add(h_class_loader());
     _class_loader_klass = h_class_loader->klass();
+    initialize_name(h_class_loader);
   }
 
   if (!is_unsafe_anonymous) {
@@ -671,6 +672,15 @@
   }
 }
 
+// Let the GC read the holder without keeping it alive.
+oop ClassLoaderData::holder_no_keepalive() const {
+  if (!_holder.is_null()) {  // NULL class_loader
+    return _holder.peek();
+  } else {
+    return NULL;
+  }
+}
+
 // Unloading support
 bool ClassLoaderData::is_alive() const {
   bool alive = keep_alive()         // null class loader and incomplete unsafe anonymous klasses.
@@ -759,6 +769,14 @@
   if (_deallocate_list != NULL) {
     delete _deallocate_list;
   }
+
+  // Decrement refcounts of Symbols if created.
+  if (_name != NULL) {
+    _name->decrement_refcount();
+  }
+  if (_name_and_id != NULL) {
+    _name_and_id->decrement_refcount();
+  }
 }
 
 // Returns true if this class loader data is for the app class loader
@@ -1068,33 +1086,38 @@
 // 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;
-  {
-    NoSafepointVerifier no_safepoints; // we mustn't GC until we've installed the
-                                       // ClassLoaderData in the loader since the CLD
-                                       // contains oops in _handles that must be walked.
-                                       // GC will find the CLD through the loader after this.
 
-    cld = new ClassLoaderData(loader, is_unsafe_anonymous);
-
-    if (!is_unsafe_anonymous) {
-      // First, Atomically set it
-      ClassLoaderData* old = java_lang_ClassLoader::cmpxchg_loader_data(cld, loader(), NULL);
-      if (old != NULL) {
-        delete cld;
-        // Returns the data.
-        return old;
-      }
+  // 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;
     }
   }
 
-  MutexLocker ml(ClassLoaderDataGraph_lock);
+  // 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;
 
-  // We won the race, and therefore the task of adding the data to the list of
-  // class loader data
+  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;
@@ -1107,12 +1130,8 @@
 }
 
 ClassLoaderData* ClassLoaderDataGraph::add(Handle loader, bool is_unsafe_anonymous) {
+  MutexLocker ml(ClassLoaderDataGraph_lock);
   ClassLoaderData* loader_data = add_to_graph(loader, is_unsafe_anonymous);
-  // Initialize _name and _name_and_id after the loader data is added to the
-  // CLDG because adding the Symbol for _name and _name_and_id might safepoint.
-  if (loader.not_null()) {
-    loader_data->initialize_name(loader);
-  }
   return loader_data;
 }
 
--- a/src/hotspot/share/classfile/classLoaderData.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -307,8 +307,9 @@
   void accumulate_modified_oops()        { if (has_modified_oops()) _accumulated_modified_oops = true; }
   void clear_accumulated_modified_oops() { _accumulated_modified_oops = false; }
   bool has_accumulated_modified_oops()   { return _accumulated_modified_oops; }
+  oop holder_no_keepalive() const;
+
  private:
-
   void unload();
   bool keep_alive() const       { return _keep_alive > 0; }
 
@@ -336,6 +337,8 @@
   bool claimed() const { return _claimed == 1; }
   bool claim();
 
+  // Computes if the CLD is alive or not. This is safe to call in concurrent
+  // contexts.
   bool is_alive() const;
 
   // Accessors
@@ -377,6 +380,9 @@
   inline oop class_loader() const;
 
   // Returns true if this class loader data is for a loader going away.
+  // Note that this is only safe after the GC has computed if the CLD is
+  // unloading or not. In concurrent contexts where there are no such
+  // guarantees, is_alive() should be used instead.
   bool is_unloading() const     {
     assert(!(is_the_null_class_loader_data() && _unloading), "The null class loader can never be unloaded");
     return _unloading;
--- a/src/hotspot/share/classfile/classLoaderData.inline.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.inline.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -34,7 +34,7 @@
 
 inline oop ClassLoaderData::class_loader() const {
   assert(!_unloading, "This oop is not available to unloading class loader data");
-  assert(_holder.is_null() || _holder.peek() != NULL , "This class loader data holder must be alive");
+  assert(_holder.is_null() || holder_no_keepalive() != NULL , "This class loader data holder must be alive");
   return _class_loader.resolve();
 }
 
@@ -46,7 +46,7 @@
   if (loader == NULL) {
     return ClassLoaderData::the_null_class_loader_data();
   }
-  return java_lang_ClassLoader::loader_data(loader);
+  return java_lang_ClassLoader::loader_data_acquire(loader);
 }
 
 inline ClassLoaderData* ClassLoaderData::class_loader_data(oop loader) {
@@ -60,7 +60,7 @@
   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(loader());
+  ClassLoaderData* loader_data= java_lang_ClassLoader::loader_data_acquire(loader());
   if (loader_data) {
      return loader_data;
   }
--- a/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -470,7 +470,7 @@
   void do_cld (ClassLoaderData* cld) {
 
     // We do not display unloading loaders, for now.
-    if (cld->is_unloading()) {
+    if (!cld->is_alive()) {
       return;
     }
 
--- a/src/hotspot/share/classfile/classLoaderStats.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderStats.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -139,7 +139,7 @@
 
 
 void ClassLoaderStatsClosure::addEmptyParents(oop cl) {
-  while (cl != NULL && java_lang_ClassLoader::loader_data(cl) == NULL) {
+  while (cl != NULL && java_lang_ClassLoader::loader_data_acquire(cl) == NULL) {
     // This classloader has not loaded any classes
     ClassLoaderStats** cls_ptr = _stats->get(cl);
     if (cls_ptr == NULL) {
--- a/src/hotspot/share/classfile/compactHashtable.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/compactHashtable.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -282,7 +282,7 @@
   CompactHashtable_OopIterator(OopClosure *cl) : _closure(cl) {}
   inline void do_value(address base_address, u4 offset) const {
     narrowOop v = (narrowOop)offset;
-    oop obj = HeapShared::decode_with_archived_oop_encoding_mode(v);
+    oop obj = HeapShared::decode_from_archive(v);
     _closure->do_oop(&obj);
   }
 };
--- a/src/hotspot/share/classfile/compactHashtable.inline.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/compactHashtable.inline.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -48,7 +48,7 @@
 inline oop CompactHashtable<T, N>::decode_entry(CompactHashtable<oop, char>* const t,
                                                 u4 offset, const char* name, int len) {
   narrowOop v = (narrowOop)offset;
-  oop string = HeapShared::decode_with_archived_oop_encoding_mode(v);
+  oop string = HeapShared::decode_from_archive(v);
   if (java_lang_String::equals(string, (jchar*)name, len)) {
     return string;
   }
--- a/src/hotspot/share/classfile/javaClasses.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -4027,9 +4027,9 @@
 int  java_lang_ClassLoader::nameAndId_offset = -1;
 int  java_lang_ClassLoader::unnamedModule_offset = -1;
 
-ClassLoaderData* java_lang_ClassLoader::loader_data(oop loader) {
+ClassLoaderData* java_lang_ClassLoader::loader_data_acquire(oop loader) {
   assert(loader != NULL && oopDesc::is_oop(loader), "loader must be oop");
-  return HeapAccess<>::load_at(loader, _loader_data_offset);
+  return HeapAccess<MO_ACQUIRE>::load_at(loader, _loader_data_offset);
 }
 
 ClassLoaderData* java_lang_ClassLoader::loader_data_raw(oop loader) {
@@ -4037,9 +4037,9 @@
   return RawAccess<>::load_at(loader, _loader_data_offset);
 }
 
-ClassLoaderData* java_lang_ClassLoader::cmpxchg_loader_data(ClassLoaderData* new_data, oop loader, ClassLoaderData* expected_data) {
+void java_lang_ClassLoader::release_set_loader_data(oop loader, ClassLoaderData* new_data) {
   assert(loader != NULL && oopDesc::is_oop(loader), "loader must be oop");
-  return HeapAccess<>::atomic_cmpxchg_at(new_data, loader, _loader_data_offset, expected_data);
+  HeapAccess<MO_RELEASE>::store_at(loader, _loader_data_offset, new_data);
 }
 
 #define CLASSLOADER_FIELDS_DO(macro) \
--- a/src/hotspot/share/classfile/javaClasses.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1322,9 +1322,9 @@
   static void compute_offsets();
   static void serialize_offsets(SerializeClosure* f) NOT_CDS_RETURN;
 
-  static ClassLoaderData* loader_data(oop loader);
+  static ClassLoaderData* loader_data_acquire(oop loader);
   static ClassLoaderData* loader_data_raw(oop loader);
-  static ClassLoaderData* cmpxchg_loader_data(ClassLoaderData* new_data, oop loader, ClassLoaderData* expected_data);
+  static void release_set_loader_data(oop loader, ClassLoaderData* new_data);
 
   static oop parent(oop loader);
   static oop name(oop loader);
--- a/src/hotspot/share/classfile/verifier.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/verifier.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -130,7 +130,7 @@
   st->print_cr("End class verification for: %s", klassName);
 }
 
-bool Verifier::verify(InstanceKlass* klass, Verifier::Mode mode, bool should_verify_class, TRAPS) {
+bool Verifier::verify(InstanceKlass* klass, bool should_verify_class, TRAPS) {
   HandleMark hm(THREAD);
   ResourceMark rm(THREAD);
 
--- a/src/hotspot/share/classfile/verifier.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/classfile/verifier.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -42,16 +42,11 @@
     NO_RELAX_ACCESS_CTRL_CHECK_VERSION  = 52,
     DYNAMICCONSTANT_MAJOR_VERSION       = 55
   };
-  typedef enum { ThrowException, NoException } Mode;
 
-  /**
-   * Verify the bytecodes for a class.  If 'throw_exception' is true
-   * then the appropriate VerifyError or ClassFormatError will be thrown.
-   * Otherwise, no exception is thrown and the return indicates the
-   * error.
-   */
+  // Verify the bytecodes for a class.
+  static bool verify(InstanceKlass* klass, bool should_verify_class, TRAPS);
+
   static void log_end_verification(outputStream* st, const char* klassName, Symbol* exception_name, TRAPS);
-  static bool verify(InstanceKlass* klass, Mode mode, bool should_verify_class, TRAPS);
 
   // Return false if the class is loaded by the bootstrap loader,
   // or if defineClass was called requesting skipping verification
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1950,12 +1950,8 @@
 };
 
 size_t G1CollectedHeap::recalculate_used() const {
-  double recalculate_used_start = os::elapsedTime();
-
   SumUsedClosure blk;
   heap_region_iterate(&blk);
-
-  g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
   return blk.result();
 }
 
@@ -3013,7 +3009,10 @@
         g1_policy()->phase_times()->record_start_new_cset_time_ms((os::elapsedTime() - start) * 1000.0);
 
         if (evacuation_failed()) {
+          double recalculate_used_start = os::elapsedTime();
           set_used(recalculate_used());
+          g1_policy()->phase_times()->record_evac_fail_recalc_used_time((os::elapsedTime() - recalculate_used_start) * 1000.0);
+
           if (_archive_allocator != NULL) {
             _archive_allocator->clear_used();
           }
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1385,11 +1385,7 @@
   void print_cset_rsets() PRODUCT_RETURN;
   void print_all_rsets() PRODUCT_RETURN;
 
-public:
   size_t pending_card_num();
-
-private:
-  size_t _max_heap_capacity;
 };
 
 class G1ParEvacuateFollowersClosure : public VoidClosure {
--- a/src/hotspot/share/gc/g1/g1OopClosures.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1OopClosures.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -54,8 +54,8 @@
   template <class T>
   inline void handle_non_cset_obj_common(InCSetState const state, T* p, oop const obj);
 public:
-  // This closure needs special handling for InstanceRefKlass.
-  virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERED_AND_DISCOVERY; }
+  virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
+
   void set_region(HeapRegion* from) { _from = from; }
 
   inline void trim_queue_partially();
@@ -98,6 +98,9 @@
   virtual void do_oop(oop* p)          { do_oop_work(p); }
   virtual void do_oop(narrowOop* p)    { do_oop_work(p); }
 
+  // We need to do reference discovery while processing evacuated objects.
+  virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERED_AND_DISCOVERY; }
+
   void set_ref_discoverer(ReferenceDiscoverer* rd) {
     set_ref_discoverer_internal(rd);
   }
@@ -201,8 +204,7 @@
     _worker_i(worker_i) {
   }
 
-  // This closure needs special handling for InstanceRefKlass.
-  virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERED_AND_DISCOVERY; }
+  virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
 
   template <class T> void do_oop_work(T* p);
   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
@@ -219,8 +221,8 @@
   template <class T> void do_oop_work(T* p);
   virtual void do_oop(oop* p)       { do_oop_work(p); }
   virtual void do_oop(narrowOop* p) { do_oop_work(p); }
-  // This closure needs special handling for InstanceRefKlass.
-  virtual ReferenceIterationMode reference_iteration_mode() { return DO_DISCOVERED_AND_DISCOVERY; }
+
+  virtual ReferenceIterationMode reference_iteration_mode() { return DO_FIELDS; }
 };
 
 #endif // SHARE_VM_GC_G1_G1OOPCLOSURES_HPP
--- a/src/hotspot/share/gc/parallel/psCompactionManager.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/parallel/psCompactionManager.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -183,7 +183,7 @@
 void InstanceClassLoaderKlass::oop_pc_follow_contents(oop obj, ParCompactionManager* cm) {
   InstanceKlass::oop_pc_follow_contents(obj, cm);
 
-  ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data(obj);
+  ClassLoaderData * const loader_data = java_lang_ClassLoader::loader_data_acquire(obj);
   if (loader_data != NULL) {
     cm->follow_class_loader(loader_data);
   }
--- a/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -190,6 +190,8 @@
 
   virtual void clone(GraphKit* kit, Node* src, Node* dst, Node* size, bool is_array) const;
 
+  virtual Node* resolve(GraphKit* kit, Node* n, DecoratorSet decorators) const { return n; }
+
   // These are general helper methods used by C2
   virtual bool array_copy_requires_gc_barriers(BasicType type) const { return false; }
 
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -506,12 +506,13 @@
 }
 
 void CollectedHeap::resize_all_tlabs() {
-  if (UseTLAB) {
-    assert(SafepointSynchronize::is_at_safepoint() ||
-         !is_init_completed(),
-         "should only resize tlabs at safepoint");
+  assert(SafepointSynchronize::is_at_safepoint() || !is_init_completed(),
+         "Should only resize tlabs at safepoint");
 
-    ThreadLocalAllocBuffer::resize_all_tlabs();
+  if (UseTLAB && ResizeTLAB) {
+    for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
+      thread->tlab().resize();
+    }
   }
 }
 
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -429,20 +429,20 @@
           // Failed to make new block, no other thread made a block
           // available while the mutex was released, and didn't get
           // one from a deferred update either, so return failure.
-          log_info(oopstorage, ref)("%s: failed block allocation", name());
+          log_debug(oopstorage, blocks)("%s: failed block allocation", name());
           return NULL;
         }
       }
     } else {
       // Add new block to storage.
-      log_info(oopstorage, blocks)("%s: new block " PTR_FORMAT, name(), p2i(block));
+      log_debug(oopstorage, blocks)("%s: new block " PTR_FORMAT, name(), p2i(block));
 
       // Add new block to the _active_array, growing if needed.
       if (!_active_array->push(block)) {
         if (expand_active_array()) {
           guarantee(_active_array->push(block), "push failed after expansion");
         } else {
-          log_info(oopstorage, blocks)("%s: failed active array expand", name());
+          log_debug(oopstorage, blocks)("%s: failed active array expand", name());
           Block::delete_block(*block);
           return NULL;
         }
@@ -472,7 +472,7 @@
     log_debug(oopstorage, blocks)("%s: block full " PTR_FORMAT, name(), p2i(block));
     _allocation_list.unlink(*block);
   }
-  log_info(oopstorage, ref)("%s: allocated " PTR_FORMAT, name(), p2i(result));
+  log_trace(oopstorage, ref)("%s: allocated " PTR_FORMAT, name(), p2i(result));
   return result;
 }
 
@@ -484,8 +484,8 @@
   assert_lock_strong(_allocation_mutex);
   ActiveArray* old_array = _active_array;
   size_t new_size = 2 * old_array->size();
-  log_info(oopstorage, blocks)("%s: expand active array " SIZE_FORMAT,
-                               name(), new_size);
+  log_debug(oopstorage, blocks)("%s: expand active array " SIZE_FORMAT,
+                                name(), new_size);
   ActiveArray* new_array = ActiveArray::create(new_size, AllocFailStrategy::RETURN_NULL);
   if (new_array == NULL) return false;
   new_array->copy_from(old_array);
@@ -676,7 +676,7 @@
   check_release_entry(ptr);
   Block* block = find_block_or_null(ptr);
   assert(block != NULL, "%s: invalid release " PTR_FORMAT, name(), p2i(ptr));
-  log_info(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptr));
+  log_trace(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptr));
   block->release_entries(block->bitmask_for_entry(ptr), &_deferred_updates);
   Atomic::dec(&_allocation_count);
 }
@@ -687,7 +687,7 @@
     check_release_entry(ptrs[i]);
     Block* block = find_block_or_null(ptrs[i]);
     assert(block != NULL, "%s: invalid release " PTR_FORMAT, name(), p2i(ptrs[i]));
-    log_info(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptrs[i]));
+    log_trace(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(ptrs[i]));
     size_t count = 0;
     uintx releasing = 0;
     for ( ; i < size; ++i) {
@@ -696,7 +696,7 @@
       // If entry not in block, finish block and resume outer loop with entry.
       if (!block->contains(entry)) break;
       // Add entry to releasing bitmap.
-      log_info(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(entry));
+      log_trace(oopstorage, ref)("%s: released " PTR_FORMAT, name(), p2i(entry));
       uintx entry_bitmask = block->bitmask_for_entry(entry);
       assert((releasing & entry_bitmask) == 0,
              "Duplicate entry: " PTR_FORMAT, p2i(entry));
@@ -740,7 +740,7 @@
 
 void OopStorage::delete_empty_block(const Block& block) {
   assert(block.is_empty(), "discarding non-empty block");
-  log_info(oopstorage, blocks)("%s: delete empty block " PTR_FORMAT, name(), p2i(&block));
+  log_debug(oopstorage, blocks)("%s: delete empty block " PTR_FORMAT, name(), p2i(&block));
   Block::delete_block(block);
 }
 
@@ -933,11 +933,11 @@
 }
 
 bool OopStorage::BasicParState::finish_iteration(const IterationData* data) const {
-  log_debug(oopstorage, blocks, stats)
-           ("Parallel iteration on %s: blocks = " SIZE_FORMAT
-            ", processed = " SIZE_FORMAT " (%2.f%%)",
-            _storage->name(), _block_count, data->_processed,
-            percent_of(data->_processed, _block_count));
+  log_info(oopstorage, blocks, stats)
+          ("Parallel iteration on %s: blocks = " SIZE_FORMAT
+           ", processed = " SIZE_FORMAT " (%2.f%%)",
+           _storage->name(), _block_count, data->_processed,
+           percent_of(data->_processed, _block_count));
   return false;
 }
 
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -69,12 +69,12 @@
 }
 
 void ThreadLocalAllocBuffer::accumulate_statistics() {
-  Thread* thread = myThread();
-  size_t capacity = Universe::heap()->tlab_capacity(thread);
-  size_t used     = Universe::heap()->tlab_used(thread);
+  Thread* thr     = thread();
+  size_t capacity = Universe::heap()->tlab_capacity(thr);
+  size_t used     = Universe::heap()->tlab_used(thr);
 
   _gc_waste += (unsigned)remaining();
-  size_t total_allocated = thread->allocated_bytes();
+  size_t total_allocated = thr->allocated_bytes();
   size_t allocated_since_last_gc = total_allocated - _allocated_before_last_gc;
   _allocated_before_last_gc = total_allocated;
 
@@ -119,7 +119,7 @@
     invariants();
 
     if (retire) {
-      myThread()->incr_allocated_bytes(used_bytes());
+      thread()->incr_allocated_bytes(used_bytes());
     }
 
     Universe::heap()->fill_with_dummy_object(top(), hard_end(), retire && zap);
@@ -138,19 +138,11 @@
          "TLAB must be reset");
 }
 
-void ThreadLocalAllocBuffer::resize_all_tlabs() {
-  if (ResizeTLAB) {
-    for (JavaThreadIteratorWithHandle jtiwh; JavaThread *thread = jtiwh.next(); ) {
-      thread->tlab().resize();
-    }
-  }
-}
-
 void ThreadLocalAllocBuffer::resize() {
   // Compute the next tlab size using expected allocation amount
   assert(ResizeTLAB, "Should not call this otherwise");
   size_t alloc = (size_t)(_allocation_fraction.average() *
-                          (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize));
+                          (Universe::heap()->tlab_capacity(thread()) / HeapWordSize));
   size_t new_size = alloc / _target_refills;
 
   new_size = MIN2(MAX2(new_size, min_size()), max_size());
@@ -159,7 +151,7 @@
 
   log_trace(gc, tlab)("TLAB new size: thread: " INTPTR_FORMAT " [id: %2d]"
                       " refills %d  alloc: %8.6f desired_size: " SIZE_FORMAT " -> " SIZE_FORMAT,
-                      p2i(myThread()), myThread()->osthread()->thread_id(),
+                      p2i(thread()), thread()->osthread()->thread_id(),
                       _target_refills, _allocation_fraction.average(), desired_size(), aligned_new_size);
 
   set_desired_size(aligned_new_size);
@@ -211,7 +203,7 @@
   // thread is initialized before the heap is.  The initialization for
   // this thread is redone in startup_initialization below.
   if (Universe::heap() != NULL) {
-    size_t capacity   = Universe::heap()->tlab_capacity(myThread()) / HeapWordSize;
+    size_t capacity   = Universe::heap()->tlab_capacity(thread()) / HeapWordSize;
     double alloc_frac = desired_size() * target_refills() / (double) capacity;
     _allocation_fraction.sample(alloc_frac);
   }
@@ -274,7 +266,7 @@
     // Initial size is a function of the average number of allocating threads.
     unsigned nof_threads = global_stats()->allocating_threads_avg();
 
-    init_sz  = (Universe::heap()->tlab_capacity(myThread()) / HeapWordSize) /
+    init_sz  = (Universe::heap()->tlab_capacity(thread()) / HeapWordSize) /
                       (nof_threads * target_refills());
     init_sz = align_object_size(init_sz);
   }
@@ -288,7 +280,7 @@
     return;
   }
 
-  Thread* thrd = myThread();
+  Thread* thrd = thread();
   size_t waste = _gc_waste + _slow_refill_waste + _fast_refill_waste;
   double waste_percent = percent_of(waste, _allocated_size);
   size_t tlab_used  = Universe::heap()->tlab_used(thrd);
@@ -322,7 +314,7 @@
 
 void ThreadLocalAllocBuffer::set_sample_end() {
   size_t heap_words_remaining = pointer_delta(_end, _top);
-  size_t bytes_until_sample = myThread()->heap_sampler().bytes_until_sample();
+  size_t bytes_until_sample = thread()->heap_sampler().bytes_until_sample();
   size_t words_until_sample = bytes_until_sample / HeapWordSize;
 
   if (heap_words_remaining > words_until_sample) {
@@ -334,10 +326,8 @@
   }
 }
 
-Thread* ThreadLocalAllocBuffer::myThread() {
-  return (Thread*)(((char *)this) +
-                   in_bytes(start_offset()) -
-                   in_bytes(Thread::tlab_start_offset()));
+Thread* ThreadLocalAllocBuffer::thread() {
+  return (Thread*)(((char*)this) + in_bytes(start_offset()) - in_bytes(Thread::tlab_start_offset()));
 }
 
 void ThreadLocalAllocBuffer::set_back_allocation_end() {
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -92,16 +92,13 @@
   // Make parsable and release it.
   void reset();
 
-  // Resize based on amount of allocation, etc.
-  void resize();
-
   void invariants() const { assert(top() >= start() && top() <= end(), "invalid tlab"); }
 
   void initialize(HeapWord* start, HeapWord* top, HeapWord* end);
 
   void print_stats(const char* tag);
 
-  Thread* myThread();
+  Thread* thread();
 
   // statistics
 
@@ -168,12 +165,12 @@
   // Retire in-use tlab before allocation of a new tlab
   void clear_before_allocation();
 
+  // Resize based on amount of allocation, etc.
+  void resize();
+
   // Accumulate statistics across all tlabs before gc
   static void accumulate_statistics_before_gc();
 
-  // Resize tlabs for all threads
-  static void resize_all_tlabs();
-
   void fill(HeapWord* start, HeapWord* top, size_t new_size);
   void initialize();
 
@@ -192,15 +189,9 @@
 
   // Code generation support
   static ByteSize start_offset()                 { return byte_offset_of(ThreadLocalAllocBuffer, _start); }
-  static ByteSize end_offset()                   { return byte_offset_of(ThreadLocalAllocBuffer, _end  ); }
-  static ByteSize top_offset()                   { return byte_offset_of(ThreadLocalAllocBuffer, _top  ); }
-  static ByteSize pf_top_offset()                { return byte_offset_of(ThreadLocalAllocBuffer, _pf_top  ); }
-  static ByteSize size_offset()                  { return byte_offset_of(ThreadLocalAllocBuffer, _desired_size ); }
-  static ByteSize refill_waste_limit_offset()    { return byte_offset_of(ThreadLocalAllocBuffer, _refill_waste_limit ); }
-
-  static ByteSize number_of_refills_offset()     { return byte_offset_of(ThreadLocalAllocBuffer, _number_of_refills ); }
-  static ByteSize fast_refill_waste_offset()     { return byte_offset_of(ThreadLocalAllocBuffer, _fast_refill_waste ); }
-  static ByteSize slow_allocations_offset()      { return byte_offset_of(ThreadLocalAllocBuffer, _slow_allocations ); }
+  static ByteSize end_offset()                   { return byte_offset_of(ThreadLocalAllocBuffer, _end); }
+  static ByteSize top_offset()                   { return byte_offset_of(ThreadLocalAllocBuffer, _top); }
+  static ByteSize pf_top_offset()                { return byte_offset_of(ThreadLocalAllocBuffer, _pf_top); }
 
   void verify();
 };
--- a/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -57,8 +57,7 @@
   // Compute the size for the new TLAB.
   // The "last" tlab may be smaller to reduce fragmentation.
   // unsafe_max_tlab_alloc is just a hint.
-  const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(myThread()) /
-                                                  HeapWordSize;
+  const size_t available_size = Universe::heap()->unsafe_max_tlab_alloc(thread()) / HeapWordSize;
   size_t new_tlab_size = MIN3(available_size, desired_size() + align_object_size(obj_size), max_size());
 
   // Make sure there's enough room for object and filler int[].
@@ -92,7 +91,7 @@
                               " obj: " SIZE_FORMAT
                               " free: " SIZE_FORMAT
                               " waste: " SIZE_FORMAT,
-                              "slow", p2i(myThread()), myThread()->osthread()->thread_id(),
+                              "slow", p2i(thread()), thread()->osthread()->thread_id(),
                               obj_size, free(), refill_waste_limit());
 }
 
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -252,12 +252,10 @@
     _jfr_weak(this) {
   assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
   ZStatTimer timer(ZSubPhasePauseWeakRootsSetup);
-  StringTable::reset_dead_counter();
 }
 
 ZWeakRootsIterator::~ZWeakRootsIterator() {
   ZStatTimer timer(ZSubPhasePauseWeakRootsTeardown);
-  StringTable::finish_dead_counter();
 }
 
 void ZWeakRootsIterator::do_jvmti_weak_export(BoolObjectClosure* is_alive, OopClosure* cl) {
--- a/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -466,9 +466,9 @@
 
   bool do_entry(oop const& key, ClassLoaderStats* const& cls) {
     const ClassLoaderData* this_cld = cls->_class_loader != NULL ?
-      java_lang_ClassLoader::loader_data(cls->_class_loader) : (ClassLoaderData*)NULL;
+      java_lang_ClassLoader::loader_data_acquire(cls->_class_loader) : NULL;
     const ClassLoaderData* parent_cld = cls->_parent != NULL ?
-      java_lang_ClassLoader::loader_data(cls->_parent) : (ClassLoaderData*)NULL;
+      java_lang_ClassLoader::loader_data_acquire(cls->_parent) : NULL;
     EventClassLoaderStatistics event;
     event.set_classLoader(this_cld);
     event.set_parentClassLoader(parent_cld);
--- a/src/hotspot/share/memory/filemap.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/memory/filemap.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -854,7 +854,7 @@
   if (with_current_oop_encoding_mode) {
     return (address)CompressedOops::decode_not_null(offset_of_space(spc));
   } else {
-    return (address)HeapShared::decode_with_archived_oop_encoding_mode(offset_of_space(spc));
+    return (address)HeapShared::decode_from_archive(offset_of_space(spc));
   }
 }
 
@@ -880,7 +880,7 @@
     CDSFileMapRegion* si = space_at(i);
     size_t size = si->_used;
     if (size > 0) {
-      address s = start_address_with_current_oop_encoding_mode(si);
+      address s = start_address_as_decoded_with_current_oop_encoding_mode(si);
       address e = s + size;
       if (start > s) {
         start = s;
@@ -972,21 +972,20 @@
   HeapShared::init_narrow_oop_decoding(narrow_oop_base() + delta, narrow_oop_shift());
 
   CDSFileMapRegion* si = space_at(MetaspaceShared::first_string);
-  address relocated_strings_bottom = start_address_with_archived_oop_encoding_mode(si);
-  if (!is_aligned(relocated_strings_bottom + delta, HeapRegion::GrainBytes)) {
+  address relocated_strings_bottom = start_address_as_decoded_from_archive(si);
+  if (!is_aligned(relocated_strings_bottom, HeapRegion::GrainBytes)) {
     // Align the bottom of the string regions at G1 region boundary. This will avoid
     // the situation where the highest open region and the lowest string region sharing
     // the same G1 region. Otherwise we will fail to map the open regions.
     size_t align = size_t(relocated_strings_bottom) % HeapRegion::GrainBytes;
     delta -= align;
-    assert(is_aligned(relocated_strings_bottom + delta, HeapRegion::GrainBytes), "must be");
-
     log_info(cds)("CDS heap data need to be relocated lower by a further " SIZE_FORMAT
-                  " bytes to be aligned with HeapRegion::GrainBytes", align);
-
+                  " bytes to " INTX_FORMAT " to be aligned with HeapRegion::GrainBytes", align, delta);
     HeapShared::init_narrow_oop_decoding(narrow_oop_base() + delta, narrow_oop_shift());
     _heap_pointers_need_patching = true;
+    relocated_strings_bottom = start_address_as_decoded_from_archive(si);
   }
+  assert(is_aligned(relocated_strings_bottom, HeapRegion::GrainBytes), "must be");
 
   // First, map string regions as closed archive heap regions.
   // GC does not write into the regions.
@@ -1032,7 +1031,7 @@
     si = space_at(i);
     size_t size = si->_used;
     if (size > 0) {
-      HeapWord* start = (HeapWord*)start_address_with_archived_oop_encoding_mode(si);
+      HeapWord* start = (HeapWord*)start_address_as_decoded_from_archive(si);
       regions[region_num] = MemRegion(start, size / HeapWordSize);
       region_num ++;
       log_info(cds)("Trying to map heap data: region[%d] at " INTPTR_FORMAT ", size = " SIZE_FORMAT_W(8) " bytes",
@@ -1242,7 +1241,7 @@
   if (MetaspaceShared::is_heap_region(idx)) {
     assert(DumpSharedSpaces, "The following doesn't work at runtime");
     return si->_used > 0 ?
-          (char*)start_address_with_current_oop_encoding_mode(si) : NULL;
+          (char*)start_address_as_decoded_with_current_oop_encoding_mode(si) : NULL;
   } else {
     return si->_addr._base;
   }
--- a/src/hotspot/share/memory/filemap.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/memory/filemap.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -335,12 +335,12 @@
   }
 
   // The starting address of spc, as calculated with CompressedOop::decode_non_null()
-  address start_address_with_current_oop_encoding_mode(CDSFileMapRegion* spc) {
+  address start_address_as_decoded_with_current_oop_encoding_mode(CDSFileMapRegion* spc) {
     return decode_start_address(spc, true);
   }
 
-  // The starting address of spc, as calculated with HeapShared::decode_with_archived_oop_encoding_mode()
-  address start_address_with_archived_oop_encoding_mode(CDSFileMapRegion* spc) {
+  // The starting address of spc, as calculated with HeapShared::decode_from_archive()
+  address start_address_as_decoded_from_archive(CDSFileMapRegion* spc) {
     return decode_start_address(spc, false);
   }
 
--- a/src/hotspot/share/memory/heapShared.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/memory/heapShared.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -45,8 +45,6 @@
 int HeapShared::_num_archived_subgraph_info_records = 0;
 Array<ArchivedKlassSubGraphInfoRecord>* HeapShared::_archived_subgraph_info_records = NULL;
 
-// Currently there is only one class mirror (ArchivedModuleGraph) with archived
-// sub-graphs.
 KlassSubGraphInfo* HeapShared::find_subgraph_info(Klass* k) {
   KlassSubGraphInfo* info = _subgraph_info_list;
   while (info != NULL) {
@@ -145,6 +143,13 @@
     return;
   }
 
+  if (log_is_enabled(Debug, cds, heap)) {
+    if (!_subgraph_object_klasses->contains(relocated_k)) {
+      ResourceMark rm;
+      log_debug(cds, heap)("Adding klass %s", orig_k->external_name());
+    }
+  }
+
   _subgraph_object_klasses->append_if_missing(relocated_k);
 }
 
@@ -153,7 +158,7 @@
   _k = info->klass();
   _next = NULL;
   _entry_field_records = NULL;
-  _subgraph_klasses = NULL;
+  _subgraph_object_klasses = NULL;
 
   // populate the entry fields
   GrowableArray<juint>* entry_fields = info->subgraph_entry_fields();
@@ -168,20 +173,20 @@
   }
 
   // the Klasses of the objects in the sub-graphs
-  GrowableArray<Klass*>* subgraph_klasses = info->subgraph_object_klasses();
-  if (subgraph_klasses != NULL) {
-    int num_subgraphs_klasses = subgraph_klasses->length();
-    _subgraph_klasses =
+  GrowableArray<Klass*>* subgraph_object_klasses = info->subgraph_object_klasses();
+  if (subgraph_object_klasses != NULL) {
+    int num_subgraphs_klasses = subgraph_object_klasses->length();
+    _subgraph_object_klasses =
       MetaspaceShared::new_ro_array<Klass*>(num_subgraphs_klasses);
     for (int i = 0; i < num_subgraphs_klasses; i++) {
-      Klass* subgraph_k = subgraph_klasses->at(i);
+      Klass* subgraph_k = subgraph_object_klasses->at(i);
       if (log_is_enabled(Info, cds, heap)) {
         ResourceMark rm;
         log_info(cds, heap)(
-          "Archived object klass (%d): %s in %s sub-graphs",
-          i, subgraph_k->external_name(), _k->external_name());
+          "Archived object klass %s (%2d) => %s",
+          _k->external_name(), i, subgraph_k->external_name());
       }
-      _subgraph_klasses->at_put(i, subgraph_k);
+      _subgraph_object_klasses->at_put(i, subgraph_k);
     }
   }
 }
@@ -194,8 +199,7 @@
 // - A list of klasses that need to be loaded/initialized before archived
 //   java object sub-graph can be accessed at runtime.
 //
-// The records are saved in the archive file and reloaded at runtime. Currently
-// there is only one class mirror (ArchivedModuleGraph) with archived sub-graphs.
+// The records are saved in the archive file and reloaded at runtime.
 //
 // Layout of the archived subgraph info records:
 //
@@ -273,9 +277,8 @@
     return; // no subgraph info records
   }
 
-  // Initialize from archived data. Currently only ArchivedModuleGraph
-  // has archived object subgraphs, which is used during VM initialization
-  // time when bootstraping the system modules. No lock is needed.
+  // Initialize from archived data. Currently this is done only
+  // during VM initialization time. No lock is needed.
   Thread* THREAD = Thread::current();
   for (int i = 0; i < _archived_subgraph_info_records->length(); i++) {
     ArchivedKlassSubGraphInfoRecord* record = _archived_subgraph_info_records->adr_at(i);
@@ -284,7 +287,7 @@
       // Found the archived subgraph info record for the requesting klass.
       // Load/link/initialize the klasses of the objects in the subgraph.
       // NULL class loader is used.
-      Array<Klass*>* klasses = record->subgraph_klasses();
+      Array<Klass*>* klasses = record->subgraph_object_klasses();
       if (klasses != NULL) {
         for (i = 0; i < klasses->length(); i++) {
           Klass* obj_k = klasses->at(i);
@@ -339,15 +342,19 @@
 
 class WalkOopAndArchiveClosure: public BasicOopIterateClosure {
   int _level;
+  bool _record_klasses_only;
   KlassSubGraphInfo* _subgraph_info;
   oop _orig_referencing_obj;
   oop _archived_referencing_obj;
+  Thread* _thread;
  public:
-  WalkOopAndArchiveClosure(int level, KlassSubGraphInfo* subgraph_info,
-           oop orig, oop archived) : _level(level),
-                                     _subgraph_info(subgraph_info),
-                                     _orig_referencing_obj(orig),
-                                     _archived_referencing_obj(archived) {}
+  WalkOopAndArchiveClosure(int level, bool record_klasses_only,
+                           KlassSubGraphInfo* subgraph_info,
+                           oop orig, oop archived, TRAPS) :
+    _level(level), _record_klasses_only(record_klasses_only),
+    _subgraph_info(subgraph_info),
+    _orig_referencing_obj(orig), _archived_referencing_obj(archived),
+    _thread(THREAD) {}
   void do_oop(narrowOop *p) { WalkOopAndArchiveClosure::do_oop_work(p); }
   void do_oop(      oop *p) { WalkOopAndArchiveClosure::do_oop_work(p); }
 
@@ -355,89 +362,105 @@
   template <class T> void do_oop_work(T *p) {
     oop obj = RawAccess<>::oop_load(p);
     if (!CompressedOops::is_null(obj)) {
-      // A java.lang.Class instance can not be included in an archived
-      // object sub-graph.
-      if (java_lang_Class::is_instance(obj)) {
-        log_error(cds, heap)("Unknown java.lang.Class object is in the archived sub-graph\n");
-        vm_exit(1);
-      }
+      assert(!MetaspaceShared::is_archive_object(obj),
+             "original objects must not point to archived objects");
 
-      LogTarget(Debug, cds, heap) log;
-      LogStream ls(log);
-      outputStream* out = &ls;
-      {
+      size_t field_delta = pointer_delta(p, _orig_referencing_obj, sizeof(char));
+      T* new_p = (T*)(address(_archived_referencing_obj) + field_delta);
+      Thread* THREAD = _thread;
+
+      if (!_record_klasses_only && log_is_enabled(Debug, cds, heap)) {
         ResourceMark rm;
-        log.print("(%d) %s <--- referenced from:  %s",
-                  _level, obj->klass()->external_name(),
-                  CompressedOops::is_null(_orig_referencing_obj) ?
-                         "" : _orig_referencing_obj->klass()->external_name());
-        obj->print_on(out);
-      }
-
-      if (MetaspaceShared::is_archive_object(obj)) {
-        // The current oop is an archived oop, nothing needs to be done
-        log.print("--- object is already archived ---");
-        return;
+        log_debug(cds, heap)("(%d) %s[" SIZE_FORMAT "] ==> " PTR_FORMAT " size %d %s", _level,
+                             _orig_referencing_obj->klass()->external_name(), field_delta,
+                             p2i(obj), obj->size() * HeapWordSize, obj->klass()->external_name());
+        LogTarget(Trace, cds, heap) log;
+        LogStream out(log);
+        obj->print_on(&out);
       }
 
-      size_t field_delta = pointer_delta(
-        p, _orig_referencing_obj, sizeof(char));
-      T* new_p = (T*)(address(_archived_referencing_obj) + field_delta);
-      oop archived = MetaspaceShared::find_archived_heap_object(obj);
-      if (archived != NULL) {
-        // There is an archived copy existing, update reference to point
-        // to the archived copy
-        RawAccess<IS_NOT_NULL>::oop_store(new_p, archived);
-        log.print(
-          "--- found existing archived copy, store archived " PTR_FORMAT " in " PTR_FORMAT,
-          p2i(archived), p2i(new_p));
-        return;
-      }
+      oop archived = HeapShared::archive_reachable_objects_from(_level + 1, _subgraph_info, obj, THREAD);
+      assert(archived != NULL, "VM should have exited with unarchivable objects for _level > 1");
+      assert(MetaspaceShared::is_archive_object(archived), "must be");
 
-      int l = _level + 1;
-      Thread* THREAD = Thread::current();
-      // Archive the current oop before iterating through its references
-      archived = MetaspaceShared::archive_heap_object(obj, THREAD);
-      if (archived == NULL) {
-        ResourceMark rm;
-        LogTarget(Error, cds, heap) log_err;
-        LogStream ls_err(log_err);
-        outputStream* out_err = &ls_err;
-        log_err.print("Failed to archive %s object ("
-                      PTR_FORMAT "), size[" SIZE_FORMAT "] in sub-graph",
-                      obj->klass()->external_name(), p2i(obj), (size_t)obj->size());
-        obj->print_on(out_err);
-        vm_exit(1);
+      if (!_record_klasses_only) {
+        // Update the reference in the archived copy of the referencing object.
+        log_debug(cds, heap)("(%d) updating oop @[" PTR_FORMAT "] " PTR_FORMAT " ==> " PTR_FORMAT,
+                             _level, p2i(new_p), p2i(obj), p2i(archived));
+        RawAccess<IS_NOT_NULL>::oop_store(new_p, archived);
       }
-      assert(MetaspaceShared::is_archive_object(archived), "must be archived");
-      log.print("=== archiving oop " PTR_FORMAT " ==> " PTR_FORMAT,
-                 p2i(obj), p2i(archived));
-
-      // Following the references in the current oop and archive any
-      // encountered objects during the process
-      WalkOopAndArchiveClosure walker(l, _subgraph_info, obj, archived);
-      obj->oop_iterate(&walker);
-
-      // Update the reference in the archived copy of the referencing object
-      RawAccess<IS_NOT_NULL>::oop_store(new_p, archived);
-      log.print("=== store archived " PTR_FORMAT " in " PTR_FORMAT,
-                p2i(archived), p2i(new_p));
-
-      // Add the klass to the list of classes that need to be loaded before
-      // module system initialization
-      Klass *orig_k = obj->klass();
-      Klass *relocated_k = archived->klass();
-      _subgraph_info->add_subgraph_object_klass(orig_k, relocated_k);
     }
   }
 };
 
+// (1) If orig_obj has not been archived yet, archive it.
+// (2) If orig_obj has not been seen yet (since start_recording_subgraph() was called),
+//     trace all  objects that are reachable from it, and make sure these objects are archived.
+// (3) Record the klasses of all orig_obj and all reachable objects.
+oop HeapShared::archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS) {
+  assert(orig_obj != NULL, "must be");
+  assert(!MetaspaceShared::is_archive_object(orig_obj), "sanity");
+
+  // java.lang.Class instances cannot be included in an archived
+  // object sub-graph.
+  if (java_lang_Class::is_instance(orig_obj)) {
+    log_error(cds, heap)("(%d) Unknown java.lang.Class object is in the archived sub-graph", level);
+    vm_exit(1);
+  }
+
+  oop archived_obj = MetaspaceShared::find_archived_heap_object(orig_obj);
+  if (java_lang_String::is_instance(orig_obj) && archived_obj != NULL) {
+    // To save time, don't walk strings that are already archived. They just contain
+    // pointers to a type array, whose klass doesn't need to be recorded.
+    return archived_obj;
+  }
+
+  if (has_been_seen_during_subgraph_recording(orig_obj)) {
+    // orig_obj has already been archived and traced. Nothing more to do.
+    return archived_obj;
+  } else {
+    set_has_been_seen_during_subgraph_recording(orig_obj);
+  }
+
+  bool record_klasses_only = (archived_obj != NULL);
+  if (archived_obj == NULL) {
+    ++_num_new_archived_objs;
+    archived_obj = MetaspaceShared::archive_heap_object(orig_obj, THREAD);
+    if (archived_obj == NULL) {
+      // Skip archiving the sub-graph referenced from the current entry field.
+      ResourceMark rm;
+      log_error(cds, heap)(
+        "Cannot archive the sub-graph referenced from %s object ("
+        PTR_FORMAT ") size %d, skipped.",
+        orig_obj->klass()->external_name(), p2i(orig_obj), orig_obj->size() * HeapWordSize);
+      if (level == 1) {
+        // Don't archive a subgraph root that's too big. For archives static fields, that's OK
+        // as the Java code will take care of initializing this field dynamically.
+        return NULL;
+      } else {
+        // We don't know how to handle an object that has been archived, but some of its reachable
+        // objects cannot be archived. Bail out for now. We might need to fix this in the future if
+        // we have a real use case.
+        vm_exit(1);
+      }
+    }
+  }
+
+  assert(archived_obj != NULL, "must be");
+  Klass *orig_k = orig_obj->klass();
+  Klass *relocated_k = archived_obj->klass();
+  subgraph_info->add_subgraph_object_klass(orig_k, relocated_k);
+
+  WalkOopAndArchiveClosure walker(level, record_klasses_only, subgraph_info, orig_obj, archived_obj, THREAD);
+  orig_obj->oop_iterate(&walker);
+  return archived_obj;
+}
+
 //
 // Start from the given static field in a java mirror and archive the
 // complete sub-graph of java heap objects that are reached directly
 // or indirectly from the starting object by following references.
-// Currently, only ArchivedModuleGraph class instance (mirror) has archived
-// object subgraphs. Sub-graph archiving restrictions (current):
+// Sub-graph archiving restrictions (current):
 //
 // - All classes of objects in the archived sub-graph (including the
 //   entry class) must be boot class only.
@@ -461,20 +484,19 @@
 // archive the sub-graph of objects starting from each reference.
 //
 // 4) Updates the pointer in the archived copy of referencing object to
-//    point to the current archived object.
+// point to the current archived object.
 //
 // 5) The Klass of the current java object is added to the list of Klasses
 // for loading and initialzing before any object in the archived graph can
 // be accessed at runtime.
 //
-void HeapShared::archive_reachable_objects_from_static_field(Klass *k,
+void HeapShared::archive_reachable_objects_from_static_field(InstanceKlass *k,
+                                                             const char* klass_name,
                                                              int field_offset,
-                                                             BasicType field_type,
+                                                             const char* field_name,
                                                              TRAPS) {
   assert(DumpSharedSpaces, "dump time only");
-  assert(k->is_instance_klass(), "sanity");
-  assert(InstanceKlass::cast(k)->is_shared_boot_class(),
-         "must be boot class");
+  assert(k->is_shared_boot_class(), "must be boot class");
 
   oop m = k->java_mirror();
   oop archived_m = MetaspaceShared::find_archived_heap_object(m);
@@ -482,58 +504,160 @@
     return;
   }
 
-  if (field_type == T_OBJECT || field_type == T_ARRAY) {
-    // obtain k's subGraph Info
-    KlassSubGraphInfo* subgraph_info = get_subgraph_info(k);
+  KlassSubGraphInfo* subgraph_info = get_subgraph_info(k);
+  oop f = m->obj_field(field_offset);
 
-    // get the object referenced by the field
-    oop f = m->obj_field(field_offset);
-    if (!CompressedOops::is_null(f)) {
-      LogTarget(Debug, cds, heap) log;
-      LogStream ls(log);
-      outputStream* out = &ls;
-      log.print("Start from: ");
-      f->print_on(out);
+  log_debug(cds, heap)("Start archiving from: %s::%s (" PTR_FORMAT ")", klass_name, field_name, p2i(f));
 
-      // get the archived copy of the field referenced object
-      oop af = MetaspaceShared::archive_heap_object(f, THREAD);
-      if (af == NULL) {
-        // Skip archiving the sub-graph referenced from the current entry field.
-        ResourceMark rm;
-        log_info(cds, heap)(
-          "Cannot archive the sub-graph referenced from %s object ("
-          PTR_FORMAT ") size[" SIZE_FORMAT "], skipped.",
-          f->klass()->external_name(), p2i(f), (size_t)f->size());
-        return;
-      }
-      if (!MetaspaceShared::is_archive_object(f)) {
-        WalkOopAndArchiveClosure walker(1, subgraph_info, f, af);
-        f->oop_iterate(&walker);
-      }
+  if (!CompressedOops::is_null(f)) {
+    if (log_is_enabled(Trace, cds, heap)) {
+      LogTarget(Trace, cds, heap) log;
+      LogStream out(log);
+      f->print_on(&out);
+    }
 
-      // The field value is not preserved in the archived mirror.
+    oop af = archive_reachable_objects_from(1, subgraph_info, f, CHECK);
+
+    if (af == NULL) {
+      log_error(cds, heap)("Archiving failed %s::%s (some reachable objects cannot be archived)",
+                           klass_name, field_name);
+    } else {
+      // Note: the field value is not preserved in the archived mirror.
       // Record the field as a new subGraph entry point. The recorded
       // information is restored from the archive at runtime.
       subgraph_info->add_subgraph_entry_field(field_offset, af);
-      Klass *relocated_k = af->klass();
-      Klass *orig_k = f->klass();
-      subgraph_info->add_subgraph_object_klass(orig_k, relocated_k);
-      ResourceMark rm;
-      log_info(cds, heap)(
-          "Archived the sub-graph referenced from %s object " PTR_FORMAT,
-          f->klass()->external_name(), p2i(f));
-    } else {
-      // The field contains null, we still need to record the entry point,
-      // so it can be restored at runtime.
-      subgraph_info->add_subgraph_entry_field(field_offset, NULL);
+      log_info(cds, heap)("Archived field %s::%s => " PTR_FORMAT, klass_name, field_name, p2i(af));
     }
   } else {
-    ShouldNotReachHere();
+    // The field contains null, we still need to record the entry point,
+    // so it can be restored at runtime.
+    subgraph_info->add_subgraph_entry_field(field_offset, NULL);
+  }
+}
+
+#ifndef PRODUCT
+class VerifySharedOopClosure: public BasicOopIterateClosure {
+ private:
+  bool _is_archived;
+
+ public:
+  VerifySharedOopClosure(bool is_archived) : _is_archived(is_archived) {}
+
+  void do_oop(narrowOop *p) { VerifySharedOopClosure::do_oop_work(p); }
+  void do_oop(      oop *p) { VerifySharedOopClosure::do_oop_work(p); }
+
+ protected:
+  template <class T> void do_oop_work(T *p) {
+    oop obj = RawAccess<>::oop_load(p);
+    if (!CompressedOops::is_null(obj)) {
+      HeapShared::verify_reachable_objects_from(obj, _is_archived);
+    }
+  }
+};
+
+void HeapShared::verify_subgraph_from_static_field(InstanceKlass* k, int field_offset) {
+  assert(DumpSharedSpaces, "dump time only");
+  assert(k->is_shared_boot_class(), "must be boot class");
+
+  oop m = k->java_mirror();
+  oop archived_m = MetaspaceShared::find_archived_heap_object(m);
+  if (CompressedOops::is_null(archived_m)) {
+    return;
+  }
+  oop f = m->obj_field(field_offset);
+  if (!CompressedOops::is_null(f)) {
+    verify_subgraph_from(f);
   }
 }
 
+void HeapShared::verify_subgraph_from(oop orig_obj) {
+  oop archived_obj = MetaspaceShared::find_archived_heap_object(orig_obj);
+  if (archived_obj == NULL) {
+    // It's OK for the root of a subgraph to be not archived. See comments in
+    // archive_reachable_objects_from().
+    return;
+  }
+
+  // Verify that all objects reachable from orig_obj are archived.
+  init_seen_objects_table();
+  verify_reachable_objects_from(orig_obj, false);
+  delete_seen_objects_table();
+
+  // Note: we could also verify that all objects reachable from the archived
+  // copy of orig_obj can only point to archived objects, with:
+  //      init_seen_objects_table();
+  //      verify_reachable_objects_from(archived_obj, true);
+  //      init_seen_objects_table();
+  // but that's already done in G1HeapVerifier::verify_archive_regions so we
+  // won't do it here.
+}
+
+void HeapShared::verify_reachable_objects_from(oop obj, bool is_archived) {
+  _num_total_verifications ++;
+  if (!has_been_seen_during_subgraph_recording(obj)) {
+    set_has_been_seen_during_subgraph_recording(obj);
+
+    if (is_archived) {
+      assert(MetaspaceShared::is_archive_object(obj), "must be");
+      assert(MetaspaceShared::find_archived_heap_object(obj) == NULL, "must be");
+    } else {
+      assert(!MetaspaceShared::is_archive_object(obj), "must be");
+      assert(MetaspaceShared::find_archived_heap_object(obj) != NULL, "must be");
+    }
+
+    VerifySharedOopClosure walker(is_archived);
+    obj->oop_iterate(&walker);
+  }
+}
+#endif
+
+HeapShared::SeenObjectsTable* HeapShared::_seen_objects_table = NULL;
+int HeapShared::_num_new_walked_objs;
+int HeapShared::_num_new_archived_objs;
+int HeapShared::_num_old_recorded_klasses;
+
+int HeapShared::_num_total_subgraph_recordings = 0;
+int HeapShared::_num_total_walked_objs = 0;
+int HeapShared::_num_total_archived_objs = 0;
+int HeapShared::_num_total_recorded_klasses = 0;
+int HeapShared::_num_total_verifications = 0;
+
+bool HeapShared::has_been_seen_during_subgraph_recording(oop obj) {
+  return _seen_objects_table->get(obj) != NULL;
+}
+
+void HeapShared::set_has_been_seen_during_subgraph_recording(oop obj) {
+  assert(!has_been_seen_during_subgraph_recording(obj), "sanity");
+  _seen_objects_table->put(obj, true);
+  ++ _num_new_walked_objs;
+}
+
+void HeapShared::start_recording_subgraph(InstanceKlass *k, const char* class_name) {
+  log_info(cds, heap)("Start recording subgraph(s) for archived fields in %s", class_name);
+  init_seen_objects_table();
+  _num_new_walked_objs = 0;
+  _num_new_archived_objs = 0;
+  _num_old_recorded_klasses = get_subgraph_info(k)->num_subgraph_object_klasses();
+}
+
+void HeapShared::done_recording_subgraph(InstanceKlass *k, const char* class_name) {
+  int num_new_recorded_klasses = get_subgraph_info(k)->num_subgraph_object_klasses() -
+    _num_old_recorded_klasses;
+  log_info(cds, heap)("Done recording subgraph(s) for archived fields in %s: "
+                      "walked %d objs, archived %d new objs, recorded %d classes",
+                      class_name, _num_new_walked_objs, _num_new_archived_objs,
+                      num_new_recorded_klasses);
+
+  delete_seen_objects_table();
+
+  _num_total_subgraph_recordings ++;
+  _num_total_walked_objs      += _num_new_walked_objs;
+  _num_total_archived_objs    += _num_new_archived_objs;
+  _num_total_recorded_klasses +=  num_new_recorded_klasses;
+}
+
 struct ArchivableStaticFieldInfo {
-  const char* class_name;
+  const char* klass_name;
   const char* field_name;
   InstanceKlass* klass;
   int offset;
@@ -553,39 +677,37 @@
   {"java/lang/module/Configuration",           "EMPTY_CONFIGURATION"},
 };
 
-const static int num_archivable_static_fields = sizeof(archivable_static_fields) / sizeof(ArchivableStaticFieldInfo);
+const static int num_archivable_static_fields =
+  sizeof(archivable_static_fields) / sizeof(ArchivableStaticFieldInfo);
 
 class ArchivableStaticFieldFinder: public FieldClosure {
   InstanceKlass* _ik;
   Symbol* _field_name;
   bool _found;
   int _offset;
-  BasicType _type;
 public:
   ArchivableStaticFieldFinder(InstanceKlass* ik, Symbol* field_name) :
-    _ik(ik), _field_name(field_name), _found(false), _offset(-1), _type(T_ILLEGAL) {}
+    _ik(ik), _field_name(field_name), _found(false), _offset(-1) {}
 
   virtual void do_field(fieldDescriptor* fd) {
     if (fd->name() == _field_name) {
       assert(!_found, "fields cannot be overloaded");
+      assert(fd->field_type() == T_OBJECT || fd->field_type() == T_ARRAY, "can archive only obj or array fields");
       _found = true;
       _offset = fd->offset();
-      _type = fd->field_type();
-      assert(_type == T_OBJECT || _type == T_ARRAY, "can archive only obj or array fields");
     }
   }
   bool found()     { return _found;  }
   int offset()     { return _offset; }
-  BasicType type() { return _type;   }
 };
 
 void HeapShared::init_archivable_static_fields(Thread* THREAD) {
   for (int i = 0; i < num_archivable_static_fields; i++) {
     ArchivableStaticFieldInfo* info = &archivable_static_fields[i];
-    TempNewSymbol class_name =  SymbolTable::new_symbol(info->class_name, THREAD);
+    TempNewSymbol klass_name =  SymbolTable::new_symbol(info->klass_name, THREAD);
     TempNewSymbol field_name =  SymbolTable::new_symbol(info->field_name, THREAD);
 
-    Klass* k = SystemDictionary::resolve_or_null(class_name, THREAD);
+    Klass* k = SystemDictionary::resolve_or_null(klass_name, THREAD);
     assert(k != NULL && !HAS_PENDING_EXCEPTION, "class must exist");
     InstanceKlass* ik = InstanceKlass::cast(k);
 
@@ -595,15 +717,50 @@
 
     info->klass = ik;
     info->offset = finder.offset();
-    info->type = finder.type();
   }
 }
 
-void HeapShared::archive_module_graph_objects(Thread* THREAD) {
-  for (int i = 0; i < num_archivable_static_fields; i++) {
+void HeapShared::archive_static_fields(Thread* THREAD) {
+  // For each class X that has one or more archived fields:
+  // [1] Dump the subgraph of each archived field
+  // [2] Create a list of all the class of the objects that can be reached
+  //     by any of these static fields.
+  //     At runtime, these classes are initialized before X's archived fields
+  //     are restored by HeapShared::initialize_from_archived_subgraph().
+  int i;
+  for (i = 0; i < num_archivable_static_fields; ) {
     ArchivableStaticFieldInfo* info = &archivable_static_fields[i];
-    archive_reachable_objects_from_static_field(info->klass, info->offset, info->type, CHECK);
+    const char* klass_name = info->klass_name;
+    start_recording_subgraph(info->klass, klass_name);
+
+    // If you have specified consecutive fields of the same klass in
+    // archivable_static_fields[], these will be archived in the same
+    // {start_recording_subgraph ... done_recording_subgraph} pass to
+    // save time.
+    for (; i < num_archivable_static_fields; i++) {
+      ArchivableStaticFieldInfo* f = &archivable_static_fields[i];
+      if (f->klass_name != klass_name) {
+        break;
+      }
+      archive_reachable_objects_from_static_field(f->klass, f->klass_name,
+                                                  f->offset, f->field_name, CHECK);
+    }
+    done_recording_subgraph(info->klass, klass_name);
   }
+
+  log_info(cds, heap)("Performed subgraph records = %d times", _num_total_subgraph_recordings);
+  log_info(cds, heap)("Walked %d objects", _num_total_walked_objs);
+  log_info(cds, heap)("Archived %d objects", _num_total_archived_objs);
+  log_info(cds, heap)("Recorded %d klasses", _num_total_recorded_klasses);
+
+
+#ifndef PRODUCT
+  for (int i = 0; i < num_archivable_static_fields; i++) {
+    ArchivableStaticFieldInfo* f = &archivable_static_fields[i];
+    verify_subgraph_from_static_field(f->klass, f->offset);
+  }
+  log_info(cds, heap)("Verified %d references", _num_total_verifications);
+#endif
 }
 
 // At dump-time, find the location of all the non-null oop pointers in an archived heap
@@ -677,7 +834,7 @@
     narrowOop* p = _start + offset;
     narrowOop v = *p;
     assert(!CompressedOops::is_null(v), "null oops should have been filtered out at dump time");
-    oop o = HeapShared::decode_with_archived_oop_encoding_mode(v);
+    oop o = HeapShared::decode_from_archive(v);
     RawAccess<IS_NOT_NULL>::oop_store(p, o);
     return true;
   }
--- a/src/hotspot/share/memory/heapShared.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/memory/heapShared.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,12 +26,14 @@
 #define SHARE_VM_MEMORY_HEAPSHARED_HPP
 
 #include "classfile/systemDictionary.hpp"
+#include "memory/allocation.hpp"
 #include "memory/universe.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/oop.hpp"
 #include "oops/typeArrayKlass.hpp"
 #include "utilities/bitMap.hpp"
 #include "utilities/growableArray.hpp"
+#include "utilities/resourceHash.hpp"
 
 #if INCLUDE_CDS_JAVA_HEAP
 // A dump time sub-graph info for Klass _k. It includes the entry points
@@ -74,6 +76,10 @@
   }
   void add_subgraph_entry_field(int static_field_offset, oop v);
   void add_subgraph_object_klass(Klass *orig_k, Klass *relocated_k);
+  int num_subgraph_object_klasses() {
+    return _subgraph_object_klasses == NULL ? 0 :
+           _subgraph_object_klasses->length();
+  }
 };
 
 // An archived record of object sub-graphs reachable from static
@@ -89,20 +95,21 @@
 
   // klasses of objects in archived sub-graphs referenced from the entry points
   // (static fields) in the containing class
-  Array<Klass*>* _subgraph_klasses;
+  Array<Klass*>* _subgraph_object_klasses;
  public:
   ArchivedKlassSubGraphInfoRecord() :
-    _next(NULL), _k(NULL), _entry_field_records(NULL), _subgraph_klasses(NULL) {}
+    _next(NULL), _k(NULL), _entry_field_records(NULL), _subgraph_object_klasses(NULL) {}
   void init(KlassSubGraphInfo* info);
   Klass* klass() { return _k; }
   ArchivedKlassSubGraphInfoRecord* next() { return _next; }
   void set_next(ArchivedKlassSubGraphInfoRecord* next) { _next = next; }
   Array<juint>*  entry_field_records() { return _entry_field_records; }
-  Array<Klass*>* subgraph_klasses() { return _subgraph_klasses; }
+  Array<Klass*>* subgraph_object_klasses() { return _subgraph_object_klasses; }
 };
 #endif // INCLUDE_CDS_JAVA_HEAP
 
 class HeapShared: AllStatic {
+  friend class VerifySharedOopClosure;
  private:
 #if INCLUDE_CDS_JAVA_HEAP
   // This is a list of subgraph infos built at dump time while
@@ -117,7 +124,12 @@
   // Archive object sub-graph starting from the given static field
   // in Klass k's mirror.
   static void archive_reachable_objects_from_static_field(
-    Klass* k, int field_ofset, BasicType field_type, TRAPS);
+    InstanceKlass* k, const char* klass_name,
+    int field_offset, const char* field_name, TRAPS);
+  static void verify_subgraph_from_static_field(
+    InstanceKlass* k, int field_offset) PRODUCT_RETURN;
+
+  static void verify_reachable_objects_from(oop obj, bool is_archived) PRODUCT_RETURN;
 
   static KlassSubGraphInfo* find_subgraph_info(Klass *k);
   static KlassSubGraphInfo* get_subgraph_info(Klass *k);
@@ -125,10 +137,53 @@
 
   static size_t build_archived_subgraph_info_records(int num_records);
 
-  // Used by decode_with_archived_oop_encoding_mode
+  // Used by decode_from_archive
   static address _narrow_oop_base;
   static int     _narrow_oop_shift;
 
+  static bool oop_equals(oop const& p1, oop const& p2) {
+    return primitive_equals<oop>(p1, p2);
+  }
+
+  static unsigned oop_hash(oop const& p) {
+    return primitive_hash<address>((address)p);
+  }
+
+  typedef ResourceHashtable<oop, bool,
+      HeapShared::oop_hash,
+      HeapShared::oop_equals,
+      15889, // prime number
+      ResourceObj::C_HEAP> SeenObjectsTable;
+
+  static SeenObjectsTable *_seen_objects_table;
+
+  static void init_seen_objects_table() {
+    assert(_seen_objects_table == NULL, "must be");
+    _seen_objects_table = new (ResourceObj::C_HEAP, mtClass)SeenObjectsTable();
+  }
+  static void delete_seen_objects_table() {
+    assert(_seen_objects_table != NULL, "must be");
+    delete _seen_objects_table;
+    _seen_objects_table = NULL;
+  }
+
+  // Statistics (for one round of start_recording_subgraph ... done_recording_subgraph)
+  static int _num_new_walked_objs;
+  static int _num_new_archived_objs;
+  static int _num_old_recorded_klasses;
+
+  // Statistics (for all archived subgraphs)
+  static int _num_total_subgraph_recordings;
+  static int _num_total_walked_objs;
+  static int _num_total_archived_objs;
+  static int _num_total_recorded_klasses;
+  static int _num_total_verifications;
+
+  static void start_recording_subgraph(InstanceKlass *k, const char* klass_name);
+  static void done_recording_subgraph(InstanceKlass *k, const char* klass_name);
+
+  static bool has_been_seen_during_subgraph_recording(oop obj);
+  static void set_has_been_seen_during_subgraph_recording(oop obj);
 #endif // INCLUDE_CDS_JAVA_HEAP
  public:
   static char* read_archived_subgraph_infos(char* buffer) NOT_CDS_JAVA_HEAP_RETURN_(buffer);
@@ -139,7 +194,7 @@
   // than Universe::narrow_oop_{base,shift} -- see FileMapInfo::map_heap_regions_impl.
   // To decode them, do not use CompressedOops::decode_not_null. Use this
   // function instead.
-  inline static oop decode_with_archived_oop_encoding_mode(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
+  inline static oop decode_from_archive(narrowOop v) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
 
   static void init_narrow_oop_decoding(address base, int shift) NOT_CDS_JAVA_HEAP_RETURN;
 
@@ -147,10 +202,12 @@
                                                     size_t oopmap_in_bits) NOT_CDS_JAVA_HEAP_RETURN;
 
   static void init_archivable_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
-  static void archive_module_graph_objects(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
+  static void archive_static_fields(Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN;
 
 #if INCLUDE_CDS_JAVA_HEAP
   static ResourceBitMap calculate_oopmap(MemRegion region);
+  static oop archive_reachable_objects_from(int level, KlassSubGraphInfo* subgraph_info, oop orig_obj, TRAPS);
+  static void verify_subgraph_from(oop orig_obj) PRODUCT_RETURN;
 #endif
 };
 #endif // SHARE_VM_MEMORY_HEAPSHARED_HPP
--- a/src/hotspot/share/memory/heapShared.inline.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/memory/heapShared.inline.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,7 +30,7 @@
 
 #if INCLUDE_CDS_JAVA_HEAP
 
-inline oop HeapShared::decode_with_archived_oop_encoding_mode(narrowOop v) {
+inline oop HeapShared::decode_from_archive(narrowOop v) {
   assert(!CompressedOops::is_null(v), "narrow oop value can never be zero");
   oop result = (oop)(void*)((uintptr_t)_narrow_oop_base + ((uintptr_t)v << _narrow_oop_shift));
   assert(check_obj_alignment(result), "address not aligned: " INTPTR_FORMAT, p2i((void*) result));
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1881,7 +1881,7 @@
 
   MetaspaceShared::archive_klass_objects(THREAD);
 
-  HeapShared::archive_module_graph_objects(THREAD);
+  HeapShared::archive_static_fields(THREAD);
 
   G1CollectedHeap::heap()->end_archive_alloc_range(open_archive,
                                                    os::vm_allocation_granularity());
@@ -1944,7 +1944,7 @@
   assert(archive_heap_region_fixed(),
          "must be called after archive heap regions are fixed");
   if (!CompressedOops::is_null(v)) {
-    oop obj = HeapShared::decode_with_archived_oop_encoding_mode(v);
+    oop obj = HeapShared::decode_from_archive(v);
     return G1CollectedHeap::heap()->materialize_archived_object(obj);
   }
   return NULL;
@@ -2021,7 +2021,7 @@
              "Archived heap object is not allowed");
       assert(MetaspaceShared::open_archive_heap_region_mapped(),
              "Open archive heap region is not mapped");
-      *p = HeapShared::decode_with_archived_oop_encoding_mode(o);
+      *p = HeapShared::decode_from_archive(o);
     }
   }
 
--- a/src/hotspot/share/oops/instanceKlass.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -643,7 +643,7 @@
   if (!is_not_initialized()) return;  // note: not equivalent to is_initialized()
 
   ClassState old_state = init_state();
-  link_class_impl(true, THREAD);
+  link_class_impl(THREAD);
   if (HAS_PENDING_EXCEPTION) {
     CLEAR_PENDING_EXCEPTION;
     // Abort if linking the class throws an exception.
@@ -681,11 +681,9 @@
 }
 
 
-bool InstanceKlass::verify_code(bool throw_verifyerror, TRAPS) {
+bool InstanceKlass::verify_code(TRAPS) {
   // 1) Verify the bytecodes
-  Verifier::Mode mode =
-    throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
-  return Verifier::verify(this, mode, should_verify_class(), THREAD);
+  return Verifier::verify(this, should_verify_class(), THREAD);
 }
 
 
@@ -700,7 +698,7 @@
 void InstanceKlass::link_class(TRAPS) {
   assert(is_loaded(), "must be loaded");
   if (!is_linked()) {
-    link_class_impl(true, CHECK);
+    link_class_impl(CHECK);
   }
 }
 
@@ -709,12 +707,12 @@
 bool InstanceKlass::link_class_or_fail(TRAPS) {
   assert(is_loaded(), "must be loaded");
   if (!is_linked()) {
-    link_class_impl(false, CHECK_false);
+    link_class_impl(CHECK_false);
   }
   return is_linked();
 }
 
-bool InstanceKlass::link_class_impl(bool throw_verifyerror, TRAPS) {
+bool InstanceKlass::link_class_impl(TRAPS) {
   if (DumpSharedSpaces && is_in_error_state()) {
     // This is for CDS dumping phase only -- we use the in_error_state to indicate that
     // the class has failed verification. Throwing the NoClassDefFoundError here is just
@@ -756,7 +754,7 @@
     }
 
     InstanceKlass* ik_super = InstanceKlass::cast(super_klass);
-    ik_super->link_class_impl(throw_verifyerror, CHECK_false);
+    ik_super->link_class_impl(CHECK_false);
   }
 
   // link all interfaces implemented by this class before linking this class
@@ -764,7 +762,7 @@
   int num_interfaces = interfaces->length();
   for (int index = 0; index < num_interfaces; index++) {
     InstanceKlass* interk = interfaces->at(index);
-    interk->link_class_impl(throw_verifyerror, CHECK_false);
+    interk->link_class_impl(CHECK_false);
   }
 
   // in case the class is linked in the process of linking its superclasses
@@ -794,7 +792,7 @@
     if (!is_linked()) {
       if (!is_rewritten()) {
         {
-          bool verify_ok = verify_code(throw_verifyerror, THREAD);
+          bool verify_ok = verify_code(THREAD);
           if (!verify_ok) {
             return false;
           }
--- a/src/hotspot/share/oops/instanceKlass.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1285,8 +1285,8 @@
 private:
   void fence_and_clear_init_lock();
 
-  bool link_class_impl                           (bool throw_verifyerror, TRAPS);
-  bool verify_code                               (bool throw_verifyerror, TRAPS);
+  bool link_class_impl                           (TRAPS);
+  bool verify_code                               (TRAPS);
   void initialize_impl                           (TRAPS);
   void initialize_super_interfaces               (TRAPS);
   void eager_initialize_impl                     ();
--- a/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -98,12 +98,14 @@
 
 template <typename T, class OopClosureType, class Contains>
 void InstanceRefKlass::oop_oop_iterate_fields(oop obj, OopClosureType* closure, Contains& contains) {
+  assert(closure->ref_discoverer() == NULL, "ReferenceDiscoverer should not be set");
   do_referent<T>(obj, closure, contains);
   do_discovered<T>(obj, closure, contains);
 }
 
 template <typename T, class OopClosureType, class Contains>
 void InstanceRefKlass::oop_oop_iterate_fields_except_referent(oop obj, OopClosureType* closure, Contains& contains) {
+  assert(closure->ref_discoverer() == NULL, "ReferenceDiscoverer should not be set");
   do_discovered<T>(obj, closure, contains);
 }
 
--- a/src/hotspot/share/oops/klass.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/oops/klass.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -656,8 +656,9 @@
   virtual MetaspaceObj::Type type() const { return ClassType; }
 
   // Iff the class loader (or mirror for unsafe anonymous classes) is alive the
-  // Klass is considered alive.  Has already been marked as unloading.
-  bool is_loader_alive() const { return !class_loader_data()->is_unloading(); }
+  // Klass is considered alive. This is safe to call before the CLD is marked as
+  // unloading, and hence during concurrent class unloading.
+  bool is_loader_alive() const { return class_loader_data()->is_alive(); }
 
   // Load the klass's holder as a phantom. This is useful when a weak Klass
   // pointer has been "peeked" and then must be kept alive before it may
--- a/src/hotspot/share/oops/method.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/oops/method.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -2152,6 +2152,8 @@
   if (value && !already_set) {
     MetadataOnStackMark::record(this);
   }
+  assert(!value || !is_old() || is_obsolete() || is_running_emcp(),
+         "emcp methods cannot run after emcp bit is cleared");
 }
 
 // Called when the class loader is unloaded to make all methods weak.
--- a/src/hotspot/share/opto/graphKit.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/opto/graphKit.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1698,6 +1698,14 @@
   return _barrier_set->clone(this, src, dst, size, is_array);
 }
 
+Node* GraphKit::access_resolve(Node* n, DecoratorSet decorators) {
+  // Use stronger ACCESS_WRITE|ACCESS_READ by default.
+  if ((decorators & (ACCESS_READ | ACCESS_WRITE)) == 0) {
+    decorators |= ACCESS_READ | ACCESS_WRITE;
+  }
+  return _barrier_set->resolve(this, n, decorators);
+}
+
 //-------------------------array_element_address-------------------------
 Node* GraphKit::array_element_address(Node* ary, Node* idx, BasicType elembt,
                                       const TypeInt* sizetype, Node* ctrl) {
@@ -3233,6 +3241,8 @@
 
   assert(dead_locals_are_killed(), "should kill locals before sync. point");
 
+  obj = access_resolve(obj, ACCESS_READ | ACCESS_WRITE);
+
   // Box the stack location
   Node* box = _gvn.transform(new BoxLockNode(next_monitor()));
   Node* mem = reset_memory();
@@ -3950,6 +3960,8 @@
    *   dst[i_char++] = (char)(src[i_byte] & 0xff);
    * }
    */
+  src = access_resolve(src, ACCESS_READ);
+  dst = access_resolve(dst, ACCESS_WRITE);
   add_predicate();
   RegionNode* head = new RegionNode(3);
   head->init_req(1, control());
--- a/src/hotspot/share/opto/graphKit.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/opto/graphKit.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -637,6 +637,8 @@
 
   void access_clone(Node* ctl, Node* src, Node* dst, Node* size, bool is_array);
 
+  Node* access_resolve(Node* n, DecoratorSet decorators);
+
   // Return addressing for an array element.
   Node* array_element_address(Node* ary, Node* idx, BasicType elembt,
                               // Optional constraint on the array size:
--- a/src/hotspot/share/opto/library_call.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/opto/library_call.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1103,6 +1103,9 @@
   arg1 = must_be_not_null(arg1, true);
   arg2 = must_be_not_null(arg2, true);
 
+  arg1 = access_resolve(arg1, ACCESS_READ);
+  arg2 = access_resolve(arg2, ACCESS_READ);
+
   // Get start addr and length of first argument
   Node* arg1_start  = array_element_address(arg1, intcon(0), T_BYTE);
   Node* arg1_cnt    = load_array_length(arg1);
@@ -1130,6 +1133,9 @@
     arg1 = must_be_not_null(arg1, true);
     arg2 = must_be_not_null(arg2, true);
 
+    arg1 = access_resolve(arg1, ACCESS_READ);
+    arg2 = access_resolve(arg2, ACCESS_READ);
+
     // Get start addr and length of first argument
     Node* arg1_start  = array_element_address(arg1, intcon(0), T_BYTE);
     Node* arg1_cnt    = load_array_length(arg1);
@@ -1170,6 +1176,9 @@
   Node* arg1 = argument(0);
   Node* arg2 = argument(1);
 
+  arg1 = access_resolve(arg1, ACCESS_READ);
+  arg2 = access_resolve(arg2, ACCESS_READ);
+
   const TypeAryPtr* mtype = (ae == StrIntrinsicNode::UU) ? TypeAryPtr::CHARS : TypeAryPtr::BYTES;
   set_result(_gvn.transform(new AryEqNode(control(), memory(mtype), arg1, arg2, ae)));
   clear_upper_avx();
@@ -1196,6 +1205,7 @@
   if (stopped()) {
     return true;
   }
+  ba = access_resolve(ba, ACCESS_READ);
   Node* ba_start = array_element_address(ba, offset, T_BYTE);
   Node* result = new HasNegativesNode(control(), memory(TypeAryPtr::BYTES), ba_start, len);
   set_result(_gvn.transform(result));
@@ -1266,6 +1276,9 @@
   src = must_be_not_null(src, true);
   tgt = must_be_not_null(tgt, true);
 
+  src = access_resolve(src, ACCESS_READ);
+  tgt = access_resolve(tgt, ACCESS_READ);
+
   // Get start addr and length of source string
   Node* src_start = array_element_address(src, intcon(0), T_BYTE);
   Node* src_count = load_array_length(src);
@@ -1313,6 +1326,9 @@
   src = must_be_not_null(src, true);
   tgt = must_be_not_null(tgt, true);
 
+  src = access_resolve(src, ACCESS_READ);
+  tgt = access_resolve(tgt, ACCESS_READ);
+
   // Multiply byte array index by 2 if String is UTF16 encoded
   Node* src_offset = (ae == StrIntrinsicNode::LL) ? from_index : _gvn.transform(new LShiftINode(from_index, intcon(1)));
   src_count = _gvn.transform(new SubINode(src_count, from_index));
@@ -1399,6 +1415,7 @@
   Node* max         = argument(3);
 
   src = must_be_not_null(src, true);
+  src = access_resolve(src, ACCESS_READ);
 
   Node* src_offset = _gvn.transform(new LShiftINode(from_index, intcon(1)));
   Node* src_start = array_element_address(src, src_offset, T_BYTE);
@@ -1489,6 +1506,9 @@
     return true;
   }
 
+  src = access_resolve(src, ACCESS_READ);
+  dst = access_resolve(dst, ACCESS_WRITE);
+
   Node* src_start = array_element_address(src, src_offset, src_elem);
   Node* dst_start = array_element_address(dst, dst_offset, dst_elem);
   // 'src_start' points to src array + scaled offset
@@ -1579,6 +1599,7 @@
     AllocateArrayNode* alloc = tightly_coupled_allocation(newcopy, NULL);
 
     // Calculate starting addresses.
+    value = access_resolve(value, ACCESS_READ);
     Node* src_start = array_element_address(value, offset, T_CHAR);
     Node* dst_start = basic_plus_adr(newcopy, arrayOopDesc::base_offset_in_bytes(T_BYTE));
 
@@ -1662,6 +1683,9 @@
   }
 
   if (!stopped()) {
+    src = access_resolve(src, ACCESS_READ);
+    dst = access_resolve(dst, ACCESS_READ);
+
     // Calculate starting addresses.
     Node* src_start = array_element_address(src, src_begin, T_BYTE);
     Node* dst_start = array_element_address(dst, dst_begin, T_CHAR);
@@ -1730,6 +1754,7 @@
   }
 
   value = must_be_not_null(value, true);
+  value = access_resolve(value, is_store ? ACCESS_WRITE : ACCESS_READ);
 
   Node* adr = array_element_address(value, index, T_CHAR);
   if (adr->is_top()) {
@@ -3661,6 +3686,8 @@
       Node* orig_tail = _gvn.transform(new SubINode(orig_length, start));
       Node* moved = generate_min_max(vmIntrinsics::_min, orig_tail, length);
 
+      original = access_resolve(original, ACCESS_READ);
+
       // Generate a direct call to the right arraycopy function(s).
       // We know the copy is disjoint but we might not know if the
       // oop stores need checking.
@@ -4303,6 +4330,7 @@
         if (is_obja != NULL) {
           PreserveJVMState pjvms2(this);
           set_control(is_obja);
+          obj = access_resolve(obj, ACCESS_READ);
           // Generate a direct call to the right arraycopy function(s).
           Node* alloc = tightly_coupled_allocation(alloc_obj, NULL);
           ArrayCopyNode* ac = ArrayCopyNode::make(this, true, obj, intcon(0), alloc_obj, intcon(0), obj_length, alloc != NULL, false);
@@ -4779,7 +4807,10 @@
     return true;
   }
 
-  ArrayCopyNode* ac = ArrayCopyNode::make(this, true, src, src_offset, dest, dest_offset, length, alloc != NULL, negative_length_guard_generated,
+  Node* new_src = access_resolve(src, ACCESS_READ);
+  Node* new_dest = access_resolve(dest, ACCESS_WRITE);
+
+  ArrayCopyNode* ac = ArrayCopyNode::make(this, true, new_src, src_offset, new_dest, dest_offset, length, alloc != NULL, negative_length_guard_generated,
                                           // Create LoadRange and LoadKlass nodes for use during macro expansion here
                                           // so the compiler has a chance to eliminate them: during macro expansion,
                                           // we have to set their control (CastPP nodes are eliminated).
@@ -4892,6 +4923,9 @@
   src = must_be_not_null(src, true);
   dst = must_be_not_null(dst, true);
 
+  src = access_resolve(src, ACCESS_READ);
+  dst = access_resolve(dst, ACCESS_WRITE);
+
   const Type* src_type = src->Value(&_gvn);
   const Type* dst_type = dst->Value(&_gvn);
   const TypeAryPtr* top_src = src_type->isa_aryptr();
@@ -4947,6 +4981,10 @@
   x = must_be_not_null(x, true);
   y = must_be_not_null(y, true);
 
+  x = access_resolve(x, ACCESS_READ);
+  y = access_resolve(y, ACCESS_READ);
+  z = access_resolve(z, ACCESS_WRITE);
+
   const Type* x_type = x->Value(&_gvn);
   const Type* y_type = y->Value(&_gvn);
   const TypeAryPtr* top_x = x_type->isa_aryptr();
@@ -5055,6 +5093,9 @@
   x = must_be_not_null(x, true);
   z = must_be_not_null(z, true);
 
+  x = access_resolve(x, ACCESS_READ);
+  z = access_resolve(z, ACCESS_WRITE);
+
   const Type* x_type = x->Value(&_gvn);
   const Type* z_type = z->Value(&_gvn);
   const TypeAryPtr* top_x = x_type->isa_aryptr();
@@ -5104,6 +5145,9 @@
 
   out = must_be_not_null(out, true);
 
+  in = access_resolve(in, ACCESS_READ);
+  out = access_resolve(out, ACCESS_WRITE);
+
   const Type* out_type = out->Value(&_gvn);
   const Type* in_type = in->Value(&_gvn);
   const TypeAryPtr* top_out = out_type->isa_aryptr();
@@ -5153,6 +5197,11 @@
   Node* inv  = argument(4);
   Node* m    = argument(6);
 
+  a = access_resolve(a, ACCESS_READ);
+  b = access_resolve(b, ACCESS_READ);
+  n = access_resolve(n, ACCESS_READ);
+  m = access_resolve(m, ACCESS_WRITE);
+
   const Type* a_type = a->Value(&_gvn);
   const TypeAryPtr* top_a = a_type->isa_aryptr();
   const Type* b_type = b->Value(&_gvn);
@@ -5212,6 +5261,10 @@
   Node* inv  = argument(3);
   Node* m    = argument(5);
 
+  a = access_resolve(a, ACCESS_READ);
+  n = access_resolve(n, ACCESS_READ);
+  m = access_resolve(m, ACCESS_WRITE);
+
   const Type* a_type = a->Value(&_gvn);
   const TypeAryPtr* top_a = a_type->isa_aryptr();
   const Type* n_type = a->Value(&_gvn);
@@ -5357,6 +5410,7 @@
 
   // 'src_start' points to src array + scaled offset
   src = must_be_not_null(src, true);
+  src = access_resolve(src, ACCESS_READ);
   Node* src_start = array_element_address(src, offset, src_elem);
 
   // We assume that range check is done by caller.
@@ -5446,11 +5500,13 @@
 
   // 'src_start' points to src array + scaled offset
   src = must_be_not_null(src, true);
+  src = access_resolve(src, ACCESS_READ);
   Node* src_start = array_element_address(src, offset, src_elem);
 
   // static final int[] byteTable in class CRC32C
   Node* table = get_table_from_crc32c_class(callee()->holder());
   table = must_be_not_null(table, true);
+  table = access_resolve(table, ACCESS_READ);
   Node* table_start = array_element_address(table, intcon(0), T_INT);
 
   // We assume that range check is done by caller.
@@ -5495,6 +5551,7 @@
   // static final int[] byteTable in class CRC32C
   Node* table = get_table_from_crc32c_class(callee()->holder());
   table = must_be_not_null(table, true);
+  table = access_resolve(table, ACCESS_READ);
   Node* table_start = array_element_address(table, intcon(0), T_INT);
 
   // Call the stub.
@@ -5538,6 +5595,7 @@
   }
 
   // 'src_start' points to src array + scaled offset
+  src = access_resolve(src, ACCESS_READ);
   Node* src_start = array_element_address(src, offset, src_elem);
 
   // We assume that range check is done by caller.
@@ -5741,6 +5799,9 @@
   src = must_be_not_null(src, true);
   dest = must_be_not_null(dest, true);
 
+  src = access_resolve(src, ACCESS_READ);
+  dest = access_resolve(dest, ACCESS_WRITE);
+
   // (1) src and dest are arrays.
   const Type* src_type = src->Value(&_gvn);
   const Type* dest_type = dest->Value(&_gvn);
@@ -5814,6 +5875,9 @@
   src = must_be_not_null(src, false);
   dest = must_be_not_null(dest, false);
 
+  src = access_resolve(src, ACCESS_READ);
+  dest = access_resolve(dest, ACCESS_WRITE);
+
   // (1) src and dest are arrays.
   const Type* src_type = src->Value(&_gvn);
   const Type* dest_type = dest->Value(&_gvn);
@@ -5859,6 +5923,7 @@
   // similarly, get the start address of the r vector
   Node* objRvec = load_field_from_object(cipherBlockChaining_object, "r", "[B", /*is_exact*/ false);
   if (objRvec == NULL) return false;
+  objRvec = access_resolve(objRvec, ACCESS_WRITE);
   Node* r_start = array_element_address(objRvec, intcon(0), T_BYTE);
 
   Node* cbcCrypt;
@@ -5907,6 +5972,10 @@
   Node* dest = argument(4);
   Node* dest_offset = argument(5);
 
+  src = access_resolve(src, ACCESS_READ);
+  dest = access_resolve(dest, ACCESS_WRITE);
+  counterMode_object = access_resolve(counterMode_object, ACCESS_WRITE);
+
   // (1) src and dest are arrays.
   const Type* src_type = src->Value(&_gvn);
   const Type* dest_type = dest->Value(&_gvn);
@@ -5947,10 +6016,12 @@
   // similarly, get the start address of the r vector
   Node* obj_counter = load_field_from_object(counterMode_object, "counter", "[B", /*is_exact*/ false);
   if (obj_counter == NULL) return false;
+  obj_counter = access_resolve(obj_counter, ACCESS_WRITE);
   Node* cnt_start = array_element_address(obj_counter, intcon(0), T_BYTE);
 
   Node* saved_encCounter = load_field_from_object(counterMode_object, "encryptedCounter", "[B", /*is_exact*/ false);
   if (saved_encCounter == NULL) return false;
+  saved_encCounter = access_resolve(saved_encCounter, ACCESS_WRITE);
   Node* saved_encCounter_start = array_element_address(saved_encCounter, intcon(0), T_BYTE);
   Node* used = field_address_from_object(counterMode_object, "used", "I", /*is_exact*/ false);
 
@@ -5991,6 +6062,7 @@
   if (objAESCryptKey == NULL) return (Node *) NULL;
 
   // now have the array, need to get the start address of the K array
+  objAESCryptKey = access_resolve(objAESCryptKey, ACCESS_READ);
   Node* k_start = array_element_address(objAESCryptKey, intcon(0), T_INT);
   return k_start;
 }
@@ -6002,6 +6074,7 @@
   if (objAESCryptKey == NULL) return (Node *) NULL;
 
   // now have the array, need to get the start address of the lastKey array
+  objAESCryptKey = access_resolve(objAESCryptKey, ACCESS_READ);
   Node* original_k_start = array_element_address(objAESCryptKey, intcon(0), T_BYTE);
   return original_k_start;
 }
@@ -6132,6 +6205,10 @@
   subkeyH = must_be_not_null(subkeyH, true);
   data = must_be_not_null(data, true);
 
+  state = access_resolve(state, ACCESS_WRITE);
+  subkeyH = access_resolve(subkeyH, ACCESS_READ);
+  data = access_resolve(data, ACCESS_READ);
+
   Node* state_start  = array_element_address(state, intcon(0), T_LONG);
   assert(state_start, "state is NULL");
   Node* subkeyH_start  = array_element_address(subkeyH, intcon(0), T_LONG);
@@ -6206,6 +6283,7 @@
   }
   // 'src_start' points to src array + offset
   src = must_be_not_null(src, true);
+  src = access_resolve(src, ACCESS_READ);
   Node* src_start = array_element_address(src, ofs, src_elem);
   Node* state = NULL;
   address stubAddr;
@@ -6273,6 +6351,7 @@
   }
   // 'src_start' points to src array + offset
   src = must_be_not_null(src, false);
+  src = access_resolve(src, ACCESS_READ);
   Node* src_start = array_element_address(src, ofs, src_elem);
 
   const char* klass_SHA_name = NULL;
@@ -6355,6 +6434,7 @@
   if (sha_state == NULL) return (Node *) NULL;
 
   // now have the array, need to get the start address of the state array
+  sha_state = access_resolve(sha_state, ACCESS_WRITE);
   Node* state = array_element_address(sha_state, intcon(0), T_INT);
   return state;
 }
@@ -6366,6 +6446,7 @@
   if (sha_state == NULL) return (Node *) NULL;
 
   // now have the array, need to get the start address of the state array
+  sha_state = access_resolve(sha_state, ACCESS_WRITE);
   Node* state = array_element_address(sha_state, intcon(0), T_LONG);
   return state;
 }
--- a/src/hotspot/share/opto/phaseX.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/opto/phaseX.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1889,13 +1889,23 @@
       } else if( n->is_Region() ) { // Unreachable region
         // Note: nn == C->top()
         n->set_req(0, NULL);        // Cut selfreference
-        // Eagerly remove dead phis to avoid phis copies creation.
-        for (DUIterator i = n->outs(); n->has_out(i); i++) {
-          Node* m = n->out(i);
-          if( m->is_Phi() ) {
-            assert(type(m) == Type::TOP, "Unreachable region should not have live phis.");
-            replace_node(m, nn);
-            --i; // deleted this phi; rescan starting with next position
+        bool progress = true;
+        uint max = n->outcnt();
+        DUIterator i;
+        while (progress) {
+          progress = false;
+          // Eagerly remove dead phis to avoid phis copies creation.
+          for (i = n->outs(); n->has_out(i); i++) {
+            Node* m = n->out(i);
+            if (m->is_Phi()) {
+              assert(type(m) == Type::TOP, "Unreachable region should not have live phis.");
+              replace_node(m, nn);
+              if (max != n->outcnt()) {
+                progress = true;
+                i = n->refresh_out_pos(i);
+                max = n->outcnt();
+              }
+            }
           }
         }
       }
--- a/src/hotspot/share/opto/stringopts.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/opto/stringopts.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1212,6 +1212,7 @@
     kit.set_control(loop);
     Node* sizeTable = fetch_static_field(kit, size_table_field);
 
+    sizeTable = kit.access_resolve(sizeTable, ACCESS_READ);
     Node* value = kit.load_array_element(NULL, sizeTable, index, TypeAryPtr::INTS);
     C->record_for_igvn(value);
     Node* limit = __ CmpI(phi, value);
@@ -1547,6 +1548,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);
+  src_array = kit.access_resolve(src_array, ACCESS_READ);
 
   IdealKit ideal(&kit, true, true);
   IdealVariable count(ideal); __ declarations_done();
--- a/src/hotspot/share/prims/jvmti.xml	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/prims/jvmti.xml	Tue Sep 18 16:41:24 2018 -0700
@@ -24,7 +24,7 @@
 -->
 
 <!DOCTYPE specification [
-   <!ELEMENT specification (title, intro*, functionsection, errorsection,
+   <!ELEMENT specification (title, copyright, intro*, functionsection, errorsection,
                             eventsection, datasection, issuessection, changehistory)>
    <!ATTLIST specification label CDATA #REQUIRED
                            majorversion CDATA #REQUIRED
@@ -34,6 +34,8 @@
    <!ELEMENT title (#PCDATA|jvmti|tm)*>
    <!ATTLIST title subtitle CDATA #REQUIRED>
 
+   <!ELEMENT copyright ANY>
+
    <!ELEMENT intro ANY>
    <!ATTLIST intro id CDATA #IMPLIED
                    label CDATA "">
@@ -365,6 +367,10 @@
     <tm>JVM</tm> Tool Interface
   </title>
 
+  <copyright>
+    Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
+  </copyright>
+
   <intro id="whatIs" label="What is the JVM Tool Interface?">
     The <tm>JVM</tm> Tool Interface (<jvmti/>)
     is a programming interface used by development and monitoring tools.
--- a/src/hotspot/share/prims/jvmti.xsl	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/prims/jvmti.xsl	Tue Sep 18 16:41:24 2018 -0700
@@ -204,6 +204,7 @@
     <p id="ChangeHistory"/>
       <xsl:apply-templates select="changehistory"/>
     </div>
+    <xsl:apply-templates select="copyright"/>
   </body>
 </html>
 </xsl:template>
@@ -219,6 +220,12 @@
     </h3>
 </xsl:template>
 
+<xsl:template match="copyright">
+  <p>
+    <xsl:apply-templates/>
+  </p>
+</xsl:template>
+
 <xsl:template match="functionsection">
   <div class="sep"/>
   <hr class="thick"/>
--- a/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -129,7 +129,7 @@
     // requested, so only need to walk this loader's ClassLoaderData
     // dictionary, or the NULL ClassLoaderData dictionary for bootstrap loader.
     if (loader != NULL) {
-      ClassLoaderData* data = java_lang_ClassLoader::loader_data(loader);
+      ClassLoaderData* data = java_lang_ClassLoader::loader_data_acquire(loader);
       // ClassLoader may not be used yet for loading.
       if (data != NULL && data->dictionary() != NULL) {
         data->dictionary()->all_entries_do(&closure);
--- a/src/hotspot/share/prims/jvmtiRawMonitor.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiRawMonitor.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -264,7 +264,6 @@
 
 // Any JavaThread will enter here with state _thread_blocked
 int JvmtiRawMonitor::raw_enter(TRAPS) {
-  TEVENT (raw_enter) ;
   void * Contended ;
 
   // don't enter raw monitor if thread is being externally suspended, it will
@@ -341,7 +340,6 @@
 // Used mainly for JVMTI raw monitor implementation
 // Also used for JvmtiRawMonitor::wait().
 int JvmtiRawMonitor::raw_exit(TRAPS) {
-  TEVENT (raw_exit) ;
   if (THREAD != _owner) {
     return OM_ILLEGAL_MONITOR_STATE;
   }
@@ -360,7 +358,6 @@
 // All JavaThreads will enter here with state _thread_blocked
 
 int JvmtiRawMonitor::raw_wait(jlong millis, bool interruptible, TRAPS) {
-  TEVENT (raw_wait) ;
   if (THREAD != _owner) {
     return OM_ILLEGAL_MONITOR_STATE;
   }
@@ -406,7 +403,6 @@
 }
 
 int JvmtiRawMonitor::raw_notify(TRAPS) {
-  TEVENT (raw_notify) ;
   if (THREAD != _owner) {
     return OM_ILLEGAL_MONITOR_STATE;
   }
@@ -415,7 +411,6 @@
 }
 
 int JvmtiRawMonitor::raw_notifyAll(TRAPS) {
-  TEVENT (raw_notifyAll) ;
   if (THREAD != _owner) {
     return OM_ILLEGAL_MONITOR_STATE;
   }
--- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -1231,8 +1231,7 @@
       // verifier. Please, refer to jvmtiThreadState.hpp for the detailed
       // description.
       RedefineVerifyMark rvm(the_class, scratch_class, state);
-      Verifier::verify(
-        scratch_class, Verifier::ThrowException, true, THREAD);
+      Verifier::verify(scratch_class, true, THREAD);
     }
 
     if (HAS_PENDING_EXCEPTION) {
@@ -1263,7 +1262,7 @@
       // verify what we have done during constant pool merging
       {
         RedefineVerifyMark rvm(the_class, scratch_class, state);
-        Verifier::verify(scratch_class, Verifier::ThrowException, true, THREAD);
+        Verifier::verify(scratch_class, true, THREAD);
       }
 
       if (HAS_PENDING_EXCEPTION) {
--- a/src/hotspot/share/prims/whitebox.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/prims/whitebox.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -178,6 +178,15 @@
   return closure.found();
 WB_END
 
+WB_ENTRY(jint, WB_GetSymbolRefcount(JNIEnv* env, jobject unused, jstring name))
+  oop h_name = JNIHandles::resolve(name);
+  if (h_name == NULL) return false;
+  Symbol* sym = java_lang_String::as_symbol(h_name, CHECK_0);
+  TempNewSymbol tsym(sym); // Make sure to decrement reference count on sym on return
+  return (jint)sym->refcount();
+WB_END
+
+
 WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
 #if INCLUDE_JVMTI
   ResourceMark rm;
@@ -1504,7 +1513,7 @@
 
   oop class_loader_oop = JNIHandles::resolve(class_loader);
   ClassLoaderData* cld = class_loader_oop != NULL
-      ? java_lang_ClassLoader::loader_data(class_loader_oop)
+      ? java_lang_ClassLoader::loader_data_acquire(class_loader_oop)
       : ClassLoaderData::the_null_class_loader_data();
 
   void* metadata = MetadataFactory::new_array<u1>(cld, WhiteBox::array_bytes_to_length((size_t)size), thread);
@@ -1515,7 +1524,7 @@
 WB_ENTRY(void, WB_FreeMetaspace(JNIEnv* env, jobject wb, jobject class_loader, jlong addr, jlong size))
   oop class_loader_oop = JNIHandles::resolve(class_loader);
   ClassLoaderData* cld = class_loader_oop != NULL
-      ? java_lang_ClassLoader::loader_data(class_loader_oop)
+      ? java_lang_ClassLoader::loader_data_acquire(class_loader_oop)
       : ClassLoaderData::the_null_class_loader_data();
 
   MetadataFactory::free_array(cld, (Array<u1>*)(uintptr_t)addr);
@@ -1982,7 +1991,6 @@
   return (jint) SystemDictionary::pd_cache_table()->removed_entries_count();
 WB_END
 
-
 #define CC (char*)
 
 static JNINativeMethod methods[] = {
@@ -1996,6 +2004,7 @@
   {CC"getHeapSpaceAlignment",            CC"()J",                   (void*)&WB_GetHeapSpaceAlignment},
   {CC"getHeapAlignment",                 CC"()J",                   (void*)&WB_GetHeapAlignment},
   {CC"isClassAlive0",                    CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
+  {CC"getSymbolRefcount",                CC"(Ljava/lang/String;)I", (void*)&WB_GetSymbolRefcount },
   {CC"parseCommandLine0",
       CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
       (void*) &WB_ParseCommandLine
--- a/src/hotspot/share/runtime/arguments.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -575,6 +575,8 @@
   { "TransmitErrorReport",           JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "ErrorReportServer",             JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
   { "EmitSync",                      JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
+  { "SyncVerbose",                   JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
+  { "SyncFlags",                     JDK_Version::undefined(), JDK_Version::jdk(12), JDK_Version::jdk(13) },
 
 #ifdef TEST_VERIFY_SPECIAL_JVM_FLAGS
   { "dep > obs",                    JDK_Version::jdk(9), JDK_Version::jdk(8), JDK_Version::undefined() },
--- a/src/hotspot/share/runtime/globals.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/runtime/globals.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -841,11 +841,6 @@
                 "The check is performed on GuaranteedSafepointInterval.")   \
                 range(0, 100)                                               \
                                                                             \
-  experimental(intx, SyncFlags, 0, "(Unsafe, Unstable) "                    \
-               "Experimental Sync flags")                                   \
-                                                                            \
-  experimental(intx, SyncVerbose, 0, "(Unstable)")                          \
-                                                                            \
   experimental(intx, hashCode, 5,                                           \
                "(Unstable) select hashCode generation algorithm")           \
                                                                             \
--- a/src/hotspot/share/runtime/objectMonitor.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/runtime/objectMonitor.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -529,7 +529,7 @@
   // timer scalability issues we see on some platforms as we'd only have one thread
   // -- the checker -- parked on a timer.
 
-  if ((SyncFlags & 16) == 0 && nxt == NULL && _EntryList == NULL) {
+  if (nxt == NULL && _EntryList == NULL) {
     // Try to assume the role of responsible thread for the monitor.
     // CONSIDER:  ST vs CAS vs { if (Responsible==null) Responsible=Self }
     Atomic::replace_if_null(Self, &_Responsible);
@@ -546,7 +546,6 @@
   // to defer the state transitions until absolutely necessary,
   // and in doing so avoid some transitions ...
 
-  TEVENT(Inflated enter - Contention);
   int nWakeups = 0;
   int recheckInterval = 1;
 
@@ -555,13 +554,8 @@
     if (TryLock(Self) > 0) break;
     assert(_owner != Self, "invariant");
 
-    if ((SyncFlags & 2) && _Responsible == NULL) {
-      Atomic::replace_if_null(Self, &_Responsible);
-    }
-
     // park self
-    if (_Responsible == Self || (SyncFlags & 1)) {
-      TEVENT(Inflated enter - park TIMED);
+    if (_Responsible == Self) {
       Self->_ParkEvent->park((jlong) recheckInterval);
       // Increase the recheckInterval, but clamp the value.
       recheckInterval *= 8;
@@ -569,7 +563,6 @@
         recheckInterval = MAX_RECHECK_INTERVAL;
       }
     } else {
-      TEVENT(Inflated enter - park UNTIMED);
       Self->_ParkEvent->park();
     }
 
@@ -580,7 +573,7 @@
     // Note that the counter is not protected by a lock or updated by atomics.
     // That is by design - we trade "lossy" counters which are exposed to
     // races during updates for a lower probe effect.
-    TEVENT(Inflated enter - Futile wakeup);
+
     // This PerfData object can be used in parallel with a safepoint.
     // See the work around in PerfDataManager::destroy().
     OM_PERFDATA_OP(FutileWakeups, inc());
@@ -675,9 +668,6 @@
   // monitorexit.  Recall too, that in 1-0 mode monitorexit does not necessarily
   // execute a serializing instruction.
 
-  if (SyncFlags & 8) {
-    OrderAccess::fence();
-  }
   return;
 }
 
@@ -707,8 +697,6 @@
     if (TryLock(Self) > 0) break;
     if (TrySpin(Self) > 0) break;
 
-    TEVENT(Wait Reentry - parking);
-
     // State transition wrappers around park() ...
     // ReenterI() wisely defers state transitions until
     // it's clear we must park the thread.
@@ -719,11 +707,7 @@
       // cleared by handle_special_suspend_equivalent_condition()
       // or java_suspend_self()
       jt->set_suspend_equivalent();
-      if (SyncFlags & 1) {
-        Self->_ParkEvent->park((jlong)MAX_RECHECK_INTERVAL);
-      } else {
-        Self->_ParkEvent->park();
-      }
+      Self->_ParkEvent->park();
 
       // were we externally suspended while we were waiting?
       for (;;) {
@@ -744,7 +728,6 @@
     // Note that the counter is not protected by a lock or updated by atomics.
     // That is by design - we trade "lossy" counters which are exposed to
     // races during updates for a lower probe effect.
-    TEVENT(Wait Reentry - futile wakeup);
     ++nWakeups;
 
     // Assuming this is not a spurious wakeup we'll normally
@@ -795,7 +778,6 @@
     if (SelfNode == _EntryList) _EntryList = nxt;
     assert(nxt == NULL || nxt->TState == ObjectWaiter::TS_ENTER, "invariant");
     assert(prv == NULL || prv->TState == ObjectWaiter::TS_ENTER, "invariant");
-    TEVENT(Unlink from EntryList);
   } else {
     assert(SelfNode->TState == ObjectWaiter::TS_CXQ, "invariant");
     // Inopportune interleaving -- Self is still on the cxq.
@@ -834,7 +816,6 @@
       assert(q->_next == p, "invariant");
       q->_next = p->_next;
     }
-    TEVENT(Unlink from cxq);
   }
 
 #ifdef ASSERT
@@ -923,7 +904,6 @@
       // way we should encounter this situation is in the presence of
       // unbalanced JNI locking. TODO: CheckJNICalls.
       // See also: CR4414101
-      TEVENT(Exit - Throw IMSX);
       assert(false, "Non-balanced monitor enter/exit! Likely JNI locking");
       return;
     }
@@ -931,15 +911,12 @@
 
   if (_recursions != 0) {
     _recursions--;        // this is simple recursive enter
-    TEVENT(Inflated exit - recursive);
     return;
   }
 
   // Invariant: after setting Responsible=null an thread must execute
   // a MEMBAR or other serializing instruction before fetching EntryList|cxq.
-  if ((SyncFlags & 4) == 0) {
-    _Responsible = NULL;
-  }
+  _Responsible = NULL;
 
 #if INCLUDE_JFR
   // get the owner's thread id for the MonitorEnter event
@@ -968,10 +945,8 @@
       OrderAccess::release_store(&_owner, (void*)NULL);   // drop the lock
       OrderAccess::storeload();                        // See if we need to wake a successor
       if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) {
-        TEVENT(Inflated exit - simple egress);
         return;
       }
-      TEVENT(Inflated exit - complex egress);
       // Other threads are blocked trying to acquire the lock.
 
       // Normally the exiting thread is responsible for ensuring succession,
@@ -1013,14 +988,12 @@
       if (!Atomic::replace_if_null(THREAD, &_owner)) {
         return;
       }
-      TEVENT(Exit - Reacquired);
     } else {
       if ((intptr_t(_EntryList)|intptr_t(_cxq)) == 0 || _succ != NULL) {
         OrderAccess::release_store(&_owner, (void*)NULL);   // drop the lock
         OrderAccess::storeload();
         // Ratify the previously observed values.
         if (_cxq == NULL || _succ != NULL) {
-          TEVENT(Inflated exit - simple egress);
           return;
         }
 
@@ -1036,12 +1009,8 @@
         //     we could simply unpark() the lead thread and return
         //     without having set _succ.
         if (!Atomic::replace_if_null(THREAD, &_owner)) {
-          TEVENT(Inflated exit - reacquired succeeded);
           return;
         }
-        TEVENT(Inflated exit - reacquired failed);
-      } else {
-        TEVENT(Inflated exit - complex egress);
       }
     }
 
@@ -1168,7 +1137,6 @@
       if (u == w) break;
       w = u;
     }
-    TEVENT(Inflated exit - drain cxq into EntryList);
 
     assert(w != NULL, "invariant");
     assert(_EntryList == NULL, "invariant");
@@ -1272,7 +1240,6 @@
     if (2 == Mode) OrderAccess::storeload();
     if (!jSelf->is_external_suspend()) return false;
     // We raced a suspension -- fall thru into the slow path
-    TEVENT(ExitSuspendEquivalent - raced);
     jSelf->set_suspend_equivalent();
   }
   return jSelf->handle_special_suspend_equivalent_condition();
@@ -1300,10 +1267,6 @@
   OrderAccess::release_store(&_owner, (void*)NULL);
   OrderAccess::fence();                               // ST _owner vs LD in unpark()
 
-  if (SafepointMechanism::poll(Self)) {
-    TEVENT(unpark before SAFEPOINT);
-  }
-
   DTRACE_MONITOR_PROBE(contended__exit, this, object(), Self);
   Trigger->unpark();
 
@@ -1372,7 +1335,6 @@
         _owner = THREAD;  /* Convert from basiclock addr to Thread addr */  \
         _recursions = 0;                                                    \
       } else {                                                              \
-        TEVENT(Throw IMSX);                                                 \
         THROW(vmSymbols::java_lang_IllegalMonitorStateException());         \
       }                                                                     \
     }                                                                       \
@@ -1382,7 +1344,6 @@
 // TODO-FIXME: remove check_slow() -- it's likely dead.
 
 void ObjectMonitor::check_slow(TRAPS) {
-  TEVENT(check_slow - throw IMSX);
   assert(THREAD != _owner && !THREAD->is_lock_owned((address) _owner), "must not be owner");
   THROW_MSG(vmSymbols::java_lang_IllegalMonitorStateException(), "current thread not owner");
 }
@@ -1444,13 +1405,10 @@
     if (event.should_commit()) {
       post_monitor_wait_event(&event, this, 0, millis, false);
     }
-    TEVENT(Wait - Throw IEX);
     THROW(vmSymbols::java_lang_InterruptedException());
     return;
   }
 
-  TEVENT(Wait);
-
   assert(Self->_Stalled == 0, "invariant");
   Self->_Stalled = intptr_t(this);
   jt->set_current_waiting_monitor(this);
@@ -1474,9 +1432,8 @@
   AddWaiter(&node);
   Thread::SpinRelease(&_WaitSetLock);
 
-  if ((SyncFlags & 4) == 0) {
-    _Responsible = NULL;
-  }
+  _Responsible = NULL;
+
   intptr_t save = _recursions; // record the old recursion count
   _waiters++;                  // increment the number of waiters
   _recursions = 0;             // set the recursion level to be 1
@@ -1622,16 +1579,11 @@
   assert(_succ != Self, "invariant");
   assert(((oop)(object()))->mark() == markOopDesc::encode(this), "invariant");
 
-  if (SyncFlags & 32) {
-    OrderAccess::fence();
-  }
-
   // check if the notification happened
   if (!WasNotified) {
     // no, it could be timeout or Thread.interrupt() or both
     // check for interrupt event, otherwise it is timeout
     if (interruptible && Thread::is_interrupted(Self, true) && !HAS_PENDING_EXCEPTION) {
-      TEVENT(Wait - throw IEX from epilog);
       THROW(vmSymbols::java_lang_InterruptedException());
     }
   }
@@ -1652,7 +1604,6 @@
   Thread::SpinAcquire(&_WaitSetLock, "WaitSet - notify");
   ObjectWaiter * iterator = DequeueWaiter();
   if (iterator != NULL) {
-    TEVENT(Notify1 - Transfer);
     guarantee(iterator->TState == ObjectWaiter::TS_WAIT, "invariant");
     guarantee(iterator->_notified == 0, "invariant");
     // Disposition - what might we do with iterator ?
@@ -1759,14 +1710,11 @@
 // Note: We can also detect many such problems with a "minimum wait".
 // When the "minimum wait" is set to a small non-zero timeout value
 // and the program does not hang whereas it did absent "minimum wait",
-// that suggests a lost wakeup bug. The '-XX:SyncFlags=1' option uses
-// a "minimum wait" for all park() operations; see the recheckInterval
-// variable and MAX_RECHECK_INTERVAL.
+// that suggests a lost wakeup bug.
 
 void ObjectMonitor::notify(TRAPS) {
   CHECK_OWNER();
   if (_WaitSet == NULL) {
-    TEVENT(Empty-Notify);
     return;
   }
   DTRACE_MONITOR_PROBE(notify, this, object(), THREAD);
@@ -1785,7 +1733,6 @@
 void ObjectMonitor::notifyAll(TRAPS) {
   CHECK_OWNER();
   if (_WaitSet == NULL) {
-    TEVENT(Empty-NotifyAll);
     return;
   }
 
@@ -1912,14 +1859,12 @@
 
   if (Knob_SuccRestrict && _succ != NULL) return 0;
   if (Knob_OState && NotRunnable (Self, (Thread *) _owner)) {
-    TEVENT(Spin abort - notrunnable [TOP]);
     return 0;
   }
 
   int MaxSpin = Knob_MaxSpinners;
   if (MaxSpin >= 0) {
     if (_Spinner > MaxSpin) {
-      TEVENT(Spin abort -- too many spinners);
       return 0;
     }
     // Slightly racy, but benign ...
@@ -1956,7 +1901,6 @@
     // We periodically check to see if there's a safepoint pending.
     if ((ctr & 0xFF) == 0) {
       if (SafepointMechanism::poll(Self)) {
-        TEVENT(Spin: safepoint);
         goto Abort;           // abrupt spin egress
       }
       if (Knob_UsePause & 1) SpinPause();
@@ -2029,7 +1973,6 @@
       // * exit spin without prejudice.
       // * Since CAS is high-latency, retry again immediately.
       prv = ox;
-      TEVENT(Spin: cas failed);
       if (caspty == -2) break;
       if (caspty == -1) goto Abort;
       ctr -= caspty;
@@ -2038,7 +1981,6 @@
 
     // Did lock ownership change hands ?
     if (ox != prv && prv != NULL) {
-      TEVENT(spin: Owner changed)
       if (oxpty == -2) break;
       if (oxpty == -1) goto Abort;
       ctr -= oxpty;
@@ -2050,7 +1992,6 @@
     // Spinning while the owner is OFFPROC is idiocy.
     // Consider: ctr -= RunnablePenalty ;
     if (Knob_OState && NotRunnable (Self, ox)) {
-      TEVENT(Spin abort - notrunnable);
       goto Abort;
     }
     if (sss && _succ == NULL) _succ = Self;
@@ -2059,7 +2000,6 @@
   // Spin failed with prejudice -- reduce _SpinDuration.
   // TODO: Use an AIMD-like policy to adjust _SpinDuration.
   // AIMD is globally stable.
-  TEVENT(Spin failure);
   {
     int x = _SpinDuration;
     if (x > 0) {
--- a/src/hotspot/share/runtime/objectMonitor.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/runtime/objectMonitor.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -321,21 +321,4 @@
   bool      ExitSuspendEquivalent(JavaThread * Self);
 };
 
-#undef TEVENT
-#define TEVENT(nom) { if (SyncVerbose) FEVENT(nom); }
-
-#define FEVENT(nom)                             \
-  {                                             \
-    static volatile int ctr = 0;                \
-    int v = ++ctr;                              \
-    if ((v & (v - 1)) == 0) {                   \
-      tty->print_cr("INFO: " #nom " : %d", v);  \
-      tty->flush();                             \
-    }                                           \
-  }
-
-#undef  TEVENT
-#define TEVENT(nom) {;}
-
-
 #endif // SHARE_VM_RUNTIME_OBJECTMONITOR_HPP
--- a/src/hotspot/share/runtime/synchronizer.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/runtime/synchronizer.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -320,7 +320,6 @@
     // swing the displaced header from the BasicLock back to the mark.
     assert(dhw->is_neutral(), "invariant");
     if (object->cas_set_mark(dhw, mark) == mark) {
-      TEVENT(fast_exit: release stack-lock);
       return;
     }
   }
@@ -345,7 +344,6 @@
     // be visible <= the ST performed by the CAS.
     lock->set_displaced_header(mark);
     if (mark == obj()->cas_set_mark((markOop) lock, mark)) {
-      TEVENT(slow_enter: release stacklock);
       return;
     }
     // Fall through to inflate() ...
@@ -388,7 +386,6 @@
 //  5) lock lock2
 // NOTE: must use heavy weight monitor to handle complete_exit/reenter()
 intptr_t ObjectSynchronizer::complete_exit(Handle obj, TRAPS) {
-  TEVENT(complete_exit);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -403,7 +400,6 @@
 
 // NOTE: must use heavy weight monitor to handle complete_exit/reenter()
 void ObjectSynchronizer::reenter(Handle obj, intptr_t recursion, TRAPS) {
-  TEVENT(reenter);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -420,7 +416,6 @@
 // NOTE: must use heavy weight monitor to handle jni monitor enter
 void ObjectSynchronizer::jni_enter(Handle obj, TRAPS) {
   // the current locking is from JNI instead of Java code
-  TEVENT(jni_enter);
   if (UseBiasedLocking) {
     BiasedLocking::revoke_and_rebias(obj, false, THREAD);
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
@@ -432,7 +427,6 @@
 
 // NOTE: must use heavy weight monitor to handle jni monitor exit
 void ObjectSynchronizer::jni_exit(oop obj, Thread* THREAD) {
-  TEVENT(jni_exit);
   if (UseBiasedLocking) {
     Handle h_obj(THREAD, obj);
     BiasedLocking::revoke_and_rebias(h_obj, false, THREAD);
@@ -460,8 +454,6 @@
   _obj = obj;
 
   if (_dolock) {
-    TEVENT(ObjectLocker);
-
     ObjectSynchronizer::fast_enter(_obj, &_lock, false, _thread);
   }
 }
@@ -482,7 +474,6 @@
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   }
   if (millis < 0) {
-    TEVENT(wait - throw IAX);
     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   }
   ObjectMonitor* monitor = ObjectSynchronizer::inflate(THREAD,
@@ -505,7 +496,6 @@
     assert(!obj->mark()->has_bias_pattern(), "biases should be revoked by now");
   }
   if (millis < 0) {
-    TEVENT(wait - throw IAX);
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(), "timeout value is negative");
   }
   ObjectSynchronizer::inflate(THREAD,
@@ -608,7 +598,6 @@
     if (its > 10000 || !os::is_MP()) {
       if (its & 1) {
         os::naked_yield();
-        TEVENT(Inflate: INFLATING - yield);
       } else {
         // Note that the following code attenuates the livelock problem but is not
         // a complete remedy.  A more complete solution would require that the inflating
@@ -641,7 +630,6 @@
           }
         }
         Thread::muxRelease(gInflationLocks + ix);
-        TEVENT(Inflate: INFLATING - yield/park);
       }
     } else {
       SpinPause();       // SMP-polite spinning
@@ -703,7 +691,6 @@
   value &= markOopDesc::hash_mask;
   if (value == 0) value = 0xBAD;
   assert(value != markOopDesc::no_hash, "invariant");
-  TEVENT(hashCode: GENERATE);
   return value;
 }
 
@@ -1154,7 +1141,6 @@
       Thread::muxRelease(&gListLock);
       Self->omFreeProvision += 1 + (Self->omFreeProvision/2);
       if (Self->omFreeProvision > MAXPRIVATE) Self->omFreeProvision = MAXPRIVATE;
-      TEVENT(omFirst - reprovision);
 
       const int mx = MonitorBound;
       if (mx > 0 && (gMonitorPopulation-gMonitorFreeCount) > mx) {
@@ -1232,7 +1218,6 @@
     temp[_BLOCKSIZE - 1].FreeNext = gFreeList;
     gFreeList = temp + 1;
     Thread::muxRelease(&gListLock);
-    TEVENT(Allocate block of monitors);
   }
 }
 
@@ -1317,7 +1302,6 @@
       guarantee(s->object() == NULL, "invariant");
       guarantee(!s->is_busy(), "invariant");
       s->set_owner(NULL);   // redundant but good hygiene
-      TEVENT(omFlush - Move one);
     }
     guarantee(tail != NULL && list != NULL, "invariant");
   }
@@ -1357,7 +1341,6 @@
   }
 
   Thread::muxRelease(&gListLock);
-  TEVENT(omFlush);
 }
 
 static void post_monitor_inflate_event(EventJavaMonitorInflate* event,
@@ -1422,7 +1405,6 @@
     // Currently, we spin/yield/park and poll the markword, waiting for inflation to finish.
     // We could always eliminate polling by parking the thread on some auxiliary list.
     if (mark == markOopDesc::INFLATING()) {
-      TEVENT(Inflate: spin while INFLATING);
       ReadStableMark(object);
       continue;
     }
@@ -1515,7 +1497,6 @@
       // Hopefully the performance counters are allocated on distinct cache lines
       // to avoid false sharing on MP systems ...
       OM_PERFDATA_OP(Inflations, inc());
-      TEVENT(Inflate: overwrite stacklock);
       if (log_is_enabled(Debug, monitorinflation)) {
         if (object->is_instance()) {
           ResourceMark rm;
@@ -1566,7 +1547,6 @@
     // Hopefully the performance counters are allocated on distinct
     // cache lines to avoid false sharing on MP systems ...
     OM_PERFDATA_OP(Inflations, inc());
-    TEVENT(Inflate: overwrite neutral);
     if (log_is_enabled(Debug, monitorinflation)) {
       if (object->is_instance()) {
         ResourceMark rm;
@@ -1633,7 +1613,6 @@
     // Deflate the monitor if it is no longer being used
     // It's idle - scavenge and return to the global free list
     // plain old deflation ...
-    TEVENT(deflate_idle_monitors - scavenge1);
     if (log_is_enabled(Debug, monitorinflation)) {
       if (obj->is_instance()) {
         ResourceMark rm;
@@ -1719,7 +1698,6 @@
   ObjectMonitor * freeHeadp = NULL;  // Local SLL of scavenged monitors
   ObjectMonitor * freeTailp = NULL;
 
-  TEVENT(deflate_idle_monitors);
   // Prevent omFlush from changing mids in Thread dtor's during deflation
   // And in case the vm thread is acquiring a lock during a safepoint
   // See e.g. 6320749
--- a/src/hotspot/share/runtime/thread.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -4736,7 +4736,6 @@
   }
 
   // Slow-path : We've encountered contention -- Spin/Yield/Block strategy.
-  TEVENT(SpinAcquire - ctx);
   int ctr = 0;
   int Yields = 0;
   for (;;) {
@@ -4831,7 +4830,6 @@
     return;
   }
 
-  TEVENT(muxAcquire - Contention);
   ParkEvent * const Self = Thread::current()->_MuxEvent;
   assert((intptr_t(Self) & LOCKBIT) == 0, "invariant");
   for (;;) {
@@ -4877,7 +4875,6 @@
     return;
   }
 
-  TEVENT(muxAcquire - Contention);
   ParkEvent * ReleaseAfter = NULL;
   if (ev == NULL) {
     ev = ReleaseAfter = ParkEvent::Allocate(NULL);
--- a/src/hotspot/share/runtime/thread.hpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/hotspot/share/runtime/thread.hpp	Tue Sep 18 16:41:24 2018 -0700
@@ -698,20 +698,10 @@
 
   static ByteSize polling_page_offset()          { return byte_offset_of(Thread, _polling_page); }
 
-#define TLAB_FIELD_OFFSET(name) \
-  static ByteSize tlab_##name##_offset()         { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::name##_offset(); }
-
-  TLAB_FIELD_OFFSET(start)
-  TLAB_FIELD_OFFSET(end)
-  TLAB_FIELD_OFFSET(top)
-  TLAB_FIELD_OFFSET(pf_top)
-  TLAB_FIELD_OFFSET(size)                   // desired_size
-  TLAB_FIELD_OFFSET(refill_waste_limit)
-  TLAB_FIELD_OFFSET(number_of_refills)
-  TLAB_FIELD_OFFSET(fast_refill_waste)
-  TLAB_FIELD_OFFSET(slow_allocations)
-
-#undef TLAB_FIELD_OFFSET
+  static ByteSize tlab_start_offset()            { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::start_offset(); }
+  static ByteSize tlab_end_offset()              { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::end_offset(); }
+  static ByteSize tlab_top_offset()              { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::top_offset(); }
+  static ByteSize tlab_pf_top_offset()           { return byte_offset_of(Thread, _tlab) + ThreadLocalAllocBuffer::pf_top_offset(); }
 
   static ByteSize allocated_bytes_offset()       { return byte_offset_of(Thread, _allocated_bytes); }
 
--- a/src/java.base/share/classes/java/lang/ClassNotFoundException.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/ClassNotFoundException.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,6 +25,11 @@
 
 package java.lang;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+
 /**
  * Thrown when an application tries to load in a class through its
  * string name using:
@@ -57,15 +62,6 @@
      private static final long serialVersionUID = 9176873029745254542L;
 
     /**
-     * This field holds the exception ex if the
-     * ClassNotFoundException(String s, Throwable ex) constructor was
-     * used to instantiate the object
-     * @serial
-     * @since 1.2
-     */
-    private Throwable ex;
-
-    /**
      * Constructs a <code>ClassNotFoundException</code> with no detail message.
      */
     public ClassNotFoundException() {
@@ -92,8 +88,7 @@
      * @since 1.2
      */
     public ClassNotFoundException(String s, Throwable ex) {
-        super(s, null);  //  Disallow initCause
-        this.ex = ex;
+        super(s, ex);  //  Disallow initCause
     }
 
     /**
@@ -108,18 +103,42 @@
      * @since 1.2
      */
     public Throwable getException() {
-        return ex;
+        return super.getCause();
     }
 
     /**
-     * Returns the cause of this exception (the exception that was raised
-     * if an error occurred while attempting to load the class; otherwise
-     * {@code null}).
+     * Serializable fields for ClassNotFoundException.
+     *
+     * @serialField ex Throwable
+     */
+    private static final ObjectStreamField[] serialPersistentFields = {
+        new ObjectStreamField("ex", Throwable.class)
+    };
+
+    /*
+     * Reconstitutes the ClassNotFoundException instance from a stream
+     * and initialize the cause properly when deserializing from an older
+     * version.
      *
-     * @return  the cause of this exception.
-     * @since   1.4
+     * The getException and getCause method returns the private "ex" field
+     * in the older implementation and ClassNotFoundException::cause
+     * was set to null.
      */
-    public Throwable getCause() {
-        return ex;
+    private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
+        ObjectInputStream.GetField fields = s.readFields();
+        Throwable exception = (Throwable) fields.get("ex", null);
+        if (exception != null) {
+            setCause(exception);
+        }
+    }
+
+    /*
+     * To maintain compatibility with older implementation, write a serial
+     * "ex" field with the cause as the value.
+     */
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        ObjectOutputStream.PutField fields = out.putFields();
+        fields.put("ex", super.getCause());
+        out.writeFields();
     }
 }
--- a/src/java.base/share/classes/java/lang/ExceptionInInitializerError.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/ExceptionInInitializerError.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,6 +25,11 @@
 
 package java.lang;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+
 /**
  * Signals that an unexpected exception has occurred in a static initializer.
  * An <code>ExceptionInInitializerError</code> is thrown to indicate that an
@@ -48,23 +53,13 @@
     private static final long serialVersionUID = 1521711792217232256L;
 
     /**
-     * This field holds the exception if the
-     * ExceptionInInitializerError(Throwable thrown) constructor was
-     * used to instantiate the object
-     *
-     * @serial
-     *
-     */
-    private Throwable exception;
-
-    /**
      * Constructs an <code>ExceptionInInitializerError</code> with
      * <code>null</code> as its detail message string and with no saved
      * throwable object.
      * A detail message is a String that describes this particular exception.
      */
     public ExceptionInInitializerError() {
-        initCause(null);  // Disallow subsequent initCause
+        initCause(null); // Disallow subsequent initCause
     }
 
     /**
@@ -76,23 +71,20 @@
      * @param thrown The exception thrown
      */
     public ExceptionInInitializerError(Throwable thrown) {
-        initCause(null);  // Disallow subsequent initCause
-        this.exception = thrown;
+        super(null, thrown); // Disallow subsequent initCause
     }
 
     /**
-     * Constructs an ExceptionInInitializerError with the specified detail
+     * Constructs an {@code ExceptionInInitializerError} with the specified detail
      * message string.  A detail message is a String that describes this
      * particular exception. The detail message string is saved for later
      * retrieval by the {@link Throwable#getMessage()} method. There is no
      * saved throwable object.
      *
-     *
      * @param s the detail message
      */
     public ExceptionInInitializerError(String s) {
-        super(s);
-        initCause(null);  // Disallow subsequent initCause
+        super(s, null);  // Disallow subsequent initCause
     }
 
     /**
@@ -109,18 +101,43 @@
      *         throwable object.
      */
     public Throwable getException() {
-        return exception;
+        return super.getCause();
     }
 
     /**
-     * Returns the cause of this error (the exception that occurred
-     * during a static initialization that caused this error to be created).
+     * Serializable fields for ExceptionInInitializerError.
+     *
+     * @serialField exception Throwable
+     */
+    private static final ObjectStreamField[] serialPersistentFields = {
+        new ObjectStreamField("exception", Throwable.class)
+    };
+
+    /*
+     * Reconstitutes the ExceptionInInitializerError instance from a stream
+     * and initialize the cause properly when deserializing from an older
+     * version.
      *
-     * @return  the cause of this error or <code>null</code> if the
-     *          cause is nonexistent or unknown.
-     * @since   1.4
+     * The getException and getCause method returns the private "exception"
+     * field in the older implementation and ExceptionInInitializerError::cause
+     * was set to null.
      */
-    public Throwable getCause() {
-        return exception;
+    private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
+        ObjectInputStream.GetField fields = s.readFields();
+        Throwable exception = (Throwable) fields.get("exception", null);
+        if (exception != null) {
+            setCause(exception);
+        }
     }
+
+    /*
+     * To maintain compatibility with older implementation, write a serial
+     * "exception" field with the cause as the value.
+     */
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        ObjectOutputStream.PutField fields = out.putFields();
+        fields.put("exception", super.getCause());
+        out.writeFields();
+    }
+
 }
--- a/src/java.base/share/classes/java/lang/ModuleLayer.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/ModuleLayer.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -790,8 +790,7 @@
             // push in reverse order
             for (int i = layer.parents.size() - 1; i >= 0; i--) {
                 ModuleLayer parent = layer.parents.get(i);
-                if (!visited.contains(parent)) {
-                    visited.add(parent);
+                if (visited.add(parent)) {
                     stack.push(parent);
                 }
             }
--- a/src/java.base/share/classes/java/lang/Object.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/Object.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -455,7 +455,7 @@
                                 "nanosecond timeout value out of range");
         }
 
-        if (nanos > 0) {
+        if (nanos > 0 && timeoutMillis < Long.MAX_VALUE) {
             timeoutMillis++;
         }
 
--- a/src/java.base/share/classes/java/lang/String.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/String.java	Tue Sep 18 16:41:24 2018 -0700
@@ -40,12 +40,15 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.PatternSyntaxException;
+import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 import java.util.stream.Stream;
 import java.util.stream.StreamSupport;
 import jdk.internal.HotSpotIntrinsicCandidate;
 import jdk.internal.vm.annotation.Stable;
 
+import static java.util.function.Predicate.not;
+
 /**
  * The {@code String} class represents character strings. All
  * string literals in Java programs, such as {@code "abc"}, are
@@ -2755,12 +2758,9 @@
         return indexOfNonWhitespace() == length();
     }
 
-    private int indexOfNonWhitespace() {
-        if (isLatin1()) {
-            return StringLatin1.indexOfNonWhitespace(value);
-        } else {
-            return StringUTF16.indexOfNonWhitespace(value);
-        }
+    private Stream<String> lines(int maxLeading, int maxTrailing) {
+        return isLatin1() ? StringLatin1.lines(value, maxLeading, maxTrailing)
+                          : StringUTF16.lines(value, maxLeading, maxTrailing);
     }
 
     /**
@@ -2794,8 +2794,181 @@
      * @since 11
      */
     public Stream<String> lines() {
-        return isLatin1() ? StringLatin1.lines(value)
-                          : StringUTF16.lines(value);
+        return lines(0, 0);
+    }
+
+    /**
+     * Adjusts the indentation of each line of this string based on the value of
+     * {@code n}, and normalizes line termination characters.
+     * <p>
+     * This string is conceptually separated into lines using
+     * {@link String#lines()}. Each line is then adjusted as described below
+     * and then suffixed with a line feed {@code "\n"} (U+000A). The resulting
+     * lines are then concatenated and returned.
+     * <p>
+     * If {@code n > 0} then {@code n} spaces (U+0020) are inserted at the
+     * beginning of each line. {@link String#isBlank() Blank lines} are
+     * unaffected.
+     * <p>
+     * If {@code n < 0} then up to {@code n}
+     * {@link Character#isWhitespace(int) white space characters} are removed
+     * from the beginning of each line. If a given line does not contain
+     * sufficient white space then all leading
+     * {@link Character#isWhitespace(int) white space characters} are removed.
+     * Each white space character is treated as a single character. In
+     * particular, the tab character {@code "\t"} (U+0009) is considered a
+     * single character; it is not expanded.
+     * <p>
+     * If {@code n == 0} then the line remains unchanged. However, line
+     * terminators are still normalized.
+     * <p>
+     *
+     * @param n  number of leading
+     *           {@link Character#isWhitespace(int) white space characters}
+     *           to add or remove
+     *
+     * @return string with indentation adjusted and line endings normalized
+     *
+     * @see String#lines()
+     * @see String#isBlank()
+     * @see Character#isWhitespace(int)
+     *
+     * @since 12
+     */
+    public String indent(int n) {
+        return isEmpty() ? "" :  indent(n, false);
+    }
+
+    private String indent(int n, boolean removeBlanks) {
+        Stream<String> stream = removeBlanks ? lines(Integer.MAX_VALUE, Integer.MAX_VALUE)
+                                             : lines();
+        if (n > 0) {
+            final String spaces = " ".repeat(n);
+            stream = stream.map(s -> s.isBlank() ? s : spaces + s);
+        } else if (n == Integer.MIN_VALUE) {
+            stream = stream.map(s -> s.stripLeading());
+        } else if (n < 0) {
+            stream = stream.map(s -> s.substring(Math.min(-n, s.indexOfNonWhitespace())));
+        }
+        return stream.collect(Collectors.joining("\n", "", "\n"));
+    }
+
+    private int indexOfNonWhitespace() {
+        return isLatin1() ? StringLatin1.indexOfNonWhitespace(value)
+                          : StringUTF16.indexOfNonWhitespace(value);
+    }
+
+    private int lastIndexOfNonWhitespace() {
+        return isLatin1() ? StringLatin1.lastIndexOfNonWhitespace(value)
+                          : StringUTF16.lastIndexOfNonWhitespace(value);
+    }
+
+    /**
+     * Removes vertical and horizontal white space margins from around the
+     * essential body of a multi-line string, while preserving relative
+     * indentation.
+     * <p>
+     * This string is first conceptually separated into lines as if by
+     * {@link String#lines()}.
+     * <p>
+     * Then, the <i>minimum indentation</i> (min) is determined as follows. For
+     * each non-blank line (as defined by {@link String#isBlank()}), the
+     * leading {@link Character#isWhitespace(int) white space} characters are
+     * counted. The <i>min</i> value is the smallest of these counts.
+     * <p>
+     * For each non-blank line, <i>min</i> leading white space characters are
+     * removed. Each white space character is treated as a single character. In
+     * particular, the tab character {@code "\t"} (U+0009) is considered a
+     * single character; it is not expanded.
+     * <p>
+     * Leading and trailing blank lines, if any, are removed. Trailing spaces are
+     * preserved.
+     * <p>
+     * Each line is suffixed with a line feed character {@code "\n"} (U+000A).
+     * <p>
+     * Finally, the lines are concatenated into a single string and returned.
+     *
+     * @apiNote
+     * This method's primary purpose is to shift a block of lines as far as
+     * possible to the left, while preserving relative indentation. Lines
+     * that were indented the least will thus have no leading white space.
+     *
+     * Example:
+     * <blockquote><pre>
+     * `
+     *      This is the first line
+     *          This is the second line
+     * `.align();
+     *
+     * returns
+     * This is the first line
+     *     This is the second line
+     * </pre></blockquote>
+     *
+     * @return string with margins removed and line terminators normalized
+     *
+     * @see String#lines()
+     * @see String#isBlank()
+     * @see String#indent(int)
+     * @see Character#isWhitespace(int)
+     *
+     * @since 12
+     */
+    public String align() {
+        return align(0);
+    }
+
+    /**
+     * Removes vertical and horizontal white space margins from around the
+     * essential body of a multi-line string, while preserving relative
+     * indentation and with optional indentation adjustment.
+     * <p>
+     * Invoking this method is equivalent to:
+     * <blockquote>
+     *  {@code this.align().indent(n)}
+     * </blockquote>
+     *
+     * @apiNote
+     * Examples:
+     * <blockquote><pre>
+     * `
+     *      This is the first line
+     *          This is the second line
+     * `.align(0);
+     *
+     * returns
+     * This is the first line
+     *     This is the second line
+     *
+     *
+     * `
+     *    This is the first line
+     *       This is the second line
+     * `.align(4);
+     * returns
+     *     This is the first line
+     *         This is the second line
+     * </pre></blockquote>
+     *
+     * @param n  number of leading white space characters
+     *           to add or remove
+     *
+     * @return string with margins removed, indentation adjusted and
+     *         line terminators normalized
+     *
+     * @see String#align()
+     *
+     * @since 12
+     */
+    public String align(int n) {
+        if (isEmpty()) {
+            return "";
+        }
+        int outdent = lines().filter(not(String::isBlank))
+                             .mapToInt(String::indexOfNonWhitespace)
+                             .min()
+                             .orElse(0);
+        return indent(n - outdent, true);
     }
 
     /**
--- a/src/java.base/share/classes/java/lang/StringLatin1.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/StringLatin1.java	Tue Sep 18 16:41:24 2018 -0700
@@ -545,7 +545,7 @@
         int length = value.length;
         int left = 0;
         while (left < length) {
-            char ch = (char)(value[left] & 0xff);
+            char ch = getChar(value, left);
             if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
                 break;
             }
@@ -558,7 +558,7 @@
         int length = value.length;
         int right = length;
         while (0 < right) {
-            char ch = (char)(value[right - 1] & 0xff);
+            char ch = getChar(value, right - 1);
             if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
                 break;
             }
@@ -573,7 +573,8 @@
             return "";
         }
         int right = lastIndexOfNonWhitespace(value);
-        return ((left > 0) || (right < value.length)) ? newString(value, left, right - left) : null;
+        boolean ifChanged = (left > 0) || (right < value.length);
+        return ifChanged ? newString(value, left, right - left) : null;
     }
 
     public static String stripLeading(byte[] value) {
@@ -597,11 +598,7 @@
         private int index;        // current index, modified on advance/split
         private final int fence;  // one past last index
 
-        LinesSpliterator(byte[] value) {
-            this(value, 0, value.length);
-        }
-
-        LinesSpliterator(byte[] value, int start, int length) {
+        private LinesSpliterator(byte[] value, int start, int length) {
             this.value = value;
             this.index = start;
             this.fence = start + length;
@@ -609,7 +606,7 @@
 
         private int indexOfLineSeparator(int start) {
             for (int current = start; current < fence; current++) {
-                byte ch = value[current];
+                char ch = getChar(value, current);
                 if (ch == '\n' || ch == '\r') {
                     return current;
                 }
@@ -619,9 +616,9 @@
 
         private int skipLineSeparator(int start) {
             if (start < fence) {
-                if (value[start] == '\r') {
+                if (getChar(value, start) == '\r') {
                     int next = start + 1;
-                    if (next < fence && value[next] == '\n') {
+                    if (next < fence && getChar(value, next) == '\n') {
                         return next + 1;
                     }
                 }
@@ -680,10 +677,80 @@
         public int characteristics() {
             return Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL;
         }
+
+        static LinesSpliterator spliterator(byte[] value) {
+            return new LinesSpliterator(value, 0, value.length);
+        }
+
+        static LinesSpliterator spliterator(byte[] value, int leading, int trailing) {
+            int length = value.length;
+            int left = 0;
+            int index;
+            for (int l = 0; l < leading; l++) {
+                index = skipBlankForward(value, left, length);
+                if (index == left) {
+                    break;
+                }
+                left = index;
+            }
+            int right = length;
+            for (int t = 0; t < trailing; t++) {
+                index = skipBlankBackward(value, left, right);
+                if (index == right) {
+                    break;
+                }
+                right = index;
+            }
+            return new LinesSpliterator(value, left, right - left);
+        }
+
+        private static int skipBlankForward(byte[] value, int start, int length) {
+            int index = start;
+            while (index < length) {
+                char ch = getChar(value, index++);
+                if (ch == '\n') {
+                    return index;
+                }
+                if (ch == '\r') {
+                    if (index < length && getChar(value, index) == '\n') {
+                        return index + 1;
+                    }
+                    return index;
+                }
+                if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
+                    return start;
+                }
+            }
+            return length;
+        }
+
+        private static int skipBlankBackward(byte[] value, int start, int fence) {
+            int index = fence;
+            if (start < index && getChar(value, index - 1) == '\n') {
+                index--;
+            }
+            if (start < index && getChar(value, index - 1) == '\r') {
+                index--;
+            }
+            while (start < index) {
+                char ch = getChar(value, --index);
+                if (ch == '\r' || ch == '\n') {
+                    return index + 1;
+                }
+                if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
+                    return fence;
+                }
+            }
+            return start;
+        }
     }
 
-    static Stream<String> lines(byte[] value) {
-        return StreamSupport.stream(new LinesSpliterator(value), false);
+    static Stream<String> lines(byte[] value, int leading, int trailing) {
+        if (leading == 0 && trailing == 0) {
+            return StreamSupport.stream(LinesSpliterator.spliterator(value), false);
+        } else {
+            return StreamSupport.stream(LinesSpliterator.spliterator(value, leading, trailing), false);
+        }
     }
 
     public static void putChar(byte[] val, int index, int c) {
--- a/src/java.base/share/classes/java/lang/StringUTF16.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/StringUTF16.java	Tue Sep 18 16:41:24 2018 -0700
@@ -859,7 +859,6 @@
             null;
     }
 
-
     public static int indexOfNonWhitespace(byte[] value) {
         int length = value.length >> 1;
         int left = 0;
@@ -874,7 +873,7 @@
     }
 
     public static int lastIndexOfNonWhitespace(byte[] value) {
-        int length = value.length >> 1;
+        int length = value.length >>> 1;
         int right = length;
         while (0 < right) {
             int codepoint = codePointBefore(value, right);
@@ -887,17 +886,18 @@
     }
 
     public static String strip(byte[] value) {
-        int length = value.length >> 1;
+        int length = value.length >>> 1;
         int left = indexOfNonWhitespace(value);
         if (left == length) {
             return "";
         }
         int right = lastIndexOfNonWhitespace(value);
-        return ((left > 0) || (right < length)) ? newString(value, left, right - left) : null;
+        boolean ifChanged = (left > 0) || (right < length);
+        return ifChanged ? newString(value, left, right - left) : null;
     }
 
     public static String stripLeading(byte[] value) {
-        int length = value.length >> 1;
+        int length = value.length >>> 1;
         int left = indexOfNonWhitespace(value);
         if (left == length) {
             return "";
@@ -906,7 +906,7 @@
     }
 
     public static String stripTrailing(byte[] value) {
-        int length = value.length >> 1;
+        int length = value.length >>> 1;
         int right = lastIndexOfNonWhitespace(value);
         if (right == 0) {
             return "";
@@ -919,11 +919,7 @@
         private int index;        // current index, modified on advance/split
         private final int fence;  // one past last index
 
-        LinesSpliterator(byte[] value) {
-            this(value, 0, value.length >>> 1);
-        }
-
-        LinesSpliterator(byte[] value, int start, int length) {
+        private LinesSpliterator(byte[] value, int start, int length) {
             this.value = value;
             this.index = start;
             this.fence = start + length;
@@ -1002,10 +998,80 @@
         public int characteristics() {
             return Spliterator.ORDERED | Spliterator.IMMUTABLE | Spliterator.NONNULL;
         }
+
+        static LinesSpliterator spliterator(byte[] value) {
+            return new LinesSpliterator(value, 0, value.length >>> 1);
+        }
+
+        static LinesSpliterator spliterator(byte[] value, int leading, int trailing) {
+            int length = value.length >>> 1;
+            int left = 0;
+            int index;
+            for (int l = 0; l < leading; l++) {
+                index = skipBlankForward(value, left, length);
+                if (index == left) {
+                    break;
+                }
+                left = index;
+            }
+            int right = length;
+            for (int t = 0; t < trailing; t++) {
+                index = skipBlankBackward(value, left, right);
+                if (index == right) {
+                    break;
+                }
+                right = index;
+            }
+            return new LinesSpliterator(value, left, right - left);
+        }
+
+        private static int skipBlankForward(byte[] value, int start, int length) {
+            int index = start;
+            while (index < length) {
+                char ch = getChar(value, index++);
+                if (ch == '\n') {
+                    return index;
+                }
+                if (ch == '\r') {
+                    if (index < length && getChar(value, index) == '\n') {
+                        return index + 1;
+                    }
+                    return index;
+                }
+                if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
+                    return start;
+                }
+            }
+            return length;
+        }
+
+        private static int skipBlankBackward(byte[] value, int start, int fence) {
+            int index = fence;
+            if (start < index && getChar(value, index - 1) == '\n') {
+                index--;
+            }
+            if (start < index && getChar(value, index - 1) == '\r') {
+                index--;
+            }
+            while (start < index) {
+                char ch = getChar(value, --index);
+                if (ch == '\r' || ch == '\n') {
+                    return index + 1;
+                }
+                if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
+                    return fence;
+                }
+            }
+            return start;
+        }
     }
 
-    static Stream<String> lines(byte[] value) {
-        return StreamSupport.stream(new LinesSpliterator(value), false);
+    static Stream<String> lines(byte[] value, int leading, int trailing) {
+        if (leading == 0 && trailing == 0) {
+            return StreamSupport.stream(LinesSpliterator.spliterator(value), false);
+        } else {
+            return StreamSupport.stream(LinesSpliterator.spliterator(value, leading, trailing), false);
+        }
     }
 
     private static void putChars(byte[] val, int index, char[] str, int off, int end) {
--- a/src/java.base/share/classes/java/lang/System.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/System.java	Tue Sep 18 16:41:24 2018 -0700
@@ -2201,6 +2201,9 @@
                 return StringCoding.getBytesUTF8NoRepl(s);
             }
 
+            public void setCause(Throwable t, Throwable cause) {
+                t.setCause(cause);
+            }
         });
     }
 }
--- a/src/java.base/share/classes/java/lang/Thread.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/Thread.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,6 +35,7 @@
 import java.util.HashMap;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.LockSupport;
 
 import jdk.internal.misc.TerminatingThreadLocal;
@@ -332,7 +333,7 @@
                                 "nanosecond timeout value out of range");
         }
 
-        if (nanos >= 500000 || (nanos != 0 && millis == 0)) {
+        if (nanos > 0 && millis < Long.MAX_VALUE) {
             millis++;
         }
 
@@ -1291,28 +1292,23 @@
      *          <i>interrupted status</i> of the current thread is
      *          cleared when this exception is thrown.
      */
-    public final synchronized void join(long millis)
+    public final synchronized void join(final long millis)
     throws InterruptedException {
-        long base = System.currentTimeMillis();
-        long now = 0;
-
-        if (millis < 0) {
-            throw new IllegalArgumentException("timeout value is negative");
-        }
-
-        if (millis == 0) {
+        if (millis > 0) {
+            if (isAlive()) {
+                final long startTime = System.nanoTime();
+                long delay = millis;
+                do {
+                    wait(delay);
+                } while (isAlive() && (delay = millis -
+                        TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - startTime)) > 0);
+            }
+        } else if (millis == 0) {
             while (isAlive()) {
                 wait(0);
             }
         } else {
-            while (isAlive()) {
-                long delay = millis - now;
-                if (delay <= 0) {
-                    break;
-                }
-                wait(delay);
-                now = System.currentTimeMillis() - base;
-            }
+            throw new IllegalArgumentException("timeout value is negative");
         }
     }
 
@@ -1353,7 +1349,7 @@
                                 "nanosecond timeout value out of range");
         }
 
-        if (nanos >= 500000 || (nanos != 0 && millis == 0)) {
+        if (nanos > 0 && millis < Long.MAX_VALUE) {
             millis++;
         }
 
--- a/src/java.base/share/classes/java/lang/Throwable.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/Throwable.java	Tue Sep 18 16:41:24 2018 -0700
@@ -466,6 +466,16 @@
         return this;
     }
 
+    /*
+     * This is called by readObject of a few exceptions such as
+     * ClassNotFoundException and ExceptionInInitializerError to deserialize
+     * a stream output from an older runtime version where the cause may
+     * have set to null.
+     */
+    final void setCause(Throwable t) {
+        this.cause = t;
+    }
+
     /**
      * Returns a short description of this throwable.
      * The result is the concatenation of:
--- a/src/java.base/share/classes/java/lang/module/Configuration.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/module/Configuration.java	Tue Sep 18 16:41:24 2018 -0700
@@ -601,8 +601,7 @@
                 // push in reverse order
                 for (int i = layer.parents.size() - 1; i >= 0; i--) {
                     Configuration parent = layer.parents.get(i);
-                    if (!visited.contains(parent)) {
-                        visited.add(parent);
+                    if (visited.add(parent)) {
                         stack.push(parent);
                     }
                 }
--- a/src/java.base/share/classes/java/lang/reflect/UndeclaredThrowableException.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/lang/reflect/UndeclaredThrowableException.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,6 +25,12 @@
 
 package java.lang.reflect;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import jdk.internal.misc.SharedSecrets;
+
 /**
  * Thrown by a method invocation on a proxy instance if its invocation
  * handler's {@link InvocationHandler#invoke invoke} method throws a
@@ -59,12 +65,6 @@
     static final long serialVersionUID = 330127114055056639L;
 
     /**
-     * the undeclared checked exception that was thrown
-     * @serial
-     */
-    private Throwable undeclaredThrowable;
-
-    /**
      * Constructs an {@code UndeclaredThrowableException} with the
      * specified {@code Throwable}.
      *
@@ -72,8 +72,7 @@
      *          that was thrown
      */
     public UndeclaredThrowableException(Throwable undeclaredThrowable) {
-        super((Throwable) null);  // Disallow initCause
-        this.undeclaredThrowable = undeclaredThrowable;
+        super(null, undeclaredThrowable);  // Disallow initCause
     }
 
     /**
@@ -87,8 +86,7 @@
     public UndeclaredThrowableException(Throwable undeclaredThrowable,
                                         String s)
     {
-        super(s, null);  // Disallow initCause
-        this.undeclaredThrowable = undeclaredThrowable;
+        super(s, undeclaredThrowable);  // Disallow initCause
     }
 
     /**
@@ -102,18 +100,38 @@
      * @return the undeclared checked exception that was thrown
      */
     public Throwable getUndeclaredThrowable() {
-        return undeclaredThrowable;
+        return super.getCause();
     }
 
     /**
-     * Returns the cause of this exception (the {@code Throwable}
-     * instance wrapped in this {@code UndeclaredThrowableException},
-     * which may be {@code null}).
+     * Serializable fields for UndeclaredThrowableException.
      *
-     * @return  the cause of this exception.
-     * @since   1.4
+     * @serialField undeclaredThrowable Throwable
+     */
+    private static final ObjectStreamField[] serialPersistentFields = {
+        new ObjectStreamField("undeclaredThrowable", Throwable.class)
+    };
+
+    /*
+     * Reconstitutes the UndeclaredThrowableException instance from a stream
+     * and initialize the cause properly when deserializing from an older
+     * version.
      */
-    public Throwable getCause() {
-        return undeclaredThrowable;
+    private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
+        ObjectInputStream.GetField fields = s.readFields();
+        Throwable exception = (Throwable) fields.get("undeclaredThrowable", null);
+        if (exception != null) {
+            SharedSecrets.getJavaLangAccess().setCause(this, exception);
+        }
+    }
+
+    /*
+     * To maintain compatibility with older implementation, write a serial
+     * "ex" field with the cause as the value.
+     */
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        ObjectOutputStream.PutField fields = out.putFields();
+        fields.put("undeclaredThrowable", super.getCause());
+        out.writeFields();
     }
 }
--- a/src/java.base/share/classes/java/net/CookieManager.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/net/CookieManager.java	Tue Sep 18 16:41:24 2018 -0700
@@ -241,7 +241,7 @@
         }
 
         // apply sort rule (RFC 2965 sec. 3.3.4)
-        List<String> cookieHeader = sortByPath(cookies);
+        List<String> cookieHeader = sortByPathAndAge(cookies);
 
         return Map.of("Cookie", cookieHeader);
     }
@@ -402,11 +402,12 @@
 
 
     /*
-     * sort cookies with respect to their path: those with more specific Path attributes
-     * precede those with less specific, as defined in RFC 2965 sec. 3.3.4
+     * sort cookies with respect to their path and age: those with more longer Path attributes
+     * precede those with shorter, as defined in RFC 6265. Cookies with the same length
+     * path are distinguished by creation time (older first). Method made PP to enable testing.
      */
-    private List<String> sortByPath(List<HttpCookie> cookies) {
-        Collections.sort(cookies, new CookiePathComparator());
+    static List<String> sortByPathAndAge(List<HttpCookie> cookies) {
+        Collections.sort(cookies, new CookieComparator());
 
         List<String> cookieHeader = new java.util.ArrayList<>();
         for (HttpCookie cookie : cookies) {
@@ -424,22 +425,36 @@
     }
 
 
-    static class CookiePathComparator implements Comparator<HttpCookie> {
+    // Comparator compares the length of the path. Longer paths should precede shorter ones.
+    // As per rfc6265 cookies with equal path lengths sort on creation time.
+
+    static class CookieComparator implements Comparator<HttpCookie> {
         public int compare(HttpCookie c1, HttpCookie c2) {
             if (c1 == c2) return 0;
             if (c1 == null) return -1;
             if (c2 == null) return 1;
 
-            // path rule only applies to the cookies with same name
-            if (!c1.getName().equals(c2.getName())) return 0;
+            String p1 = c1.getPath();
+            String p2 = c2.getPath();
+            p1 = (p1 == null) ? "" : p1;
+            p2 = (p2 == null) ? "" : p2;
+            int len1 = p1.length();
+            int len2 = p2.length();
+            if (len1 > len2)
+                return -1;
+            if (len2 > len1)
+                return 1;
 
-            // those with more specific Path attributes precede those with less specific
-            if (c1.getPath().startsWith(c2.getPath()))
+            // Check creation time. Sort older first
+            long creation1 = c1.getCreationTime();
+            long creation2 = c2.getCreationTime();
+            if (creation1 < creation2) {
                 return -1;
-            else if (c2.getPath().startsWith(c1.getPath()))
+            }
+            if (creation1 > creation2) {
                 return 1;
-            else
-                return 0;
+            }
+            return 0;
         }
     }
 }
--- a/src/java.base/share/classes/java/net/HttpCookie.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/net/HttpCookie.java	Tue Sep 18 16:41:24 2018 -0700
@@ -142,6 +142,13 @@
     }
 
     private HttpCookie(String name, String value, String header) {
+        this(name, value, header, System.currentTimeMillis());
+    }
+
+    /**
+     * Package private for testing purposes.
+     */
+    HttpCookie(String name, String value, String header, long creationTime) {
         name = name.trim();
         if (name.length() == 0 || !isToken(name) || name.charAt(0) == '$') {
             throw new IllegalArgumentException("Illegal cookie name");
@@ -152,7 +159,7 @@
         toDiscard = false;
         secure = false;
 
-        whenCreated = System.currentTimeMillis();
+        whenCreated = creationTime;
         portlist = null;
         this.header = header;
     }
@@ -756,6 +763,11 @@
             throw new RuntimeException(e.getMessage());
         }
     }
+    // ---------------- Package private operations --------------
+
+    long getCreationTime() {
+        return whenCreated;
+    }
 
     // ---------------- Private operations --------------
 
--- a/src/java.base/share/classes/java/nio/file/Paths.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/nio/file/Paths.java	Tue Sep 18 16:41:24 2018 -0700
@@ -73,7 +73,8 @@
      * Converts the given URI to a {@link Path} object.
      *
      * @implSpec
-     * This method simply invokes {@link Path#of(URI) * Path.of(URI)} with the given parameter.
+     * This method simply invokes {@link Path#of(URI) Path.of(URI)} with the
+     * given parameter.
      *
      * @param   uri
      *          the URI to convert
--- a/src/java.base/share/classes/java/nio/file/attribute/package-info.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/nio/file/attribute/package-info.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, 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
@@ -93,7 +93,7 @@
  * <p> The {@link java.nio.file.attribute.DosFileAttributeView}
  * class extends {@code BasicFileAttributeView} by defining methods to
  * access the legacy "DOS" file attributes supported on file systems such as File
- * Allocation Tabl (FAT), commonly used in consumer devices.
+ * Allocation Table (FAT), commonly used in consumer devices.
  *
  * <p> The {@link java.nio.file.attribute.AclFileAttributeView}
  * class defines methods to read and write the Access Control List (ACL)
--- a/src/java.base/share/classes/java/security/Identity.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/security/Identity.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -351,7 +351,7 @@
 
     /**
      * Tests for equality between the specified identity and this identity.
-     * This method should be overriden by subclasses to test for equality.
+     * This method should be overridden by subclasses to test for equality.
      * The default behavior is to return true if the names and public keys
      * are equal.
      *
--- a/src/java.base/share/classes/java/security/PrivilegedActionException.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/security/PrivilegedActionException.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,6 +25,12 @@
 
 package java.security;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectStreamField;
+import jdk.internal.misc.SharedSecrets;
+
 /**
  * This exception is thrown by
  * {@code doPrivileged(PrivilegedExceptionAction)} and
@@ -53,19 +59,13 @@
     private static final long serialVersionUID = 4724086851538908602L;
 
     /**
-     * @serial
-     */
-    private Exception exception;
-
-    /**
      * Constructs a new PrivilegedActionException &quot;wrapping&quot;
      * the specific Exception.
      *
      * @param exception The exception thrown
      */
     public PrivilegedActionException(Exception exception) {
-        super((Throwable)null);  // Disallow initCause
-        this.exception = exception;
+        super(null, exception);  // Disallow initCause
     }
 
     /**
@@ -84,23 +84,49 @@
      *                                            AccessControlContext)
      */
     public Exception getException() {
-        return exception;
-    }
-
-    /**
-     * Returns the cause of this exception (the exception thrown by
-     * the privileged computation that resulted in this
-     * {@code PrivilegedActionException}).
-     *
-     * @return  the cause of this exception.
-     * @since   1.4
-     */
-    public Throwable getCause() {
-        return exception;
+        return (Exception)super.getCause();
     }
 
     public String toString() {
         String s = getClass().getName();
-        return (exception != null) ? (s + ": " + exception.toString()) : s;
+        Throwable cause = super.getCause();
+        return (cause != null) ? (s + ": " + cause.toString()) : s;
+    }
+
+
+    /**
+     * Serializable fields for UndeclaredThrowableException.
+     *
+     * @serialField undeclaredThrowable Throwable
+     */
+    private static final ObjectStreamField[] serialPersistentFields = {
+        new ObjectStreamField("exception", Exception.class)
+    };
+
+    /*
+     * Reconstitutes the PrivilegedActionException instance from a stream
+     * and initialize the cause properly when deserializing from an older
+     * version.
+     *
+     * The getException and getCause method returns the private "exception"
+     * field in the older implementation and PrivilegedActionException::cause
+     * was set to null.
+     */
+    private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
+        ObjectInputStream.GetField fields = s.readFields();
+        Exception exception = (Exception) fields.get("exception", null);
+        if (exception != null) {
+            SharedSecrets.getJavaLangAccess().setCause(this, exception);
+        }
+    }
+
+    /*
+     * To maintain compatibility with older implementation, write a serial
+     * "exception" field with the cause as the value.
+     */
+    private void writeObject(ObjectOutputStream out) throws IOException {
+        ObjectOutputStream.PutField fields = out.putFields();
+        fields.put("exception", super.getCause());
+        out.writeFields();
     }
 }
--- a/src/java.base/share/classes/java/security/Provider.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/security/Provider.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -1318,7 +1318,7 @@
      * {@code "putProviderProperty."+name}, where {@code name} is
      * the provider name, to see if it's ok to set this provider's property
      * values. If the default implementation of {@code checkSecurityAccess}
-     * is used (that is, that method is not overriden), then this results in
+     * is used (that is, that method is not overridden), then this results in
      * a call to the security manager's {@code checkPermission} method with
      * a {@code SecurityPermission("putProviderProperty."+name)}
      * permission.
@@ -1410,7 +1410,7 @@
      * the provider name, to see if it's ok to remove this provider's
      * properties. If the default implementation of
      * {@code checkSecurityAccess} is used (that is, that method is not
-     * overriden), then this results in a call to the security manager's
+     * overridden), then this results in a call to the security manager's
      * {@code checkPermission} method with a
      * {@code SecurityPermission("removeProviderProperty."+name)}
      * permission.
--- a/src/java.base/share/classes/java/security/Security.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/security/Security.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -422,7 +422,7 @@
      * method is called with the string {@code "removeProvider."+name}
      * to see if it's ok to remove the provider.
      * If the default implementation of {@code checkSecurityAccess}
-     * is used (i.e., that method is not overriden), then this will result in
+     * is used (i.e., that method is not overridden), then this will result in
      * a call to the security manager's {@code checkPermission} method
      * with a {@code SecurityPermission("removeProvider."+name)}
      * permission.
--- a/src/java.base/share/classes/java/text/RuleBasedCollator.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/text/RuleBasedCollator.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -348,7 +348,7 @@
      * Compares the character data stored in two different strings based on the
      * collation rules.  Returns information about whether a string is less
      * than, greater than or equal to another string in a language.
-     * This can be overriden in a subclass.
+     * This can be overridden in a subclass.
      *
      * @exception NullPointerException if <code>source</code> or <code>target</code> is null.
      */
@@ -567,7 +567,7 @@
     /**
      * Transforms the string into a series of characters that can be compared
      * with CollationKey.compareTo. This overrides java.text.Collator.getCollationKey.
-     * It can be overriden in a subclass.
+     * It can be overridden in a subclass.
      */
     public synchronized CollationKey getCollationKey(String source)
     {
--- a/src/java.base/share/classes/java/util/Random.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/util/Random.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2013, 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
@@ -136,7 +136,7 @@
         if (getClass() == Random.class)
             this.seed = new AtomicLong(initialScramble(seed));
         else {
-            // subclass might have overriden setSeed
+            // subclass might have overridden setSeed
             this.seed = new AtomicLong();
             setSeed(seed);
         }
--- a/src/java.base/share/classes/java/util/ServiceLoader.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java	Tue Sep 18 16:41:24 2018 -0700
@@ -938,8 +938,7 @@
                     List<ModuleLayer> parents = layer.parents();
                     for (int i = parents.size() - 1; i >= 0; i--) {
                         ModuleLayer parent = parents.get(i);
-                        if (!visited.contains(parent)) {
-                            visited.add(parent);
+                        if (visited.add(parent)) {
                             stack.push(parent);
                         }
                     }
--- a/src/java.base/share/classes/java/util/StringJoiner.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/util/StringJoiner.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, 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
@@ -77,7 +77,7 @@
     private int len;
 
     /**
-     * When overriden by the user to be non-null via {@link setEmptyValue}, the
+     * When overridden by the user to be non-null via {@link setEmptyValue}, the
      * string returned by toString() when no elements have yet been added.
      * When null, prefix + suffix is used as the empty value.
      */
--- a/src/java.base/share/classes/java/util/stream/DistinctOps.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/java/util/stream/DistinctOps.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, 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
@@ -170,8 +170,7 @@
 
                         @Override
                         public void accept(T t) {
-                            if (!seen.contains(t)) {
-                                seen.add(t);
+                            if (seen.add(t)) {
                                 downstream.accept(t);
                             }
                         }
--- a/src/java.base/share/classes/javax/crypto/CipherInputStream.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -52,7 +52,7 @@
  * method counts only data that have been processed by the encapsulated Cipher.
  *
  * <p> It is crucial for a programmer using this class not to use
- * methods that are not defined or overriden in this class (such as a
+ * methods that are not defined or overridden in this class (such as a
  * new method or constructor that is later added to one of the super
  * classes), because the design and implementation of those methods
  * are unlikely to have considered security impact with regard to
--- a/src/java.base/share/classes/javax/crypto/CipherOutputStream.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/javax/crypto/CipherOutputStream.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -53,7 +53,7 @@
  * alternative to using this class.
  *
  * <p> It is crucial for a programmer using this class not to use
- * methods that are not defined or overriden in this class (such as a
+ * methods that are not defined or overridden in this class (such as a
  * new method or constructor that is later added to one of the super
  * classes), because the design and implementation of those methods
  * are unlikely to have considered security impact with regard to
--- a/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, 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
@@ -46,7 +46,7 @@
  * However, the implementations can be replaced on a per-class (static) or
  * per-instance basis.  All new <code>HttpsURLConnection</code>s instances
  * will be assigned
- * the "default" static values at instance creation, but they can be overriden
+ * the "default" static values at instance creation, but they can be overridden
  * by calling the appropriate per-instance set method(s) before
  * <code>connect</code>ing.
  *
--- a/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -48,7 +48,7 @@
  * authentication is necessary, and whether created sockets should
  * begin handshaking in client or server mode.  The state
  * inherited by the created <code>SSLSocket</code> can be
- * overriden by calling the appropriate methods.
+ * overridden by calling the appropriate methods.
  *
  * @see java.net.ServerSocket
  * @see SSLSocket
--- a/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocketFactory.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -112,7 +112,7 @@
 
         try {
             return SSLContext.getDefault().getServerSocketFactory();
-        } catch (NoSuchAlgorithmException e) {
+        } catch (NoSuchAlgorithmException | UnsupportedOperationException e) {
             return new DefaultSSLServerSocketFactory(e);
         }
     }
--- a/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/javax/net/ssl/SSLSocketFactory.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -121,7 +121,7 @@
 
         try {
             return SSLContext.getDefault().getSocketFactory();
-        } catch (NoSuchAlgorithmException e) {
+        } catch (NoSuchAlgorithmException | UnsupportedOperationException e) {
             return new DefaultSSLSocketFactory(e);
         }
     }
--- a/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -31,7 +31,7 @@
  * Abstract class that provides for extension of the X509KeyManager
  * interface.
  * <P>
- * Methods in this class should be overriden to provide actual
+ * Methods in this class should be overridden to provide actual
  * implementations.
  *
  * @since 1.5
--- a/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Tue Sep 18 16:41:24 2018 -0700
@@ -305,4 +305,10 @@
      * @throws IllegalArgumentException for malformed surrogates
      */
     byte[] getBytesUTF8NoRepl(String s);
+
+    /**
+     * Set the cause of Throwable
+     * @param cause set t's cause to new value
+     */
+    void setCause(Throwable t, Throwable cause);
 }
--- a/src/java.base/share/classes/sun/security/ssl/CipherSuite.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/CipherSuite.java	Tue Sep 18 16:41:24 2018 -0700
@@ -70,6 +70,9 @@
     TLS_AES_256_GCM_SHA384(
             0x1302, true, "TLS_AES_256_GCM_SHA384",
             ProtocolVersion.PROTOCOLS_OF_13, B_AES_256_GCM_IV, H_SHA384),
+    TLS_CHACHA20_POLY1305_SHA256(
+            0x1303, true, "TLS_CHACHA20_POLY1305_SHA256",
+            ProtocolVersion.PROTOCOLS_OF_13, B_CC20_P1305, H_SHA256),
 
     // Suite B compliant cipher suites, see RFC 6460.
     //
@@ -87,11 +90,22 @@
             ProtocolVersion.PROTOCOLS_OF_12,
             K_ECDHE_ECDSA, B_AES_128_GCM, M_NULL, H_SHA256),
 
+    // Not suite B, but we want it to position the suite early in the list
+    // of 1.2 suites.
+    TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256(
+            0xCCA9, true, "TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256", "",
+            ProtocolVersion.PROTOCOLS_OF_12,
+            K_ECDHE_ECDSA, B_CC20_P1305, M_NULL, H_SHA256),
+
     // AES_256(GCM)
     TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(
             0xC030, true, "TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384", "",
             ProtocolVersion.PROTOCOLS_OF_12,
             K_ECDHE_RSA, B_AES_256_GCM, M_NULL, H_SHA384),
+    TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256(
+            0xCCA8, true, "TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256", "",
+            ProtocolVersion.PROTOCOLS_OF_12,
+            K_ECDHE_RSA, B_CC20_P1305, M_NULL, H_SHA256),
     TLS_RSA_WITH_AES_256_GCM_SHA384(
             0x009D, true, "TLS_RSA_WITH_AES_256_GCM_SHA384", "",
             ProtocolVersion.PROTOCOLS_OF_12,
@@ -108,6 +122,10 @@
             0x009F, true, "TLS_DHE_RSA_WITH_AES_256_GCM_SHA384", "",
             ProtocolVersion.PROTOCOLS_OF_12,
             K_DHE_RSA, B_AES_256_GCM, M_NULL, H_SHA384),
+    TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256(
+            0xCCAA, true, "TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256", "",
+            ProtocolVersion.PROTOCOLS_OF_12,
+            K_DHE_RSA, B_CC20_P1305, M_NULL, H_SHA256),
     TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(
             0x00A3, true, "TLS_DHE_DSS_WITH_AES_256_GCM_SHA384", "",
             ProtocolVersion.PROTOCOLS_OF_12,
@@ -480,8 +498,6 @@
 
     // Definition of the CipherSuites that are not supported but the names
     // are known.
-    TLS_CHACHA20_POLY1305_SHA256(                    // TLS 1.3
-            "TLS_CHACHA20_POLY1305_SHA256", 0x1303),
     TLS_AES_128_CCM_SHA256(                          // TLS 1.3
             "TLS_AES_128_CCM_SHA256", 0x1304),
     TLS_AES_128_CCM_8_SHA256(                        // TLS 1.3
--- a/src/java.base/share/classes/sun/security/ssl/JsseJce.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/JsseJce.java	Tue Sep 18 16:41:24 2018 -0700
@@ -130,6 +130,11 @@
     static final String CIPHER_AES_GCM = "AES/GCM/NoPadding";
 
     /**
+     * JCE transformation string for ChaCha20-Poly1305
+     */
+    static final String CIPHER_CHACHA20_POLY1305 = "ChaCha20-Poly1305";
+
+    /**
      * JCA identifier string for DSA, i.e. a DSA with SHA-1.
      */
     static final String SIGNATURE_DSA = "DSA";
--- a/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLCipher.java	Tue Sep 18 16:41:24 2018 -0700
@@ -329,6 +329,32 @@
                 new T13GcmWriteCipherGenerator(),
                 ProtocolVersion.PROTOCOLS_OF_13
             )
+        })),
+
+    @SuppressWarnings({"unchecked", "rawtypes"})
+    B_CC20_P1305(CIPHER_CHACHA20_POLY1305, AEAD_CIPHER, 32, 32, 12,
+            12, true, false,
+        (Map.Entry<ReadCipherGenerator,
+                ProtocolVersion[]>[])(new Map.Entry[] {
+            new SimpleImmutableEntry<ReadCipherGenerator, ProtocolVersion[]>(
+                new T12CC20P1305ReadCipherGenerator(),
+                ProtocolVersion.PROTOCOLS_OF_12
+            ),
+            new SimpleImmutableEntry<ReadCipherGenerator, ProtocolVersion[]>(
+                new T13CC20P1305ReadCipherGenerator(),
+                ProtocolVersion.PROTOCOLS_OF_13
+            )
+        }),
+        (Map.Entry<WriteCipherGenerator,
+                ProtocolVersion[]>[])(new Map.Entry[] {
+            new SimpleImmutableEntry<WriteCipherGenerator, ProtocolVersion[]>(
+                new T12CC20P1305WriteCipherGenerator(),
+                ProtocolVersion.PROTOCOLS_OF_12
+            ),
+            new SimpleImmutableEntry<WriteCipherGenerator, ProtocolVersion[]>(
+                new T13CC20P1305WriteCipherGenerator(),
+                ProtocolVersion.PROTOCOLS_OF_13
+            )
         }));
 
     // descriptive name including key size, e.g. AES/128
@@ -2082,6 +2108,549 @@
         }
     }
 
+    private static final class T12CC20P1305ReadCipherGenerator
+            implements ReadCipherGenerator {
+
+        @Override
+        public SSLReadCipher createCipher(SSLCipher sslCipher,
+                Authenticator authenticator, ProtocolVersion protocolVersion,
+                String algorithm, Key key, AlgorithmParameterSpec params,
+                SecureRandom random) throws GeneralSecurityException {
+            return new CC20P1305ReadCipher(authenticator, protocolVersion,
+                    sslCipher, algorithm, key, params, random);
+        }
+
+        static final class CC20P1305ReadCipher extends SSLReadCipher {
+            private final Cipher cipher;
+            private final int tagSize;
+            private final Key key;
+            private final byte[] iv;
+            private final SecureRandom random;
+
+            CC20P1305ReadCipher(Authenticator authenticator,
+                    ProtocolVersion protocolVersion,
+                    SSLCipher sslCipher, String algorithm,
+                    Key key, AlgorithmParameterSpec params,
+                    SecureRandom random) throws GeneralSecurityException {
+                super(authenticator, protocolVersion);
+                this.cipher = JsseJce.getCipher(algorithm);
+                this.tagSize = sslCipher.tagSize;
+                this.key = key;
+                this.iv = ((IvParameterSpec)params).getIV();
+                this.random = random;
+
+                // DON'T initialize the cipher for AEAD!
+            }
+
+            @Override
+            public Plaintext decrypt(byte contentType, ByteBuffer bb,
+                    byte[] sequence) throws GeneralSecurityException {
+                if (bb.remaining() <= tagSize) {
+                    throw new BadPaddingException(
+                        "Insufficient buffer remaining for AEAD cipher " +
+                        "fragment (" + bb.remaining() + "). Needs to be " +
+                        "more than tag size (" + tagSize + ")");
+                }
+
+                byte[] sn = sequence;
+                if (sn == null) {
+                    sn = authenticator.sequenceNumber();
+                }
+                byte[] nonce = new byte[iv.length];
+                System.arraycopy(sn, 0, nonce, nonce.length - sn.length,
+                        sn.length);
+                for (int i = 0; i < nonce.length; i++) {
+                    nonce[i] ^= iv[i];
+                }
+
+                // initialize the AEAD cipher with the unique IV
+                AlgorithmParameterSpec spec = new IvParameterSpec(nonce);
+                try {
+                    cipher.init(Cipher.DECRYPT_MODE, key, spec, random);
+                } catch (InvalidKeyException |
+                            InvalidAlgorithmParameterException ikae) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                                "invalid key or spec in AEAD mode", ikae);
+                }
+
+                // update the additional authentication data
+                byte[] aad = authenticator.acquireAuthenticationBytes(
+                        contentType, bb.remaining() - tagSize, sequence);
+                cipher.updateAAD(aad);
+
+                // DON'T decrypt the nonce_explicit for AEAD mode. The buffer
+                // position has moved out of the nonce_explicit range.
+                int len = bb.remaining();
+                int pos = bb.position();
+                ByteBuffer dup = bb.duplicate();
+                try {
+                    len = cipher.doFinal(dup, bb);
+                } catch (IllegalBlockSizeException ibse) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                        "Cipher error in AEAD mode \"" + ibse.getMessage() +
+                        " \"in JCE provider " + cipher.getProvider().getName());
+                } catch (ShortBufferException sbe) {
+                    // catch BouncyCastle buffering error
+                    throw new RuntimeException("Cipher buffering error in " +
+                        "JCE provider " + cipher.getProvider().getName(), sbe);
+                }
+                // reset the limit to the end of the decrypted data
+                bb.position(pos);
+                bb.limit(pos + len);
+
+                if (SSLLogger.isOn && SSLLogger.isOn("plaintext")) {
+                    SSLLogger.fine(
+                            "Plaintext after DECRYPTION", bb.duplicate());
+                }
+
+                return new Plaintext(contentType,
+                        ProtocolVersion.NONE.major, ProtocolVersion.NONE.minor,
+                        -1, -1L, bb.slice());
+            }
+
+            @Override
+            void dispose() {
+                if (cipher != null) {
+                    try {
+                        cipher.doFinal();
+                    } catch (Exception e) {
+                        // swallow all types of exceptions.
+                    }
+                }
+            }
+
+            @Override
+            int estimateFragmentSize(int packetSize, int headerSize) {
+                return packetSize - headerSize - tagSize;
+            }
+        }
+    }
+
+    private static final class T12CC20P1305WriteCipherGenerator
+            implements WriteCipherGenerator {
+        @Override
+        public SSLWriteCipher createCipher(SSLCipher sslCipher,
+                Authenticator authenticator, ProtocolVersion protocolVersion,
+                String algorithm, Key key, AlgorithmParameterSpec params,
+                SecureRandom random) throws GeneralSecurityException {
+            return new CC20P1305WriteCipher(authenticator, protocolVersion,
+                    sslCipher, algorithm, key, params, random);
+        }
+
+        private static final class CC20P1305WriteCipher extends SSLWriteCipher {
+            private final Cipher cipher;
+            private final int tagSize;
+            private final Key key;
+            private final byte[] iv;
+            private final SecureRandom random;
+
+            CC20P1305WriteCipher(Authenticator authenticator,
+                    ProtocolVersion protocolVersion,
+                    SSLCipher sslCipher, String algorithm,
+                    Key key, AlgorithmParameterSpec params,
+                    SecureRandom random) throws GeneralSecurityException {
+                super(authenticator, protocolVersion);
+                this.cipher = JsseJce.getCipher(algorithm);
+                this.tagSize = sslCipher.tagSize;
+                this.key = key;
+                this.iv = ((IvParameterSpec)params).getIV();
+                this.random = random;
+
+                keyLimitCountdown = cipherLimits.getOrDefault(
+                        algorithm.toUpperCase() + ":" + tag[0], 0L);
+                if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
+                    SSLLogger.fine("algorithm = " + algorithm.toUpperCase() +
+                            ":" + tag[0] + "\ncountdown value = " +
+                            keyLimitCountdown);
+                }
+                if (keyLimitCountdown > 0) {
+                    keyLimitEnabled = true;
+                }
+
+                // DON'T initialize the cipher for AEAD!
+            }
+
+            @Override
+            public int encrypt(byte contentType,
+                    ByteBuffer bb) {
+                byte[] sn = authenticator.sequenceNumber();
+                byte[] nonce = new byte[iv.length];
+                System.arraycopy(sn, 0, nonce, nonce.length - sn.length,
+                        sn.length);
+                for (int i = 0; i < nonce.length; i++) {
+                    nonce[i] ^= iv[i];
+                }
+
+                // initialize the AEAD cipher for the unique IV
+                AlgorithmParameterSpec spec = new IvParameterSpec(nonce);
+                try {
+                    cipher.init(Cipher.ENCRYPT_MODE, key, spec, random);
+                } catch (InvalidKeyException |
+                            InvalidAlgorithmParameterException ikae) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                                "invalid key or spec in AEAD mode", ikae);
+                }
+
+                // Update the additional authentication data, using the
+                // implicit sequence number of the authenticator.
+                byte[] aad = authenticator.acquireAuthenticationBytes(
+                                        contentType, bb.remaining(), null);
+                cipher.updateAAD(aad);
+
+                // DON'T encrypt the nonce for AEAD mode.
+                int len = bb.remaining();
+                int pos = bb.position();
+                if (SSLLogger.isOn && SSLLogger.isOn("plaintext")) {
+                    SSLLogger.fine(
+                            "Plaintext before ENCRYPTION",
+                            bb.duplicate());
+                }
+
+                ByteBuffer dup = bb.duplicate();
+                int outputSize = cipher.getOutputSize(dup.remaining());
+                if (outputSize > bb.remaining()) {
+                    // Need to expand the limit of the output buffer for
+                    // the authentication tag.
+                    //
+                    // DON'T worry about the buffer's capacity, we have
+                    // reserved space for the authentication tag.
+                    bb.limit(pos + outputSize);
+                }
+
+                try {
+                    len = cipher.doFinal(dup, bb);
+                } catch (IllegalBlockSizeException |
+                            BadPaddingException | ShortBufferException ibse) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                            "Cipher error in AEAD mode in JCE provider " +
+                            cipher.getProvider().getName(), ibse);
+                }
+
+                if (len != outputSize) {
+                    throw new RuntimeException(
+                            "Cipher buffering error in JCE provider " +
+                            cipher.getProvider().getName());
+                }
+
+                return len;
+            }
+
+            @Override
+            void dispose() {
+                if (cipher != null) {
+                    try {
+                        cipher.doFinal();
+                    } catch (Exception e) {
+                        // swallow all types of exceptions.
+                    }
+                }
+            }
+
+            @Override
+            int getExplicitNonceSize() {
+                return 0;
+            }
+
+            @Override
+            int calculateFragmentSize(int packetLimit, int headerSize) {
+                return packetLimit - headerSize - tagSize;
+            }
+
+            @Override
+            int calculatePacketSize(int fragmentSize, int headerSize) {
+                return fragmentSize + headerSize + tagSize;
+            }
+        }
+    }
+
+    private static final class T13CC20P1305ReadCipherGenerator
+            implements ReadCipherGenerator {
+
+        @Override
+        public SSLReadCipher createCipher(SSLCipher sslCipher,
+                Authenticator authenticator, ProtocolVersion protocolVersion,
+                String algorithm, Key key, AlgorithmParameterSpec params,
+                SecureRandom random) throws GeneralSecurityException {
+            return new CC20P1305ReadCipher(authenticator, protocolVersion,
+                    sslCipher, algorithm, key, params, random);
+        }
+
+        static final class CC20P1305ReadCipher extends SSLReadCipher {
+            private final Cipher cipher;
+            private final int tagSize;
+            private final Key key;
+            private final byte[] iv;
+            private final SecureRandom random;
+
+            CC20P1305ReadCipher(Authenticator authenticator,
+                    ProtocolVersion protocolVersion,
+                    SSLCipher sslCipher, String algorithm,
+                    Key key, AlgorithmParameterSpec params,
+                    SecureRandom random) throws GeneralSecurityException {
+                super(authenticator, protocolVersion);
+                this.cipher = JsseJce.getCipher(algorithm);
+                this.tagSize = sslCipher.tagSize;
+                this.key = key;
+                this.iv = ((IvParameterSpec)params).getIV();
+                this.random = random;
+
+                // DON'T initialize the cipher for AEAD!
+            }
+
+            @Override
+            public Plaintext decrypt(byte contentType, ByteBuffer bb,
+                    byte[] sequence) throws GeneralSecurityException {
+                // An implementation may receive an unencrypted record of type
+                // change_cipher_spec consisting of the single byte value 0x01
+                // at any time after the first ClientHello message has been
+                // sent or received and before the peer's Finished message has
+                // been received and MUST simply drop it without further
+                // processing.
+                if (contentType == ContentType.CHANGE_CIPHER_SPEC.id) {
+                    return new Plaintext(contentType,
+                        ProtocolVersion.NONE.major, ProtocolVersion.NONE.minor,
+                        -1, -1L, bb.slice());
+                }
+
+                if (bb.remaining() <= tagSize) {
+                    throw new BadPaddingException(
+                        "Insufficient buffer remaining for AEAD cipher " +
+                        "fragment (" + bb.remaining() + "). Needs to be " +
+                        "more than tag size (" + tagSize + ")");
+                }
+
+                byte[] sn = sequence;
+                if (sn == null) {
+                    sn = authenticator.sequenceNumber();
+                }
+                byte[] nonce = new byte[iv.length];
+                System.arraycopy(sn, 0, nonce, nonce.length - sn.length,
+                        sn.length);
+                for (int i = 0; i < nonce.length; i++) {
+                    nonce[i] ^= iv[i];
+                }
+
+                // initialize the AEAD cipher with the unique IV
+                AlgorithmParameterSpec spec = new IvParameterSpec(nonce);
+                try {
+                    cipher.init(Cipher.DECRYPT_MODE, key, spec, random);
+                } catch (InvalidKeyException |
+                            InvalidAlgorithmParameterException ikae) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                                "invalid key or spec in AEAD mode", ikae);
+                }
+
+                // Update the additional authentication data, using the
+                // implicit sequence number of the authenticator.
+                byte[] aad = authenticator.acquireAuthenticationBytes(
+                                        contentType, bb.remaining(), sn);
+                cipher.updateAAD(aad);
+
+                int len = bb.remaining();
+                int pos = bb.position();
+                ByteBuffer dup = bb.duplicate();
+                try {
+                    len = cipher.doFinal(dup, bb);
+                } catch (IllegalBlockSizeException ibse) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                        "Cipher error in AEAD mode \"" + ibse.getMessage() +
+                        " \"in JCE provider " + cipher.getProvider().getName());
+                } catch (ShortBufferException sbe) {
+                    // catch BouncyCastle buffering error
+                    throw new RuntimeException("Cipher buffering error in " +
+                        "JCE provider " + cipher.getProvider().getName(), sbe);
+                }
+                // reset the limit to the end of the decrypted data
+                bb.position(pos);
+                bb.limit(pos + len);
+
+                // remove inner plaintext padding
+                int i = bb.limit() - 1;
+                for (; i > 0 && bb.get(i) == 0; i--) {
+                    // blank
+                }
+                if (i < (pos + 1)) {
+                    throw new BadPaddingException(
+                            "Incorrect inner plaintext: no content type");
+                }
+                contentType = bb.get(i);
+                bb.limit(i);
+
+                if (SSLLogger.isOn && SSLLogger.isOn("plaintext")) {
+                    SSLLogger.fine(
+                            "Plaintext after DECRYPTION", bb.duplicate());
+                }
+
+                return new Plaintext(contentType,
+                        ProtocolVersion.NONE.major, ProtocolVersion.NONE.minor,
+                        -1, -1L, bb.slice());
+            }
+
+            @Override
+            void dispose() {
+                if (cipher != null) {
+                    try {
+                        cipher.doFinal();
+                    } catch (Exception e) {
+                        // swallow all types of exceptions.
+                    }
+                }
+            }
+
+            @Override
+            int estimateFragmentSize(int packetSize, int headerSize) {
+                return packetSize - headerSize - tagSize;
+            }
+        }
+    }
+
+    private static final class T13CC20P1305WriteCipherGenerator
+            implements WriteCipherGenerator {
+        @Override
+        public SSLWriteCipher createCipher(SSLCipher sslCipher,
+                Authenticator authenticator, ProtocolVersion protocolVersion,
+                String algorithm, Key key, AlgorithmParameterSpec params,
+                SecureRandom random) throws GeneralSecurityException {
+            return new CC20P1305WriteCipher(authenticator, protocolVersion,
+                    sslCipher, algorithm, key, params, random);
+        }
+
+        private static final class CC20P1305WriteCipher extends SSLWriteCipher {
+            private final Cipher cipher;
+            private final int tagSize;
+            private final Key key;
+            private final byte[] iv;
+            private final SecureRandom random;
+
+            CC20P1305WriteCipher(Authenticator authenticator,
+                    ProtocolVersion protocolVersion,
+                    SSLCipher sslCipher, String algorithm,
+                    Key key, AlgorithmParameterSpec params,
+                    SecureRandom random) throws GeneralSecurityException {
+                super(authenticator, protocolVersion);
+                this.cipher = JsseJce.getCipher(algorithm);
+                this.tagSize = sslCipher.tagSize;
+                this.key = key;
+                this.iv = ((IvParameterSpec)params).getIV();
+                this.random = random;
+
+                keyLimitCountdown = cipherLimits.getOrDefault(
+                        algorithm.toUpperCase() + ":" + tag[0], 0L);
+                if (SSLLogger.isOn && SSLLogger.isOn("ssl")) {
+                    SSLLogger.fine("algorithm = " + algorithm.toUpperCase() +
+                            ":" + tag[0] + "\ncountdown value = " +
+                            keyLimitCountdown);
+                }
+                if (keyLimitCountdown > 0) {
+                    keyLimitEnabled = true;
+                }
+
+                // DON'T initialize the cipher for AEAD!
+            }
+
+            @Override
+            public int encrypt(byte contentType,
+                    ByteBuffer bb) {
+                byte[] sn = authenticator.sequenceNumber();
+                byte[] nonce = new byte[iv.length];
+                System.arraycopy(sn, 0, nonce, nonce.length - sn.length,
+                        sn.length);
+                for (int i = 0; i < nonce.length; i++) {
+                    nonce[i] ^= iv[i];
+                }
+
+                // initialize the AEAD cipher for the unique IV
+                AlgorithmParameterSpec spec = new IvParameterSpec(nonce);
+                try {
+                    cipher.init(Cipher.ENCRYPT_MODE, key, spec, random);
+                } catch (InvalidKeyException |
+                            InvalidAlgorithmParameterException ikae) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                                "invalid key or spec in AEAD mode", ikae);
+                }
+
+                // Update the additional authentication data, using the
+                // implicit sequence number of the authenticator.
+                int outputSize = cipher.getOutputSize(bb.remaining());
+                byte[] aad = authenticator.acquireAuthenticationBytes(
+                                        contentType, outputSize, sn);
+                cipher.updateAAD(aad);
+
+                int len = bb.remaining();
+                int pos = bb.position();
+                if (SSLLogger.isOn && SSLLogger.isOn("plaintext")) {
+                    SSLLogger.fine(
+                            "Plaintext before ENCRYPTION",
+                            bb.duplicate());
+                }
+
+                ByteBuffer dup = bb.duplicate();
+                if (outputSize > bb.remaining()) {
+                    // Need to expand the limit of the output buffer for
+                    // the authentication tag.
+                    //
+                    // DON'T worry about the buffer's capacity, we have
+                    // reserved space for the authentication tag.
+                    bb.limit(pos + outputSize);
+                }
+
+                try {
+                    len = cipher.doFinal(dup, bb);
+                } catch (IllegalBlockSizeException |
+                            BadPaddingException | ShortBufferException ibse) {
+                    // unlikely to happen
+                    throw new RuntimeException(
+                            "Cipher error in AEAD mode in JCE provider " +
+                            cipher.getProvider().getName(), ibse);
+                }
+
+                if (len != outputSize) {
+                    throw new RuntimeException(
+                            "Cipher buffering error in JCE provider " +
+                            cipher.getProvider().getName());
+                }
+
+                if (keyLimitEnabled) {
+                    keyLimitCountdown -= len;
+                }
+                return len;
+            }
+
+            @Override
+            void dispose() {
+                if (cipher != null) {
+                    try {
+                        cipher.doFinal();
+                    } catch (Exception e) {
+                        // swallow all types of exceptions.
+                    }
+                }
+            }
+
+            @Override
+            int getExplicitNonceSize() {
+                return 0;
+            }
+
+            @Override
+            int calculateFragmentSize(int packetLimit, int headerSize) {
+                return packetLimit - headerSize - tagSize;
+            }
+
+            @Override
+            int calculatePacketSize(int fragmentSize, int headerSize) {
+                return fragmentSize + headerSize + tagSize;
+            }
+        }
+    }
+
     private static void addMac(MAC signer,
             ByteBuffer destination, byte contentType) {
         if (signer.macAlg().size != 0) {
@@ -2367,4 +2936,3 @@
         return results;
     }
 }
-
--- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java	Tue Sep 18 16:41:24 2018 -0700
@@ -207,6 +207,10 @@
         if (!isInitialized) {
             throw new IllegalStateException("SSLContext is not initialized");
         }
+        if (isDTLS()) {
+            throw new UnsupportedOperationException(
+                    "DTLS not supported with SSLSocket");
+        }
        return new SSLSocketFactoryImpl(this);
     }
 
@@ -215,6 +219,10 @@
         if (!isInitialized) {
             throw new IllegalStateException("SSLContext is not initialized");
         }
+        if (isDTLS()) {
+            throw new UnsupportedOperationException(
+                    "DTLS not supported with SSLServerSocket");
+        }
         return new SSLServerSocketFactoryImpl(this);
     }
 
@@ -1262,6 +1270,21 @@
         }
 
         @Override
+        protected SSLParameters engineGetDefaultSSLParameters() {
+            SSLEngine engine = createSSLEngineImpl();
+            return engine.getSSLParameters();
+        }
+
+        @Override
+        protected SSLParameters engineGetSupportedSSLParameters() {
+            SSLEngine engine = createSSLEngineImpl();
+            SSLParameters params = new SSLParameters();
+            params.setCipherSuites(engine.getSupportedCipherSuites());
+            params.setProtocols(engine.getSupportedProtocols());
+            return params;
+        }
+
+        @Override
         List<ProtocolVersion> getSupportedProtocolVersions() {
             return supportedProtocols;
         }
--- a/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,7 +27,6 @@
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.security.AccessController;
 import java.security.AlgorithmConstraints;
 import java.security.AlgorithmParameters;
 import java.security.CryptoPrimitive;
@@ -672,6 +671,11 @@
             }
 
             AlgorithmParameters params = namedGroupParams.get(namedGroup);
+            if (params == null) {
+                throw new RuntimeException(
+                        "Not a supported EC named group: " + namedGroup);
+            }
+
             try {
                 return params.getParameterSpec(ECGenParameterSpec.class);
             } catch (InvalidParameterSpecException ipse) {
@@ -687,6 +691,11 @@
             }
 
             AlgorithmParameters params = namedGroupParams.get(namedGroup);
+            if (params == null) {
+                throw new RuntimeException(
+                        "Not a supported DH named group: " + namedGroup);
+            }
+
             try {
                 return params.getParameterSpec(DHParameterSpec.class);
             } catch (InvalidParameterSpecException ipse) {
@@ -739,7 +748,7 @@
                             namedGroupParams.get(namedGroup));
         }
 
-        // Is there any supported group permitted by the constraints?
+        // Is the named group supported?
         static boolean isSupported(NamedGroup namedGroup) {
             for (NamedGroup group : supportedNamedGroups) {
                 if (namedGroup.id == group.id) {
@@ -757,6 +766,7 @@
             for (NamedGroup namedGroup : requestedNamedGroups) {
                 if ((namedGroup.type == type) &&
                         namedGroup.isAvailable(negotiatedProtocol) &&
+                        isSupported(namedGroup) &&
                         constraints.permits(
                                 EnumSet.of(CryptoPrimitive.KEY_AGREEMENT),
                                 namedGroup.algorithm,
--- a/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java	Tue Sep 18 16:41:24 2018 -0700
@@ -281,7 +281,7 @@
                 .replaceFirst("H+", (isShort ? "\\%1\\$d" : "\\%1\\$02d"))
                 .replaceFirst("m+", "\\%2\\$02d");
             return MessageFormat.format(gmtFormat,
-                    String.format(hourFormat, offset / 60, offset % 60));
+                    String.format(l, hourFormat, offset / 60, offset % 60));
         }
     }
 }
--- a/src/java.base/share/native/libzip/zip_util.c	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/share/native/libzip/zip_util.c	Tue Sep 18 16:41:24 2018 -0700
@@ -100,6 +100,9 @@
 static ZFILE
 ZFILE_Open(const char *fname, int flags) {
 #ifdef WIN32
+    WCHAR *wfname, *wprefixed_fname;
+    size_t converted_chars, fname_length;
+    jlong fhandle;
     const DWORD access =
         (flags & O_RDWR)   ? (GENERIC_WRITE | GENERIC_READ) :
         (flags & O_WRONLY) ?  GENERIC_WRITE :
@@ -121,14 +124,37 @@
         FILE_ATTRIBUTE_NORMAL;
     const DWORD flagsAndAttributes = maybeWriteThrough | maybeDeleteOnClose;
 
-    return (jlong) CreateFile(
-        fname,          /* Wide char path name */
-        access,         /* Read and/or write permission */
-        sharing,        /* File sharing flags */
-        NULL,           /* Security attributes */
-        disposition,        /* creation disposition */
-        flagsAndAttributes, /* flags and attributes */
-        NULL);
+    fname_length = strlen(fname);
+    if (fname_length < MAX_PATH) {
+        return (jlong)CreateFile(
+            fname,              /* path name in multibyte char */
+            access,             /* Read and/or write permission */
+            sharing,            /* File sharing flags */
+            NULL,               /* Security attributes */
+            disposition,        /* creation disposition */
+            flagsAndAttributes, /* flags and attributes */
+            NULL);
+    } else {
+        if ((wfname = (WCHAR*)malloc((fname_length + 1) * sizeof(WCHAR))) == NULL)
+            return (jlong)INVALID_HANDLE_VALUE;
+
+        if (mbstowcs_s(&converted_chars, wfname, fname_length + 1, fname, fname_length) != 0) {
+            free(wfname);
+            return (jlong)INVALID_HANDLE_VALUE;
+        }
+        wprefixed_fname = getPrefixed(wfname, (int)fname_length);
+        fhandle = (jlong)CreateFileW(
+            wprefixed_fname,    /* Wide char path name */
+            access,             /* Read and/or write permission */
+            sharing,            /* File sharing flags */
+            NULL,               /* Security attributes */
+            disposition,        /* creation disposition */
+            flagsAndAttributes, /* flags and attributes */
+            NULL);
+        free(wfname);
+        free(wprefixed_fname);
+        return fhandle;
+    }
 #else
     return open(fname, flags, 0);
 #endif
--- a/src/java.base/solaris/native/libjvm_db/libjvm_db.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/solaris/native/libjvm_db/libjvm_db.h	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, 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
@@ -26,6 +26,7 @@
 #define OS_SOLARIS_DTRACE_LIBJVM_DB_H
 
 #include <proc_service.h>
+#include "jni.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -35,7 +36,7 @@
 
 #define JVM_DB_VERSION  1
 
-jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers);
+JNIEXPORT jvm_agent_t *Jagent_create(struct ps_prochandle *P, int vers);
 
 /*
  * Called from Jframe_iter() for each java frame.  If it returns 0, then
@@ -57,9 +58,9 @@
  * frames were found, or if there was some unrecoverable error.  Otherwise,
  * returns the last value returned from 'func'.
  */
-int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld);
+JNIEXPORT int Jframe_iter(jvm_agent_t *agent, prgregset_t gregs, java_stack_f *func, void* cld);
 
-void Jagent_destroy(jvm_agent_t *J);
+JNIEXPORT void Jagent_destroy(jvm_agent_t *J);
 
 #ifdef __cplusplus
 } /* extern "C" */
--- a/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, 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
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/types.h>
-
+#include "jni.h"
 
 struct _jvm_t;
 typedef struct _jvm_t jvm_t;
@@ -44,10 +44,10 @@
 
 /* Attach to the given JVM process. Returns NULL on failure.
    jvm_get_last_error() returns last error message. */
-jvm_t* jvm_attach(pid_t pid);
+JNIEXPORT jvm_t* jvm_attach(pid_t pid);
 
 /* Returns the last error message from this library or NULL if none. */
-const char* jvm_get_last_error();
+JNIEXPORT const char* jvm_get_last_error();
 
 /* few well-known probe type constants for 'probe_types' param below */
 
@@ -68,7 +68,7 @@
  * On success, this returns number of probe_types enabled.
  * On failure, jvm_get_last_error() returns the last error message.
  */
-int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types);
+JNIEXPORT int jvm_enable_dtprobes(jvm_t* jvm, int num_probe_types, const char** probe_types);
 
 /* Note: There is no jvm_disable_dtprobes function. Probes are automatically
  * disabled when there are no more clients requiring those probes.
@@ -77,7 +77,7 @@
 /* Detach the given JVM. Returns 0 on success, -1 on failure.
  * jvm_get_last_error() returns the last error message.
  */
-int jvm_detach(jvm_t* jvm);
+JNIEXPORT int jvm_detach(jvm_t* jvm);
 
 #ifdef __cplusplus
 }
--- a/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -105,7 +105,7 @@
         return uc;
     }
 
-    // Template method to be overriden by Java Plug-in. [stanleyh]
+    // Template method to be overridden by Java Plug-in. [stanleyh]
     //
     protected URLConnection createFileURLConnection(URL u, File file)
     {
--- a/src/java.base/unix/native/libjsig/jsig.c	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/unix/native/libjsig/jsig.c	Tue Sep 18 16:41:24 2018 -0700
@@ -29,6 +29,18 @@
  * Used for signal-chaining. See RFE 4381843.
  */
 
+#include "jni.h"
+
+#ifdef SOLARIS
+/* Our redeclarations of the system functions must not have a less
+ * restrictive linker scoping, so we have to declare them as JNIEXPORT
+ * before including signal.h */
+#include "sys/signal.h"
+JNIEXPORT void (*signal(int sig, void (*disp)(int)))(int);
+JNIEXPORT void (*sigset(int sig, void (*disp)(int)))(int);
+JNIEXPORT int sigaction(int sig, const struct sigaction *act, struct sigaction *oact);
+#endif
+
 #include <dlfcn.h>
 #include <errno.h>
 #include <pthread.h>
@@ -208,7 +220,7 @@
   }
 }
 
-sa_handler_t signal(int sig, sa_handler_t disp) {
+JNIEXPORT sa_handler_t signal(int sig, sa_handler_t disp) {
   if (sig < 0 || sig >= MAX_SIGNALS) {
     errno = EINVAL;
     return SIG_ERR;
@@ -217,7 +229,7 @@
   return set_signal(sig, disp, false);
 }
 
-sa_handler_t sigset(int sig, sa_handler_t disp) {
+JNIEXPORT sa_handler_t sigset(int sig, sa_handler_t disp) {
 #ifdef _ALLBSD_SOURCE
   printf("sigset() is not supported by BSD");
   exit(0);
@@ -243,7 +255,7 @@
   return (*os_sigaction)(sig, act, oact);
 }
 
-int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
+JNIEXPORT int sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
   int res;
   bool sigused;
   struct sigaction oldAct;
--- a/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2003, 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
@@ -124,7 +124,7 @@
     }
 
     /**
-     * Template method to be overriden by Java Plug-in. [stanleyh]
+     * Template method to be overridden by Java Plug-in. [stanleyh]
      */
     protected URLConnection createFileURLConnection(URL url, File file) {
         return new FileURLConnection(url, file);
--- a/src/java.base/windows/conf/tzmappings	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,226 +0,0 @@
-#
-# This file describes mapping information between Windows and Java
-# time zones.
-# Format: Each line should include a colon separated fields of Windows
-# time zone registry key, time zone mapID, locale (which is most
-# likely used in the time zone), and Java time zone ID. Blank lines
-# and lines that start with '#' are ignored. Data lines must be sorted
-# by mapID (ASCII order).
-#
-#                            NOTE
-# This table format is not a public interface of any Java
-# platforms. No applications should depend on this file in any form.
-#
-# This table has been generated by a program and should not be edited
-# manually.
-#
-Romance:-1,64::Europe/Paris:
-Romance Standard Time:-1,64::Europe/Paris:
-Warsaw:-1,65::Europe/Warsaw:
-Central Europe:-1,66::Europe/Prague:
-Central Europe Standard Time:-1,66::Europe/Prague:
-Prague Bratislava:-1,66::Europe/Prague:
-W. Central Africa Standard Time:-1,66:AO:Africa/Luanda:
-FLE:-1,67:FI:Europe/Helsinki:
-FLE Standard Time:-1,67:FI:Europe/Helsinki:
-GFT:-1,67::Europe/Athens:
-GFT Standard Time:-1,67::Europe/Athens:
-GTB:-1,67::Europe/Athens:
-GTB Standard Time:-1,67::Europe/Athens:
-Israel:-1,70::Asia/Jerusalem:
-Israel Standard Time:-1,70::Asia/Jerusalem:
-Arab:-1,71::Asia/Riyadh:
-Arab Standard Time:-1,71::Asia/Riyadh:
-Arabic Standard Time:-1,71:IQ:Asia/Baghdad:
-E. Africa:-1,71:KE:Africa/Nairobi:
-E. Africa Standard Time:-1,71:KE:Africa/Nairobi:
-Saudi Arabia:-1,71::Asia/Riyadh:
-Saudi Arabia Standard Time:-1,71::Asia/Riyadh:
-Iran:-1,72::Asia/Tehran:
-Iran Standard Time:-1,72::Asia/Tehran:
-Afghanistan:-1,73::Asia/Kabul:
-Afghanistan Standard Time:-1,73::Asia/Kabul:
-India:-1,74::Asia/Calcutta:
-India Standard Time:-1,74::Asia/Calcutta:
-Myanmar Standard Time:-1,74::Asia/Rangoon:
-Nepal Standard Time:-1,74::Asia/Katmandu:
-Sri Lanka:-1,74:LK:Asia/Colombo:
-Sri Lanka Standard Time:-1,74:LK:Asia/Colombo:
-Beijing:-1,75::Asia/Shanghai:
-China:-1,75::Asia/Shanghai:
-China Standard Time:-1,75::Asia/Shanghai:
-AUS Central:-1,76::Australia/Darwin:
-AUS Central Standard Time:-1,76::Australia/Darwin:
-Cen. Australia:-1,76::Australia/Adelaide:
-Cen. Australia Standard Time:-1,76::Australia/Adelaide:
-Vladivostok:-1,77::Asia/Vladivostok:
-Vladivostok Standard Time:-1,77::Asia/Vladivostok:
-West Pacific:-1,77:GU:Pacific/Guam:
-West Pacific Standard Time:-1,77:GU:Pacific/Guam:
-E. South America:-1,80::America/Sao_Paulo:
-E. South America Standard Time:-1,80::America/Sao_Paulo:
-Greenland Standard Time:-1,80:GL:America/Godthab:
-Newfoundland:-1,81::America/St_Johns:
-Newfoundland Standard Time:-1,81::America/St_Johns:
-Pacific SA:-1,82::America/Santiago:
-Pacific SA Standard Time:-1,82::America/Santiago:
-SA Western:-1,82:BO:America/La_Paz:
-SA Western Standard Time:-1,82:BO:America/La_Paz:
-SA Pacific:-1,83::America/Bogota:
-SA Pacific Standard Time:-1,83::America/Bogota:
-US Eastern:-1,84::America/Indianapolis:
-US Eastern Standard Time:-1,84::America/Indianapolis:
-Central America Standard Time:-1,85::America/Regina:
-Mexico:-1,85::America/Mexico_City:
-Mexico Standard Time:-1,85::America/Mexico_City:
-Canada Central:-1,86::America/Regina:
-Canada Central Standard Time:-1,86::America/Regina:
-US Mountain:-1,87::America/Phoenix:
-US Mountain Standard Time:-1,87::America/Phoenix:
-GMT:0,1::Europe/London:
-GMT Standard Time:0,1::Europe/London:
-Ekaterinburg:10,11::Asia/Yekaterinburg:
-Ekaterinburg Standard Time:10,11::Asia/Yekaterinburg:
-West Asia:10,11:UZ:Asia/Tashkent:
-West Asia Standard Time:10,11:UZ:Asia/Tashkent:
-Central Asia:12,13::Asia/Almaty:
-Central Asia Standard Time:12,13::Asia/Almaty:
-N. Central Asia Standard Time:12,13::Asia/Novosibirsk:
-Bangkok:14,15::Asia/Bangkok:
-Bangkok Standard Time:14,15::Asia/Bangkok:
-North Asia Standard Time:14,15::Asia/Krasnoyarsk:
-SE Asia:14,15::Asia/Bangkok:
-SE Asia Standard Time:14,15::Asia/Bangkok:
-North Asia East Standard Time:16,17:RU:Asia/Irkutsk:
-Singapore:16,17:SG:Asia/Singapore:
-Singapore Standard Time:16,17:SG:Asia/Singapore:
-Taipei:16,17::Asia/Taipei:
-Taipei Standard Time:16,17::Asia/Taipei:
-W. Australia:16,17:AU:Australia/Perth:
-W. Australia Standard Time:16,17:AU:Australia/Perth:
-Korea:18,19:KR:Asia/Seoul:
-Korea Standard Time:18,19:KR:Asia/Seoul:
-Tokyo:18,19::Asia/Tokyo:
-Tokyo Standard Time:18,19::Asia/Tokyo:
-Yakutsk:18,19:RU:Asia/Yakutsk:
-Yakutsk Standard Time:18,19:RU:Asia/Yakutsk:
-Central European:2,3:CS:Europe/Belgrade:
-Central European Standard Time:2,3:CS:Europe/Belgrade:
-W. Europe:2,3::Europe/Berlin:
-W. Europe Standard Time:2,3::Europe/Berlin:
-Tasmania:20,-1::Australia/Hobart:
-Tasmania Standard Time:20,-1::Australia/Hobart:
-AUS Eastern:20,21::Australia/Sydney:
-AUS Eastern Standard Time:20,21::Australia/Sydney:
-E. Australia:20,21::Australia/Brisbane:
-E. Australia Standard Time:20,21::Australia/Brisbane:
-Sydney Standard Time:20,21::Australia/Sydney:
-Tasmania Standard Time:20,65::Australia/Hobart:
-Central Pacific:22,23::Pacific/Guadalcanal:
-Central Pacific Standard Time:22,23::Pacific/Guadalcanal:
-Dateline:24,25::GMT-1200:
-Dateline Standard Time:24,25::GMT-1200:
-Fiji:24,25::Pacific/Fiji:
-Fiji Standard Time:24,25::Pacific/Fiji:
-Samoa:26,27::Pacific/Apia:
-Samoa Standard Time:26,27::Pacific/Apia:
-Hawaiian:28,29::Pacific/Honolulu:
-Hawaiian Standard Time:28,29::Pacific/Honolulu:
-Alaskan:30,31::America/Anchorage:
-Alaskan Standard Time:30,31::America/Anchorage:
-Pacific:32,33::America/Los_Angeles:
-Pacific Standard Time:32,33::America/Los_Angeles:
-Mexico Standard Time 2:34,35:MX:America/Chihuahua:
-Mountain:34,35::America/Denver:
-Mountain Standard Time:34,35::America/Denver:
-Central:36,37::America/Chicago:
-Central Standard Time:36,37::America/Chicago:
-Eastern:38,39::America/New_York:
-Eastern Standard Time:38,39::America/New_York:
-E. Europe:4,5::EET:
-E. Europe Standard Time:4,5::EET:
-Egypt:4,68::Africa/Cairo:
-Egypt Standard Time:4,68::Africa/Cairo:
-South Africa:4,69::Africa/Harare:
-South Africa Standard Time:4,69::Africa/Harare:
-Atlantic:40,41::America/Halifax:
-Atlantic Standard Time:40,41::America/Halifax:
-SA Eastern:42,43:GF:America/Cayenne:
-SA Eastern Standard Time:42,43:GF:America/Cayenne:
-Mid-Atlantic:44,45::Atlantic/South_Georgia:
-Mid-Atlantic Standard Time:44,45::Atlantic/South_Georgia:
-Azores:46,47::Atlantic/Azores:
-Azores Standard Time:46,47::Atlantic/Azores:
-Cape Verde Standard Time:46,47::Atlantic/Cape_Verde:
-Russian:6,7::Europe/Moscow:
-Russian Standard Time:6,7::Europe/Moscow:
-New Zealand:78,79::Pacific/Auckland:
-New Zealand Standard Time:78,79::Pacific/Auckland:
-Tonga Standard Time:78,79::Pacific/Tongatapu:
-Arabian:8,9::Asia/Muscat:
-Arabian Standard Time:8,9::Asia/Muscat:
-Caucasus:8,9:AM:Asia/Yerevan:
-Caucasus Standard Time:8,9:AM:Asia/Yerevan:
-GMT Standard Time:88,89::GMT:
-Greenwich:88,89::GMT:
-Greenwich Standard Time:88,89::GMT:
-Aleutian Standard Time:900,900:US:America/Adak:
-Altai Standard Time:901,901::Asia/Barnaul:
-Argentina Standard Time:902,902::America/Buenos_Aires:
-Armenian Standard Time:903,903:AM:Asia/Yerevan:
-Astrakhan Standard Time:904,904::Europe/Astrakhan:
-Aus Central W. Standard Time:905,905::Australia/Eucla:
-Azerbaijan Standard Time:906,906:AZ:Asia/Baku:
-Bahia Standard Time:907,907::America/Bahia:
-Bangladesh Standard Time:908,908::Asia/Dhaka:
-Belarus Standard Time:909,909:BY:Europe/Minsk:
-Bougainville Standard Time:910,910::Pacific/Bougainville:
-Central Brazilian Standard Time:911,911:BR:America/Cuiaba:
-Central Standard Time (Mexico):912,912::America/Mexico_City:
-Chatham Islands Standard Time:913,913::Pacific/Chatham:
-Cuba Standard Time:914,914:CU:America/Havana:
-Easter Island Standard Time:915,915:CL:Pacific/Easter:
-Eastern Standard Time (Mexico):916,916::America/Cancun:
-Georgian Standard Time:917,917:GE:Asia/Tbilisi:
-Haiti Standard Time:918,918:HT:America/Port-au-Prince:
-Jordan Standard Time:919,919:JO:Asia/Amman:
-Kaliningrad Standard Time:920,920:RU:Europe/Kaliningrad:
-Kamchatka Standard Time:921,921:RU:Asia/Kamchatka:
-Libya Standard Time:922,922:LY:Africa/Tripoli:
-Line Islands Standard Time:923,923::Pacific/Kiritimati:
-Lord Howe Standard Time:924,924::Australia/Lord_Howe:
-Magadan Standard Time:925,925::Asia/Magadan:
-Marquesas Standard Time:926,926::Pacific/Marquesas:
-Mauritius Standard Time:927,927:MU:Indian/Mauritius:
-Middle East Standard Time:928,928:LB:Asia/Beirut:
-Montevideo Standard Time:929,929:UY:America/Montevideo:
-Morocco Standard Time:930,930:MA:Africa/Casablanca:
-Mountain Standard Time (Mexico):931,931:MX:America/Chihuahua:
-Namibia Standard Time:932,932:NA:Africa/Windhoek:
-Norfolk Standard Time:933,933::Pacific/Norfolk:
-North Korea Standard Time:934,934:KP:Asia/Pyongyang:
-Pacific Standard Time (Mexico):935,935:MX:America/Tijuana:
-Pakistan Standard Time:936,936::Asia/Karachi:
-Paraguay Standard Time:937,937:PY:America/Asuncion:
-Russia Time Zone 10:938,938::Asia/Srednekolymsk:
-Russia Time Zone 11:939,939::Asia/Anadyr:
-Russia Time Zone 3:940,940::Europe/Samara:
-Saint Pierre Standard Time:941,941:PM:America/Miquelon:
-Sakhalin Standard Time:942,942::Asia/Sakhalin:
-Syria Standard Time:943,943:SY:Asia/Damascus:
-Tocantins Standard Time:944,944::America/Araguaina:
-Tomsk Standard Time:945,945::Asia/Tomsk:
-Transbaikal Standard Time:946,946::Asia/Chita:
-Turkey Standard Time:947,947::Asia/Istanbul:
-Turks And Caicos Standard Time:948,948:TC:America/Grand_Turk:
-UTC+12:949,949::GMT+1200:
-UTC-02:950,950::GMT-0200:
-UTC-08:951,951::GMT-0800:
-UTC-09:952,952::GMT-0900:
-UTC-11:953,953::GMT-1100:
-UTC:954,954::UTC:
-Ulaanbaatar Standard Time:955,955::Asia/Ulaanbaatar:
-Venezuela Standard Time:956,956::America/Caracas:
-W. Mongolia Standard Time:957,957::Asia/Hovd:
-West Bank Standard Time:958,958::Asia/Gaza:
-Western Brazilian Standard Time:959,959:BR:America/Rio_Branco:
--- a/src/java.base/windows/native/libjava/TimeZone_md.c	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/windows/native/libjava/TimeZone_md.c	Tue Sep 18 16:41:24 2018 -0700
@@ -36,6 +36,7 @@
 
 #define MAX_ZONE_CHAR           256
 #define MAX_MAPID_LENGTH        32
+#define MAX_REGION_LENGTH       4
 
 #define NT_TZ_KEY               "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Time Zones"
 #define WIN_TZ_KEY              "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Time Zones"
@@ -145,7 +146,7 @@
 /*
  * Gets the current time zone entry in the "Time Zones" registry.
  */
-static int getWinTimeZone(char *winZoneName, char *winMapID)
+static int getWinTimeZone(char *winZoneName)
 {
     DYNAMIC_TIME_ZONE_INFORMATION dtzi;
     DWORD timeType;
@@ -231,7 +232,6 @@
         WCHAR stdNameInReg[MAX_ZONE_CHAR];
         TziValue tempTzi;
         WCHAR *stdNamePtr = tzi.StandardName;
-        DWORD valueSize;
         int onlyMapID;
 
         timeType = GetTimeZoneInformation(&tzi);
@@ -372,24 +372,7 @@
             (void) RegCloseKey(hSubKey);
         }
 
-        /*
-         * Get the "MapID" value of the registry to be able to eliminate
-         * duplicated key names later.
-         */
-        valueSize = MAX_MAPID_LENGTH;
-        ret = RegQueryValueExA(hSubKey, "MapID", NULL, &valueType, winMapID, &valueSize);
-        (void) RegCloseKey(hSubKey);
         (void) RegCloseKey(hKey);
-
-        if (ret != ERROR_SUCCESS) {
-            /*
-             * Vista doesn't have mapID. VALUE_UNKNOWN should be returned
-             * only for Windows NT.
-             */
-            if (onlyMapID == 1) {
-                return VALUE_UNKNOWN;
-            }
-        }
     }
 
     return VALUE_KEY;
@@ -410,24 +393,17 @@
  * Index values for the mapping table.
  */
 #define TZ_WIN_NAME     0
-#define TZ_MAPID        1
-#define TZ_REGION       2
-#define TZ_JAVA_NAME    3
+#define TZ_REGION       1
+#define TZ_JAVA_NAME    2
 
-#define TZ_NITEMS       4       /* number of items (fields) */
+#define TZ_NITEMS       3       /* number of items (fields) */
 
 /*
  * Looks up the mapping table (tzmappings) and returns a Java time
  * zone ID (e.g., "America/Los_Angeles") if found. Otherwise, NULL is
  * returned.
- *
- * value_type is one of the following values:
- *      VALUE_KEY for exact key matching
- *      VALUE_MAPID for MapID (this is
- *      required for the old Windows, such as NT 4.0 SP3).
  */
-static char *matchJavaTZ(const char *java_home_dir, int value_type, char *tzName,
-                         char *mapID)
+static char *matchJavaTZ(const char *java_home_dir, char *tzName)
 {
     int line;
     int IDmatched = 0;
@@ -436,9 +412,22 @@
     char *items[TZ_NITEMS];
     char *mapFileName;
     char lineBuffer[MAX_ZONE_CHAR * 4];
-    int noMapID = *mapID == '\0';       /* no mapID on Vista and later */
     int offset = 0;
     const char* errorMessage = "unknown error";
+    char region[MAX_REGION_LENGTH];
+
+    // Get the user's location
+    if (GetGeoInfo(GetUserGeoID(GEOCLASS_NATION),
+            GEO_ISO2, region, MAX_REGION_LENGTH, 0) == 0) {
+        // If GetGeoInfo fails, fallback to LCID's country
+        LCID lcid = GetUserDefaultLCID();
+        if (GetLocaleInfo(lcid,
+                          LOCALE_SISO3166CTRYNAME, region, MAX_REGION_LENGTH) == 0 &&
+            GetLocaleInfo(lcid,
+                          LOCALE_SISO3166CTRYNAME2, region, MAX_REGION_LENGTH) == 0) {
+            region[0] = '\0';
+        }
+    }
 
     mapFileName = malloc(strlen(java_home_dir) + strlen(MAPPINGS_FILE) + 1);
     if (mapFileName == NULL) {
@@ -494,28 +483,20 @@
             goto illegal_format;
         }
 
-        if (noMapID || strcmp(mapID, items[TZ_MAPID]) == 0) {
+        /*
+         * We need to scan items until the
+         * exact match is found or the end of data is detected.
+         */
+        if (strcmp(items[TZ_WIN_NAME], tzName) == 0) {
             /*
-             * When there's no mapID, we need to scan items until the
-             * exact match is found or the end of data is detected.
+             * Found the time zone in the mapping table.
+             * Check the region code and select the appropriate entry
              */
-            if (!noMapID) {
-                IDmatched = 1;
-            }
-            if (strcmp(items[TZ_WIN_NAME], tzName) == 0) {
-                /*
-                 * Found the time zone in the mapping table.
-                 */
+            if (strcmp(items[TZ_REGION], region) == 0 ||
+                strcmp(items[TZ_REGION], "001") == 0) {
                 javaTZName = _strdup(items[TZ_JAVA_NAME]);
                 break;
             }
-        } else {
-            if (IDmatched == 1) {
-                /*
-                 * No need to look up the mapping table further.
-                 */
-                break;
-            }
         }
     }
     fclose(fp);
@@ -535,19 +516,16 @@
 char *findJavaTZ_md(const char *java_home_dir)
 {
     char winZoneName[MAX_ZONE_CHAR];
-    char winMapID[MAX_MAPID_LENGTH];
     char *std_timezone = NULL;
     int  result;
 
-    winMapID[0] = 0;
-    result = getWinTimeZone(winZoneName, winMapID);
+    result = getWinTimeZone(winZoneName);
 
     if (result != VALUE_UNKNOWN) {
         if (result == VALUE_GMTOFFSET) {
             std_timezone = _strdup(winZoneName);
         } else {
-            std_timezone = matchJavaTZ(java_home_dir, result,
-                                       winZoneName, winMapID);
+            std_timezone = matchJavaTZ(java_home_dir, winZoneName);
             if (std_timezone == NULL) {
                 std_timezone = getGMTOffsetID();
             }
--- a/src/java.base/windows/native/libjava/canonicalize_md.c	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/windows/native/libjava/canonicalize_md.c	Tue Sep 18 16:41:24 2018 -0700
@@ -225,6 +225,8 @@
     return 1;
 }
 
+int wcanonicalize(WCHAR *orig_path, WCHAR *result, int size);
+
 /* Convert a pathname to canonical form.  The input orig_path is assumed to
    have been converted to native form already, via JVM_NativePath().  This is
    necessary because _fullpath() rejects duplicate separator characters on
@@ -237,6 +239,38 @@
     HANDLE h;
     char path[1024];    /* Working copy of path */
     char *src, *dst, *dend;
+    wchar_t *worig_path, *wresult;
+    size_t converted_chars = 0;
+
+    /* handle long path with length >= MAX_PATH */
+    if (strlen(orig_path) >= MAX_PATH) {
+        if ((worig_path = (WCHAR*)malloc(size * sizeof(WCHAR))) == NULL)
+            return -1;
+
+        if (mbstowcs_s(&converted_chars, worig_path, (size_t)size, orig_path, (size_t)(size - 1)) != 0) {
+            free(worig_path);
+            return -1;
+        }
+
+        if ((wresult = (WCHAR*)malloc(size * sizeof(WCHAR))) == NULL)
+            return -1;
+
+        if (wcanonicalize(worig_path, wresult, size) != 0) {
+            free(worig_path);
+            free(wresult);
+            return -1;
+        }
+
+        if (wcstombs_s(&converted_chars, result, (size_t)size, wresult, (size_t)(size - 1)) != 0) {
+            free(worig_path);
+            free(wresult);
+            return -1;
+        }
+
+        free(worig_path);
+        free(wresult);
+        return 0;
+    }
 
     /* Reject paths that contain wildcards */
     if (wild(orig_path)) {
@@ -245,15 +279,15 @@
     }
 
     /* Collapse instances of "foo\.." and ensure absoluteness.  Note that
-       contrary to the documentation, the _fullpath procedure does not require
-       the drive to be available.  It also does not reliably change all
-       occurrences of '/' to '\\' on Win95, so now JVM_NativePath does that. */
-    if(!_fullpath(path, orig_path, sizeof(path))) {
+      contrary to the documentation, the _fullpath procedure does not require
+      the drive to be available.  It also does not reliably change all
+      occurrences of '/' to '\\' on Win95, so now JVM_NativePath does that. */
+    if (!_fullpath(path, orig_path, sizeof(path))) {
         return -1;
     }
 
     /* Correction for Win95: _fullpath may leave a trailing "\\"
-       on a UNC pathname */
+      on a UNC pathname */
     if ((path[0] == '\\') && (path[1] == '\\')) {
         char *p = path + strlen(path);
         if ((p[-1] == '\\') && !islb(p[-2])) {
@@ -281,16 +315,16 @@
         char *p;
         p = nextsep(src + 2);    /* Skip past host name */
         if (!*p) {
-        /* A UNC pathname must begin with "\\\\host\\share",
-           so reject this path as invalid if there is no share name */
+            /* A UNC pathname must begin with "\\\\host\\share",
+            so reject this path as invalid if there is no share name */
             errno = EINVAL;
             return -1;
-    }
-    p = nextsep(p + 1);    /* Skip past share name */
-    if (!(dst = cp(dst, dend, '\0', src, p))) {
-        return -1;
-    }
-    src = p;
+        }
+        p = nextsep(p + 1);    /* Skip past share name */
+        if (!(dst = cp(dst, dend, '\0', src, p))) {
+            return -1;
+        }
+        src = p;
     } else {
         /* Invalid path */
         errno = EINVAL;
@@ -309,11 +343,11 @@
     }
 
     /* At this point we have copied either a drive specifier ("z:") or a UNC
-       prefix ("\\\\host\\share") to the result buffer, and src points to the
-       first byte of the remainder of the path.  We now scan through the rest
-       of the path, looking up each prefix in order to find the true name of
-       the last element of each prefix, thereby computing the full true name of
-       the original path. */
+    prefix ("\\\\host\\share") to the result buffer, and src points to the
+    first byte of the remainder of the path.  We now scan through the rest
+    of the path, looking up each prefix in order to find the true name of
+    the last element of each prefix, thereby computing the full true name of
+    the original path. */
     while (*src) {
         char *p = nextsep(src + 1);    /* Find next separator */
         char c = *p;
@@ -325,8 +359,8 @@
             /* Lookup succeeded; append true name to result and continue */
             FindClose(h);
             if (!(dst = cp(dst, dend, '\\',
-                           fd.cFileName,
-                           fd.cFileName + strlen(fd.cFileName)))) {
+                fd.cFileName,
+                fd.cFileName + strlen(fd.cFileName)))) {
                 return -1;
             }
             src = p;
@@ -344,8 +378,8 @@
     }
 
     if (dst >= dend) {
-    errno = ENAMETOOLONG;
-    return -1;
+        errno = ENAMETOOLONG;
+        return -1;
     }
     *dst = '\0';
     return 0;
@@ -587,7 +621,7 @@
  */
 
 /* copy \\?\ or \\?\UNC\ to the front of path*/
-WCHAR*
+__declspec(dllexport) WCHAR*
 getPrefixed(const WCHAR* path, int pathlen) {
     WCHAR* pathbuf = (WCHAR*)malloc((pathlen + 10) * sizeof (WCHAR));
     if (pathbuf != 0) {
--- a/src/java.base/windows/native/libjava/io_util_md.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.base/windows/native/libjava/io_util_md.h	Tue Sep 18 16:41:24 2018 -0700
@@ -38,7 +38,7 @@
  */
 WCHAR* pathToNTPath(JNIEnv *env, jstring path, jboolean throwFNFE);
 WCHAR* fileToNTPath(JNIEnv *env, jobject file, jfieldID id);
-WCHAR* getPrefixed(const WCHAR* path, int pathlen);
+__declspec(dllexport) WCHAR* getPrefixed(const WCHAR* path, int pathlen);
 WCHAR* currentDir(int di);
 int currentDirLength(const WCHAR* path, int pathlen);
 int handleAvailable(FD fd, jlong *pbytes);
--- a/src/java.desktop/windows/native/common/awt_makecube.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,442 +0,0 @@
-/*
- * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include "awt.h"
-#include "awt_image.h"
-
-extern "C" {
-#include "img_colors.h"
-} // extern "C"
-
-char *programname = "awt_makecube";
-
-unsigned char cube[LOOKUPSIZE * LOOKUPSIZE * LOOKUPSIZE];
-
-unsigned char reds[256], greens[256], blues[256], indices[256];
-int num_colors;
-
-PALETTEENTRY sysPal[256];
-
-int sys2cmap[256];
-int cmap2sys[256];
-int error[256];
-
-int cmapsize = 0;
-int virtcubesize = 0;
-int makecube_verbose = 0;
-
-void printPalette(char *label, HPALETTE hPal);
-
-void usage(char *errmsg)
-{
-    fprintf(stderr, "%s\n", errmsg);
-    fprintf(stderr, "usage: %s [-cmapsize N] [-cubesize N]\n", programname);
-    fprintf(stderr, "\t-cmapsize N   set the number of colors to allocate\n");
-    fprintf(stderr, "\t              in the colormap (2 <= N <= 256)\n");
-    fprintf(stderr, "\t-cubesize N   set the size of the cube of colors to\n");
-    fprintf(stderr, "                scan as potential entries in the cmap\n");
-    fprintf(stderr, "                (N must be a power of 2 and <= 32)\n");
-    exit(1);
-}
-
-void setsyscolor(int index, int red, int green, int blue)
-{
-    if (index >= 0) {
-        if (sysPal[index].peFlags != 0) {
-            usage("Internal error: system palette conflict");
-        }
-    } else {
-        for (int i = 0; i < 256; i++) {
-            if (sysPal[i].peFlags != 0) {
-                if (sysPal[i].peRed   == red &&
-                    sysPal[i].peGreen == green &&
-                    sysPal[i].peBlue  == blue)
-                {
-                    // Already there.  Ignore it.
-                    return;
-                }
-            } else if (index < 0) {
-                index = i;
-            }
-        }
-        if (index < 0) {
-            usage("Internal error: ran out of system palette entries");
-        }
-    }
-    sysPal[index].peRed   = red;
-    sysPal[index].peGreen = green;
-    sysPal[index].peBlue  = blue;
-    sysPal[index].peFlags = 1;
-}
-
-void addcmapcolor(int red, int green, int blue)
-{
-    for (int i = 0; i < num_colors; i++) {
-        if (red == reds[i] && green == greens[i] && blue == blues[i]) {
-            return;
-        }
-    }
-    if (num_colors >= cmapsize) {
-        usage("Internal error: more than cmapsize static colors defined");
-    }
-    reds[num_colors]   = red;
-    greens[num_colors] = green;
-    blues[num_colors]  = blue;
-    num_colors++;
-}
-
-int main(int argc, char **argv)
-{
-    int i;
-
-    programname = argv[0];
-
-    for (i = 1; i < argc; i++) {
-        if (strcmp(argv[i], "-cmapsize") == 0) {
-            if (i++ >= argc) {
-                usage("no argument to -cmapsize");
-            }
-            cmapsize = atoi(argv[i]);
-            if (cmapsize <= 2 || cmapsize > 256) {
-                usage("colormap size must be between 2 and 256");
-            }
-        } else if (strcmp(argv[1], "-cubesize") == 0) {
-            if (i++ >= argc) {
-                usage("no argument to -cubesize");
-            }
-            virtcubesize = atoi(argv[i]);
-            if (virtcubesize == 0 ||
-                (virtcubesize & (virtcubesize - 1)) != 0 ||
-                virtcubesize > 32)
-            {
-                usage("cube size must by a power of 2 <= 32");
-            }
-        } else if (strcmp(argv[i], "-verbose") == 0) {
-            makecube_verbose = 1;
-        } else {
-            usage("unknown argument");
-        }
-    }
-
-    if (cmapsize == 0) {
-        cmapsize = CMAPSIZE;
-    }
-    if (virtcubesize == 0) {
-        virtcubesize = VIRTCUBESIZE;
-    }
-
-    if (0) {  // For testing
-        HDC hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
-        HPALETTE hPal = CreateHalftonePalette(hDC);
-        printPalette("Halftone palette for current display", hPal);
-        printPalette("Stock DEFAULT_PALETTE", (HPALETTE)GetStockObject(DEFAULT_PALETTE));
-        BITMAPINFOHEADER bmInfo = {
-            sizeof(BITMAPINFOHEADER), 1, 1, 1, 8, BI_RGB, 0, 1000, 1000, 0, 0
-            };
-        HBITMAP hBitmap = CreateDIBitmap(hDC, &bmInfo,
-                                         0, NULL, NULL, DIB_RGB_COLORS);
-        HDC hMemDC = CreateCompatibleDC(hDC);
-        SelectObject(hDC, hBitmap);
-        hPal = CreateHalftonePalette(hMemDC);
-        printPalette("Halftone palette for 8-bit DIBitmap", hPal);
-        exit(0);
-    }
-
-    // Allocate Windows static system colors.
-    {
-        PALETTEENTRY palEntries[256];
-        HPALETTE hPal = (HPALETTE)GetStockObject(DEFAULT_PALETTE);
-        int n = GetPaletteEntries(hPal, 0, 256, palEntries);
-        for (i = 0; i < n; i++) {
-            addcmapcolor(palEntries[i].peRed,
-                         palEntries[i].peGreen,
-                         palEntries[i].peBlue);
-            setsyscolor((i < n / 2) ? i : i + (256 - n),
-                        palEntries[i].peRed,
-                        palEntries[i].peGreen,
-                        palEntries[i].peBlue);
-        }
-    }
-
-    // Allocate java.awt.Color constant colors.
-    addcmapcolor(  0,   0,   0);        // black
-    addcmapcolor(255, 255, 255);        // white
-    addcmapcolor(255,   0,   0);        // red
-    addcmapcolor(  0, 255,   0);        // green
-    addcmapcolor(  0,   0, 255);        // blue
-    addcmapcolor(255, 255,   0);        // yellow
-    addcmapcolor(255,   0, 255);        // magenta
-    addcmapcolor(  0, 255, 255);        // cyan
-    addcmapcolor(192, 192, 192);        // lightGray
-    addcmapcolor(128, 128, 128);        // gray
-    addcmapcolor( 64,  64,  64);        // darkGray
-    addcmapcolor(255, 175, 175);        // pink
-    addcmapcolor(255, 200,   0);        // orange
-
-    img_makePalette(cmapsize, virtcubesize, LOOKUPSIZE,
-                    50.0f, 250.0f,
-                    num_colors, TRUE, reds, greens, blues, cube);
-
-    if (makecube_verbose) {
-        fprintf(stderr, "Calculated colormap:\n");
-        for (i = 0; i < cmapsize; i++) {
-            fprintf(stderr, "%3d:(%3d,%3d,%3d)   ",
-                    i, reds[i], greens[i], blues[i]);
-        }
-        fprintf(stderr, "\n");
-    }
-
-    // Now simulate adding the halftone palette to the system
-    // palette to get an idea of palette ordering.
-    {
-        int cubevals[6] = {0, 44, 86, 135, 192, 255};
-        for (int b = 0; b < 6; b++) {
-            for (int g = 0; g < 6; g++) {
-                for (int r = 0; r < 6; r++) {
-                    setsyscolor(-1, cubevals[r], cubevals[g], cubevals[b]);
-                }
-            }
-        }
-        int grayvals[26] = {  0,  17,  24,  30,  37,  44,  52,  60,
-                             68,  77,  86,  95, 105, 114, 125, 135,
-                            146, 157, 168, 180, 192, 204, 216, 229,
-                            242, 255 };
-        for (i = 0; i < 26; i++) {
-            setsyscolor(-1, grayvals[i], grayvals[i], grayvals[i]);
-        }
-    }
-
-    if (makecube_verbose) {
-        fprintf(stderr, "System palette with simulated halftone palette:\n");
-        for (i = 0; i < 256; i++) {
-            fprintf(stderr, "%3d:(%3d,%3d,%3d)   ",
-                    i, sysPal[i].peRed, sysPal[i].peGreen, sysPal[i].peBlue);
-        }
-    }
-
-    if (makecube_verbose) {
-        HDC hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
-        HPALETTE hPal = CreateHalftonePalette(hDC);
-        SelectPalette(hDC, hPal, FALSE);
-        RealizePalette(hDC);
-        PALETTEENTRY palEntries[256];
-        int n = GetSystemPaletteEntries(hDC, 0, 256, palEntries);
-        fprintf(stderr,
-                "realized halftone palette reads back %d entries\n", n);
-        int broken = 0;
-        for (i = 0; i < 256; i++) {
-            char *msg1 = "";
-            char *msg2 = "";
-            if (palEntries[i].peRed != sysPal[i].peRed ||
-                palEntries[i].peGreen != sysPal[i].peGreen ||
-                palEntries[i].peBlue != sysPal[i].peBlue)
-            {
-                msg1 = "no sysPal match!";
-                if (sysPal[i].peFlags == 0) {
-                    msg2 = "(OK)";
-                } else {
-                    broken++;
-                }
-            } else if (sysPal[i].peFlags == 0) {
-                msg1 = "no sysPal entry...";
-            }
-            fprintf(stderr,
-                    "palEntries[%3d] = (%3d, %3d, %3d), flags = %d  %s %s\n",
-                    i,
-                    palEntries[i].peRed,
-                    palEntries[i].peGreen,
-                    palEntries[i].peBlue,
-                    palEntries[i].peFlags, msg1, msg2);
-        }
-        fprintf(stderr, "%d broken entries\n", broken);
-    }
-
-#if 0
-#define BIGERROR (255 * 255 * 255)
-
-    for (i = 0; i < 256; i++) {
-        sys2cmap[i] = -1;
-        cmap2sys[i] = -1;
-        error[i] = BIGERROR;
-        // error[i] = -1 means cmap[i] is locked to cmap2sys[i]
-        // error[i] >= 0 means cmap[i] may lock to cmap2sys[i] on this run
-    }
-
-    int nummapped;
-    int totalmapped = 0;
-    do {
-        int maxerror = BIGERROR;
-        for (i = 0; i < 256; i++) {
-            if (sysPal[i].peFlags == 0 || sys2cmap[i] >= 0) {
-                continue;
-            }
-            int red   = sysPal[i].peRed;
-            int green = sysPal[i].peGreen;
-            int blue  = sysPal[i].peBlue;
-            int e = maxerror;
-            int ix = -1;
-            for (int j = 0; j < 256; j++) {
-                if (error[j] < 0) {
-                    continue;
-                }
-                int t = red - reds[j];
-                int d = t * t;
-                t = green - greens[j];
-                d += t * t;
-                t = blue - blues[j];
-                d += t * t;
-                if (d < e) {
-                    e = d;
-                    ix = j;
-                }
-            }
-            if (ix >= 0) {
-                if (e < error[ix]) {
-                    if (cmap2sys[ix] >= 0) {
-                        // To be fair we will not accept any matches
-                        // looser than this former match that we just
-                        // displaced with a better match.
-                        if (maxerror > error[ix]) {
-                            maxerror = error[ix];
-                        }
-                        sys2cmap[cmap2sys[ix]] = -1;
-                    }
-                    error[ix] = e;
-                    sys2cmap[i] = ix;
-                    cmap2sys[ix] = i;
-                }
-            }
-        }
-        nummapped = 0;
-        for (i = 0; i < 256; i++) {
-            if (error[i] >= 0) {
-                if (error[i] >= maxerror) {
-                    // Throw this one back to be fair to a displaced entry.
-                    error[i] = BIGERROR;
-                    sys2cmap[cmap2sys[i]] = -1;
-                    cmap2sys[i] = -1;
-                    continue;
-                }
-                error[i] = -1;
-                nummapped++;
-            }
-        }
-        totalmapped += nummapped;
-        if (makecube_verbose) {
-            fprintf(stderr, "%3d colors mapped (%3d total), maxerror = %d\n",
-                    nummapped, totalmapped, maxerror);
-        }
-    } while (nummapped != 0);
-
-    for (i = 0; i < 256; i++) {
-        if (cmap2sys[i] < 0) {
-            for (int j = 0; j < 256; j++) {
-                if (sys2cmap[j] < 0) {
-                    cmap2sys[i] = j;
-                    sys2cmap[j] = i;
-                    break;
-                }
-            }
-            if (j == 256) {
-                usage("Internal error: no unused system entry for cmap entry!\n");
-            }
-        }
-    }
-#else
-    for (i = 0; i < 256; i++) {
-        if (i < 10) {
-            sys2cmap[i] = i;
-            cmap2sys[i] = i;
-        } else if (i < 20) {
-            sys2cmap[256 - 20 + i] = i;
-            cmap2sys[i] = 256 - 20 + i;
-        } else {
-            sys2cmap[i - 10] = i;
-            cmap2sys[i] = i - 10;
-        }
-    }
-#endif
-
-    if (makecube_verbose) {
-        fprintf(stderr, "cmap2sys mapping: \n");
-        for (i = 0; i < 256; i++) {
-            fprintf(stderr, "%4d", cmap2sys[i]);
-            if (sys2cmap[cmap2sys[i]] != i) {
-                usage("Internal error: bad system palette back pointer!\n");
-            }
-        }
-        fprintf(stderr, "\n");
-    }
-
-    printf("unsigned char awt_reds[256] = {");
-    for (i = 0; i < 256; i++) {
-        if ((i & 0xf) == 0) printf("\n\t");
-        printf("%3d,", reds[sys2cmap[i]]);
-    }
-    printf("\n};\n");
-    printf("unsigned char awt_greens[256] = {");
-    for (i = 0; i < 256; i++) {
-        if ((i & 0xf) == 0) printf("\n\t");
-        printf("%3d,", greens[sys2cmap[i]]);
-    }
-    printf("\n};\n");
-    printf("unsigned char awt_blues[256] = {");
-    for (i = 0; i < 256; i++) {
-        if ((i & 0xf) == 0) printf("\n\t");
-        printf("%3d,", blues[sys2cmap[i]]);
-    }
-    printf("\n};\n");
-    fflush(stdout);
-    return 0;
-}
-
-void printPalette(char *label, HPALETTE hPal)
-{
-    PALETTEENTRY palEntries[256];
-    fprintf(stderr, "%s (0x%08x):\n", label, hPal);
-    int n = GetPaletteEntries(hPal, 0, 256, palEntries);
-    for (int i = 0; i < n; i++) {
-        fprintf(stderr, "palEntries[%3d] = (%3d, %3d, %3d), flags = %d\n",
-                i,
-                palEntries[i].peRed,
-                palEntries[i].peGreen,
-                palEntries[i].peBlue,
-                palEntries[i].peFlags);
-    }
-}
-
-/* This helps eliminate any dependence on javai.dll at build time. */
-int
-jio_fprintf (FILE *handle, const char *format, ...)
-{
-    int len;
-
-    va_list args;
-    va_start(args, format);
-    len = vfprintf(handle, format, args);
-    va_end(args);
-
-    return len;
-}
--- a/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2017, 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
@@ -115,7 +115,7 @@
     boolean isLdapv3;         // Used by LdapCtx
     int referenceCount = 1;   // Used by LdapCtx for check for sharing
 
-    Connection conn;  // Connection to server; has reader thread
+    final Connection conn;  // Connection to server; has reader thread
                       // used by LdapCtx for StartTLS
 
     final private PoolCallback pcb;
@@ -433,19 +433,16 @@
             (new Throwable()).printStackTrace();
         }
 
-        if (referenceCount <= 0 && conn != null) {
+        if (referenceCount <= 0) {
             if (debug > 0) System.err.println("LdapClient: closed connection " + this);
             if (!pooled) {
                 // Not being pooled; continue with closing
                 conn.cleanup(reqCtls, false);
-                conn = null;
             } else {
                 // Pooled
-
                 // Is this a real close or a request to return conn to pool
                 if (hardClose) {
                     conn.cleanup(reqCtls, false);
-                    conn = null;
                     pcb.removePooledConnection(this);
                 } else {
                     pcb.releasePooledConnection(this);
@@ -461,16 +458,13 @@
         if (debug > 1) {
             System.err.println("LdapClient: forceClose() of " + this);
         }
-
-        if (conn != null) {
-            if (debug > 0) System.err.println(
-                "LdapClient: forced close of connection " + this);
-            conn.cleanup(null, false);
-            conn = null;
-
-            if (cleanPool) {
-                pcb.removePooledConnection(this);
-            }
+        if (debug > 0) {
+            System.err.println(
+                    "LdapClient: forced close of connection " + this);
+        }
+        conn.cleanup(null, false);
+        if (cleanPool) {
+            pcb.removePooledConnection(this);
         }
     }
 
@@ -568,7 +562,7 @@
      * Abandon the search operation and remove it from the message queue.
      */
     void clearSearchReply(LdapResult res, Control[] ctls) {
-        if (res != null && conn != null) {
+        if (res != null) {
 
             // Only send an LDAP abandon operation when clearing the search
             // reply from a one-level or subtree search.
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToHTMLStream.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -40,6 +40,7 @@
  * because it is used from another package.
  *
  * @xsl.usage internal
+ * @LastModified: Sept 2018
  */
 public final class ToHTMLStream extends ToStream
 {
@@ -1049,7 +1050,7 @@
         String name,
         String value,
         ElemDesc elemDesc)
-        throws IOException
+        throws IOException, SAXException
     {
         writer.write(' ');
 
@@ -1373,7 +1374,7 @@
      */
     public void writeAttrString(
         final java.io.Writer writer, String string, String encoding)
-        throws IOException
+        throws IOException, SAXException
     {
         final int end = string.length();
         if (end > m_attrBuff.length)
@@ -1425,13 +1426,16 @@
                 }
                 else
                 {
-                    if (Encodings.isHighUTF16Surrogate(ch))
+                    if (Encodings.isHighUTF16Surrogate(ch) ||
+                            Encodings.isLowUTF16Surrogate(ch))
                     {
-
-                            writeUTF16Surrogate(ch, chars, i, end);
-                            i++; // two input characters processed
-                                 // this increments by one and the for()
-                                 // loop itself increments by another one.
+                        if (writeUTF16Surrogate(ch, chars, i, end) >= 0) {
+                            // move the index if the low surrogate is consumed
+                            // as writeUTF16Surrogate has written the pair
+                            if (Encodings.isHighUTF16Surrogate(ch)) {
+                                i++;
+                            }
+                        }
                     }
 
                     // The next is kind of a hack to keep from escaping in the case
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToStream.java	Tue Sep 18 16:41:24 2018 -0700
@@ -51,7 +51,7 @@
  * serializers (xml, html, text ...) that write output to a stream.
  *
  * @xsl.usage internal
- * @LastModified: Feb 2018
+ * @LastModified: Sept 2018
  */
 abstract public class ToStream extends SerializerBase {
 
@@ -193,6 +193,8 @@
      */
     private boolean m_expandDTDEntities = true;
 
+    private char m_highSurrogate = 0;
+
     /**
      * Default constructor
      */
@@ -953,45 +955,46 @@
      * @param ch Character array.
      * @param i position Where the surrogate was detected.
      * @param end The end index of the significant characters.
-     * @return 0 if the pair of characters was written out as-is,
-     * the unicode code point of the character represented by
-     * the surrogate pair if an entity reference with that value
-     * was written out.
+     * @return the status of writing a surrogate pair.
+     *        -1 -- nothing is written
+     *         0 -- the pair is written as-is
+     *         code point -- the pair is written as an entity reference
      *
      * @throws IOException
      * @throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected.
      */
     protected int writeUTF16Surrogate(char c, char ch[], int i, int end)
-        throws IOException
+        throws IOException, SAXException
     {
-        int codePoint = 0;
+        int status = -1;
         if (i + 1 >= end)
         {
-            throw new IOException(
-                Utils.messages.createMessage(
-                    MsgKey.ER_INVALID_UTF16_SURROGATE,
-                    new Object[] { Integer.toHexString((int) c)}));
+            m_highSurrogate = c;
+            return status;
         }
 
-        final char high = c;
-        final char low = ch[i+1];
+        char high, low;
+        if (m_highSurrogate == 0) {
+            high = c;
+            low = ch[i+1];
+            status = 0;
+        } else {
+            high = m_highSurrogate;
+            low = c;
+            m_highSurrogate = 0;
+        }
+
         if (!Encodings.isLowUTF16Surrogate(low)) {
-            throw new IOException(
-                Utils.messages.createMessage(
-                    MsgKey.ER_INVALID_UTF16_SURROGATE,
-                    new Object[] {
-                        Integer.toHexString((int) c)
-                            + " "
-                            + Integer.toHexString(low)}));
+            throwIOE(high, low);
         }
 
         final Writer writer = m_writer;
 
         // If we make it to here we have a valid high, low surrogate pair
-        if (m_encodingInfo.isInEncoding(c,low)) {
+        if (m_encodingInfo.isInEncoding(high,low)) {
             // If the character formed by the surrogate pair
             // is in the encoding, so just write it out
-            writer.write(ch,i,2);
+            writer.write(new char[]{high, low}, 0, 2);
         }
         else {
             // Don't know what to do with this char, it is
@@ -999,24 +1002,16 @@
             // a surrogate pair, so write out as an entity ref
             final String encoding = getEncoding();
             if (encoding != null) {
-                /* The output encoding is known,
-                 * so somthing is wrong.
-                  */
-                codePoint = Encodings.toCodePoint(high, low);
-                // not in the encoding, so write out a character reference
-                writer.write('&');
-                writer.write('#');
-                writer.write(Integer.toString(codePoint));
-                writer.write(';');
+                status = writeCharRef(writer, high, low);
             } else {
                 /* The output encoding is not known,
                  * so just write it out as-is.
                  */
-                writer.write(ch, i, 2);
+                writer.write(new char[]{high, low}, 0, 2);
             }
         }
         // non-zero only if character reference was written out.
-        return codePoint;
+        return status;
     }
 
     /**
@@ -1106,32 +1101,7 @@
             }
             else if (isCData && (!escapingNotNeeded(c)))
             {
-                //                if (i != 0)
-                if (m_cdataTagOpen)
-                    closeCDATA();
-
-                // This needs to go into a function...
-                if (Encodings.isHighUTF16Surrogate(c))
-                {
-                    writeUTF16Surrogate(c, ch, i, end);
-                    i++ ; // process two input characters
-                }
-                else
-                {
-                    writer.write("&#");
-
-                    String intStr = Integer.toString((int) c);
-
-                    writer.write(intStr);
-                    writer.write(';');
-                }
-
-                //                if ((i != 0) && (i < (end - 1)))
-                //                if (!m_cdataTagOpen && (i < (end - 1)))
-                //                {
-                //                    writer.write(CDATA_DELIMITER_OPEN);
-                //                    m_cdataTagOpen = true;
-                //                }
+                i = handleEscaping(writer, c, ch, i, end);
             }
             else if (
                 isCData
@@ -1155,25 +1125,8 @@
                     }
                     writer.write(c);
                 }
-
-                // This needs to go into a function...
-                else if (Encodings.isHighUTF16Surrogate(c))
-                {
-                    if (m_cdataTagOpen)
-                        closeCDATA();
-                    writeUTF16Surrogate(c, ch, i, end);
-                    i++; // process two input characters
-                }
-                else
-                {
-                    if (m_cdataTagOpen)
-                        closeCDATA();
-                    writer.write("&#");
-
-                    String intStr = Integer.toString((int) c);
-
-                    writer.write(intStr);
-                    writer.write(';');
+                else {
+                    i = handleEscaping(writer, c, ch, i, end);
                 }
             }
         }
@@ -1181,6 +1134,38 @@
     }
 
     /**
+     * Handles escaping, writes either with a surrogate pair or a character
+     * reference.
+     *
+     * @param c the current char
+     * @param ch the character array
+     * @param i the current position
+     * @param end the end index of the array
+     * @return the next index
+     *
+     * @throws IOException
+     * @throws org.xml.sax.SAXException if invalid UTF-16 surrogate detected.
+     */
+    private int handleEscaping(Writer writer, char c, char ch[], int i, int end)
+            throws IOException, SAXException {
+        if (Encodings.isHighUTF16Surrogate(c) || Encodings.isLowUTF16Surrogate(c))
+        {
+            if (writeUTF16Surrogate(c, ch, i, end) >= 0) {
+                // move the index if the low surrogate is consumed
+                // as writeUTF16Surrogate has written the pair
+                if (Encodings.isHighUTF16Surrogate(c)) {
+                    i++ ;
+                }
+            }
+        }
+        else
+        {
+            writeCharRef(writer, c);
+        }
+        return i;
+    }
+
+    /**
      * Ends an un-escaping section.
      *
      * @see #startNonEscaping
@@ -1246,7 +1231,7 @@
                 m_elemContext.m_startTagOpen = false;
             }
 
-            if (shouldIndent())
+            if (!m_cdataTagOpen && shouldIndent())
                 indent();
 
             boolean writeCDataBrackets =
@@ -1644,7 +1629,7 @@
         int i,
         char ch,
         int lastDirty,
-        boolean fromTextNode) throws IOException
+        boolean fromTextNode) throws IOException, SAXException
     {
         int startClean = lastDirty + 1;
         // if we have some clean characters accumulated
@@ -1723,54 +1708,40 @@
         int len,
         boolean fromTextNode,
         boolean escLF)
-        throws IOException
+        throws IOException, SAXException
     {
 
         int pos = accumDefaultEntity(writer, ch, i, chars, len, fromTextNode, escLF);
 
         if (i == pos)
         {
+            if (m_highSurrogate != 0) {
+                if (!(Encodings.isLowUTF16Surrogate(ch))) {
+                    throwIOE(m_highSurrogate, ch);
+                }
+                writeCharRef(writer, m_highSurrogate, ch);
+                m_highSurrogate = 0;
+                return ++pos;
+            }
+
             if (Encodings.isHighUTF16Surrogate(ch))
             {
-
-                // Should be the UTF-16 low surrogate of the hig/low pair.
-                char next;
-                // Unicode code point formed from the high/low pair.
-                int codePoint = 0;
-
                 if (i + 1 >= len)
                 {
-                    throw new IOException(
-                        Utils.messages.createMessage(
-                            MsgKey.ER_INVALID_UTF16_SURROGATE,
-                            new Object[] { Integer.toHexString(ch)}));
-                    //"Invalid UTF-16 surrogate detected: "
-
-                    //+Integer.toHexString(ch)+ " ?");
+                    // save for the next read
+                    m_highSurrogate = ch;
+                    pos++;
                 }
                 else
                 {
-                    next = chars[++i];
-
+                    // the next should be the UTF-16 low surrogate of the hig/low pair.
+                    char next = chars[++i];
                     if (!(Encodings.isLowUTF16Surrogate(next)))
-                        throw new IOException(
-                            Utils.messages.createMessage(
-                                MsgKey
-                                    .ER_INVALID_UTF16_SURROGATE,
-                                new Object[] {
-                                    Integer.toHexString(ch)
-                                        + " "
-                                        + Integer.toHexString(next)}));
-                    //"Invalid UTF-16 surrogate detected: "
-
-                    //+Integer.toHexString(ch)+" "+Integer.toHexString(next));
-                    codePoint = Encodings.toCodePoint(ch,next);
+                        throwIOE(ch, next);
+
+                    writeCharRef(writer, ch, next);
+                    pos += 2; // count the two characters that went into writing out this entity
                 }
-
-                writer.write("&#");
-                writer.write(Integer.toString(codePoint));
-                writer.write(';');
-                pos += 2; // count the two characters that went into writing out this entity
             }
             else
             {
@@ -1782,18 +1753,14 @@
                 if (isCharacterInC0orC1Range(ch) ||
                         (XMLVERSION11.equals(getVersion()) && isNELorLSEPCharacter(ch)))
                 {
-                    writer.write("&#");
-                    writer.write(Integer.toString(ch));
-                    writer.write(';');
+                    writeCharRef(writer, ch);
                 }
                 else if ((!escapingNotNeeded(ch) ||
                     (  (fromTextNode && m_charInfo.isSpecialTextChar(ch))
                      || (!fromTextNode && m_charInfo.isSpecialAttrChar(ch))))
-                && m_elemContext.m_currentElemDepth > 0)
+                     && m_elemContext.m_currentElemDepth > 0)
                 {
-                    writer.write("&#");
-                    writer.write(Integer.toString(ch));
-                    writer.write(';');
+                    writeCharRef(writer, ch);
                 }
                 else
                 {
@@ -1807,6 +1774,45 @@
     }
 
     /**
+     * Writes out a character reference.
+     * @param writer the writer
+     * @param c the character
+     * @throws IOException
+     */
+    private void writeCharRef(Writer writer, char c) throws IOException, SAXException {
+        if (m_cdataTagOpen)
+            closeCDATA();
+        writer.write("&#");
+        writer.write(Integer.toString(c));
+        writer.write(';');
+    }
+
+    /**
+     * Writes out a pair of surrogates as a character reference
+     * @param writer the writer
+     * @param high the high surrogate
+     * @param low the low surrogate
+     * @throws IOException
+     */
+    private int writeCharRef(Writer writer, char high, char low) throws IOException, SAXException {
+        if (m_cdataTagOpen)
+            closeCDATA();
+        // Unicode code point formed from the high/low pair.
+        int codePoint = Encodings.toCodePoint(high, low);
+        writer.write("&#");
+        writer.write(Integer.toString(codePoint));
+        writer.write(';');
+        return codePoint;
+    }
+
+    private void throwIOE(char ch, char next) throws IOException {
+        throw new IOException(Utils.messages.createMessage(
+                MsgKey.ER_INVALID_UTF16_SURROGATE,
+                new Object[] {Integer.toHexString(ch) + " "
+                        + Integer.toHexString(next)}));
+    }
+
+    /**
      * Receive notification of the beginning of an element, although this is a
      * SAX method additional namespace or attribute information can occur before
      * or after this call, that is associated with this element.
@@ -2053,7 +2059,7 @@
         Writer writer,
         String string,
         String encoding)
-        throws IOException
+        throws IOException, SAXException
     {
         final int len = string.length();
         if (len > m_attrBuff.length)
--- a/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToTextStream.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xml/internal/serializer/ToTextStream.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,6 +1,5 @@
 /*
- * reserved comment block
- * DO NOT REMOVE OR ALTER!
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -34,6 +33,7 @@
  * This class converts SAX or SAX-like calls to a
  * serialized document for xsl:output method of "text".
  * @xsl.usage internal
+ * @LastModified: Sept 2018
  */
 public final class ToTextStream extends ToStream
 {
@@ -295,23 +295,32 @@
             } else if (m_encodingInfo.isInEncoding(c)) {
                 writer.write(c);
                 // one input char processed
-            } else if (Encodings.isHighUTF16Surrogate(c)) {
+            } else if (Encodings.isHighUTF16Surrogate(c) ||
+                       Encodings.isLowUTF16Surrogate(c)) {
                 final int codePoint = writeUTF16Surrogate(c, ch, i, end);
-                if (codePoint != 0) {
-                    // I think we can just emit the message,
-                    // not crash and burn.
-                    final String integralValue = Integer.toString(codePoint);
-                    final String msg = Utils.messages.createMessage(
-                        MsgKey.ER_ILLEGAL_CHARACTER,
-                        new Object[] { integralValue, encoding });
+                if (codePoint >= 0) {
+                    // move the index if the low surrogate is consumed
+                    // as writeUTF16Surrogate has written the pair
+                    if (Encodings.isHighUTF16Surrogate(c)) {
+                        i++;
+                    }
 
-                    //Older behavior was to throw the message,
-                    //but newer gentler behavior is to write a message to System.err
-                    //throw new SAXException(msg);
-                    System.err.println(msg);
+                    // printing to the console is not appropriate, but will leave
+                    // it as is for compatibility.
+                    if (codePoint >0) {
+                        // I think we can just emit the message,
+                        // not crash and burn.
+                        final String integralValue = Integer.toString(codePoint);
+                        final String msg = Utils.messages.createMessage(
+                            MsgKey.ER_ILLEGAL_CHARACTER,
+                            new Object[] { integralValue, encoding });
 
+                        //Older behavior was to throw the message,
+                        //but newer gentler behavior is to write a message to System.err
+                        //throw new SAXException(msg);
+                        System.err.println(msg);
+                    }
                 }
-                i++; // two input chars processed
             } else {
                 // Don't know what to do with this char, it is
                 // not in the encoding and not a high char in
--- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 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
@@ -74,7 +74,7 @@
             this.dependentMethods = new ArrayList<>();
             this.classId = classId;
             this.type = type;
-            this.metadataName = type.isUnsafeAnonymous() ? "anon<" + classId + ">" : type.getName();
+            this.metadataName = type.isAnonymous() ? "anon<" + classId + ">" : type.getName();
             this.gotIndex = binaryContainer.addTwoSlotKlassSymbol(metadataName);
             this.compiledMethodsOffset = -1; // Not compiled classes do not have compiled methods.
             this.dependentMethodsOffset = -1;
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java	Tue Sep 18 16:41:24 2018 -0700
@@ -167,7 +167,8 @@
     public boolean isPreview(Feature feature) {
         if (feature == Feature.SWITCH_EXPRESSION ||
             feature == Feature.SWITCH_MULTIPLE_CASE_LABELS ||
-            feature == Feature.SWITCH_RULE)
+            feature == Feature.SWITCH_RULE ||
+            feature == Feature.RAW_STRING_LITERALS)
             return true;
         //Note: this is a backdoor which allows to optionally treat all features as 'preview' (for testing).
         //When real preview features will be added, this method can be implemented to return 'true'
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Tue Sep 18 16:41:24 2018 -0700
@@ -183,7 +183,8 @@
         IMPORT_ON_DEMAND_OBSERVABLE_PACKAGES(JDK1_2, JDK8),
         SWITCH_MULTIPLE_CASE_LABELS(JDK12, Fragments.FeatureMultipleCaseLabels, DiagKind.PLURAL),
         SWITCH_RULE(JDK12, Fragments.FeatureSwitchRules, DiagKind.PLURAL),
-        SWITCH_EXPRESSION(JDK12, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL);
+        SWITCH_EXPRESSION(JDK12, Fragments.FeatureSwitchExpressions, DiagKind.PLURAL),
+        RAW_STRING_LITERALS(JDK12, Fragments.FeatureRawStringLiterals, DiagKind.PLURAL);
 
         enum DiagKind {
             NORMAL,
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Tue Sep 18 16:41:24 2018 -0700
@@ -280,8 +280,9 @@
         if (!res.kind.isResolutionError()) {
             tree.sym = res;
         }
-        if (res.kind.isResolutionTargetError() ||
-                res.type != null && res.type.hasTag(FORALL) ||
+        if (res.kind.isResolutionTargetError()) {
+             tree.setOverloadKind(JCMemberReference.OverloadKind.ERROR);
+        } else if (res.type != null && res.type.hasTag(FORALL) ||
                 (res.flags() & Flags.VARARGS) != 0 ||
                 (TreeInfo.isStaticSelector(exprTree, tree.name.table.names) &&
                 exprTree.type.isRaw() && !exprTree.type.hasTag(ARRAY))) {
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Tue Sep 18 16:41:24 2018 -0700
@@ -169,7 +169,7 @@
                         @Override
                         public void setOverloadKind(OverloadKind overloadKind) {
                             OverloadKind previous = t.getOverloadKind();
-                            if (previous == null) {
+                            if (previous == null || previous == OverloadKind.ERROR) {
                                 t.setOverloadKind(overloadKind);
                             } else {
                                 Assert.check(previous == overloadKind);
@@ -1240,7 +1240,7 @@
             Type descType = types.findDescriptorType(pt);
             List<Type> freeArgVars = inferenceContext.freeVarsIn(descType.getParameterTypes());
             if (freeArgVars.nonEmpty() &&
-                    tree.getOverloadKind() == JCMemberReference.OverloadKind.OVERLOADED) {
+                    tree.getOverloadKind() != JCMemberReference.OverloadKind.UNOVERLOADED) {
                 stuckVars.addAll(freeArgVars);
                 depVars.addAll(inferenceContext.freeVarsIn(descType.getReturnType()));
             }
@@ -1305,7 +1305,7 @@
         @Override
         public void visitReference(JCMemberReference tree) {
             super.visitReference(tree);
-            if (tree.getOverloadKind() == JCMemberReference.OverloadKind.OVERLOADED) {
+            if (tree.getOverloadKind() != JCMemberReference.OverloadKind.UNOVERLOADED) {
                 stuck = true;
             }
         }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Tue Sep 18 16:41:24 2018 -0700
@@ -2057,7 +2057,9 @@
 
     // evaluate and discard the first expression, then evaluate the second.
     JCExpression makeComma(final JCExpression expr1, final JCExpression expr2) {
-        return abstractRval(expr1, discarded -> expr2);
+        JCExpression res = make.LetExpr(List.of(make.Exec(expr1)), expr2);
+        res.type = expr2.type;
+        return res;
     }
 
 /**************************************************************************
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Tue Sep 18 16:41:24 2018 -0700
@@ -183,7 +183,7 @@
 
         //if this is a default method, add the DEFAULT flag to the enclosing interface
         if ((tree.mods.flags & DEFAULT) != 0) {
-            m.enclClass().flags_field |= DEFAULT;
+            m.owner.flags_field |= DEFAULT;
         }
 
         Env<AttrContext> localEnv = methodEnv(tree, env);
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Tue Sep 18 16:41:24 2018 -0700
@@ -2466,6 +2466,9 @@
     }
 
     private List<Type> adjustMethodParams(long flags, List<Type> args) {
+        if (args.isEmpty()) {
+            return args;
+        }
         boolean isVarargs = (flags & VARARGS) != 0;
         if (isVarargs) {
             Type varargsElem = args.last();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Tue Sep 18 16:41:24 2018 -0700
@@ -646,6 +646,59 @@
                         lexError(pos, Errors.UnclosedStrLit);
                     }
                     break loop;
+                case '`':
+                    checkSourceLevel(pos, Feature.RAW_STRING_LITERALS);
+                    // Ensure that the backtick was not a Unicode escape sequence
+                    if (reader.peekBack() != '`') {
+                        reader.scanChar();
+                        lexError(pos, Errors.UnicodeBacktick);
+                        break loop;
+                    }
+                    // Turn off unicode processsing and save previous state
+                    boolean oldState = reader.setUnicodeConversion(false);
+                    // Count the number of backticks in the open quote sequence
+                    int openCount = reader.skipRepeats();
+                    // Skip last backtick
+                    reader.scanChar();
+                    while (reader.bp < reader.buflen) {
+                        // If potential close quote sequence
+                        if (reader.ch == '`') {
+                            // Count number of backticks in sequence
+                            int closeCount = reader.skipRepeats();
+                            // If the counts match we can exit the raw string literal
+                            if (openCount == closeCount) {
+                                break;
+                            }
+                            // Emit non-close backtick sequence
+                            for (int i = 0; i <= closeCount; i++) {
+                                reader.putChar('`', false);
+                            }
+                            // Skip last backtick
+                            reader.scanChar();
+                        } else if (reader.ch == LF) {
+                            reader.putChar(true);
+                            processLineTerminator(pos, reader.bp);
+                        } else if (reader.ch == CR) {
+                            if (reader.peekChar() == LF) {
+                                reader.scanChar();
+                            }
+                            // Translate CR and CRLF sequences to LF
+                            reader.putChar('\n', true);
+                            processLineTerminator(pos, reader.bp);
+                        } else {
+                            reader.putChar(true);
+                        }
+                    }
+                    // Restore unicode processsing
+                    reader.setUnicodeConversion(oldState);
+                    // Ensure the close quote was encountered
+                    if (reader.bp == reader.buflen) {
+                        lexError(pos, Errors.UnclosedStrLit);
+                    } else {
+                        tk = TokenKind.STRINGLITERAL;
+                        reader.scanChar();
+                    }
+                    break loop;
                 default:
                     if (isSpecial(reader.ch)) {
                         scanOperator();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Tue Sep 18 16:41:24 2018 -0700
@@ -64,6 +64,10 @@
      */
     protected int unicodeConversionBp = -1;
 
+    /** Control conversion of unicode characters
+     */
+    protected boolean unicodeConversion = true;
+
     protected Log log;
     protected Names names;
 
@@ -154,11 +158,17 @@
         return new String(sbuf, 0, sp);
     }
 
+    protected boolean setUnicodeConversion(boolean newState) {
+        boolean oldState = unicodeConversion;
+        unicodeConversion = newState;
+        return oldState;
+    }
+
     /** Convert unicode escape; bp points to initial '\' character
      *  (Spec 3.3).
      */
     protected void convertUnicode() {
-        if (ch == '\\' && unicodeConversionBp != bp) {
+        if (ch == '\\' && unicodeConversion && unicodeConversionBp != bp ) {
             bp++; ch = buf[bp];
             if (ch == 'u') {
                 do {
@@ -254,6 +264,24 @@
         return buf[bp + 1];
     }
 
+    protected char peekBack() {
+        return buf[bp];
+    }
+
+    /**
+     * Skips consecutive occurrences of the current character, leaving bp positioned
+     * at the last occurrence. Returns the occurrence count.
+     */
+    protected int skipRepeats() {
+        int start = bp;
+        while (bp < buflen) {
+            if (buf[bp] != buf[bp + 1])
+                break;
+            bp++;
+        }
+        return bp - start;
+    }
+
     /**
      * Returns a copy of the input buffer, up to its inputLength.
      * Unicode escape sequences are not translated.
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1536,13 +1536,12 @@
             JCCompilationUnit topLevel;
             public void visitTopLevel(JCCompilationUnit node) {
                 if (node.packge != null) {
-                    if (node.packge.package_info != null) {
+                    if (isPkgInfo(node.sourcefile, Kind.SOURCE)) {
                         node.packge.package_info.reset();
                     }
                     node.packge.reset();
                 }
-                boolean isModuleInfo = node.sourcefile.isNameCompatible("module-info", Kind.SOURCE);
-                if (isModuleInfo) {
+                if (isModuleInfo(node.sourcefile, Kind.SOURCE)) {
                     node.modle.reset();
                     node.modle.completer = sym -> modules.enter(List.of(node), node.modle.module_info);
                     node.modle.module_info.reset();
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Tue Sep 18 16:41:24 2018 -0700
@@ -1232,6 +1232,9 @@
 compiler.err.unclosed.str.lit=\
     unclosed string literal
 
+compiler.err.unicode.backtick=\
+    attempt to use \\u0060 as a raw string literal delimiter
+
 # 0: string
 compiler.err.unsupported.encoding=\
     unsupported encoding: {0}
@@ -2826,6 +2829,9 @@
 compiler.misc.feature.switch.expressions=\
     switch expressions
 
+compiler.misc.feature.raw.string.literals=\
+    raw string literals
+
 compiler.warn.underscore.as.identifier=\
     as of release 9, ''_'' is a keyword, and may not be used as an identifier
 
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Tue Sep 18 16:41:24 2018 -0700
@@ -2217,7 +2217,8 @@
 
         public enum OverloadKind {
             OVERLOADED,
-            UNOVERLOADED
+            UNOVERLOADED,
+            ERROR
         }
 
         /**
--- a/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.hotspot.agent/linux/native/libsaproc/ps_core.c	Tue Sep 18 16:41:24 2018 -0700
@@ -795,7 +795,11 @@
       if (exec_php->p_filesz > BUF_SIZE) {
         goto err;
       }
-      pread(ph->core->exec_fd, interp_name, exec_php->p_filesz, exec_php->p_offset);
+      if (pread(ph->core->exec_fd, interp_name,
+                exec_php->p_filesz, exec_php->p_offset) != exec_php->p_filesz) {
+        print_debug("Unable to read in the ELF interpreter\n");
+        goto err;
+      }
       interp_name[exec_php->p_filesz] = '\0';
       print_debug("ELF interpreter %s\n", interp_name);
       // read interpreter segments as well
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Tue Sep 18 16:41:24 2018 -0700
@@ -37,6 +37,7 @@
 import sun.jvm.hotspot.gc.epsilon.*;
 import sun.jvm.hotspot.gc.g1.*;
 import sun.jvm.hotspot.gc.parallel.*;
+import sun.jvm.hotspot.gc.z.*;
 import sun.jvm.hotspot.memory.*;
 import sun.jvm.hotspot.runtime.*;
 import sun.jvm.hotspot.types.*;
@@ -366,6 +367,10 @@
     } else if (heap instanceof G1CollectedHeap) {
         G1CollectedHeap g1h = (G1CollectedHeap) heap;
         g1h.heapRegionIterate(lrc);
+    } else if (heap instanceof ZCollectedHeap) {
+       // Operation (currently) not supported with ZGC. Print
+       // a warning and leave the list of live regions empty.
+       System.err.println("Warning: Operation not supported with ZGC");
     } else if (heap instanceof EpsilonHeap) {
        EpsilonHeap eh = (EpsilonHeap) heap;
        liveRegions.add(eh.space().top());
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java	Tue Sep 18 16:41:24 2018 -0700
@@ -50,6 +50,7 @@
     this.usedSize = usedSize;
     visitedSize = 0;
     userHeapVisitor.prologue(usedSize);
+    thunk.heapIterationFractionUpdate(0.0);
   }
 
   public boolean doObj(Oop obj) {
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java	Tue Sep 18 16:41:24 2018 -0700
@@ -110,6 +110,21 @@
     @Override
     ResolvedJavaMethod getClassInitializer();
 
+    /**
+     * Checks whether this type is an unsafe anonymous class.
+     *
+     * @return {@code true} if this type is an unsafe anonymous class
+     */
     boolean isUnsafeAnonymous();
 
+    /**
+     * Checks whether this type is an unsafe anonymous class.
+     * This method is here to maintain compatibility with JDK11.
+     *
+     * @return {@code true} if this type is an unsafe anonymous class
+     */
+    default boolean isAnonymous() {
+      return isUnsafeAnonymous();
+    }
+
 }
--- a/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,6 +24,7 @@
 
 package org.graalvm.compiler.hotspot.management;
 
+import org.graalvm.compiler.phases.common.jmx.HotSpotMBeanOperationProvider;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Comparator;
@@ -49,6 +50,7 @@
 import org.graalvm.compiler.options.OptionDescriptor;
 import org.graalvm.compiler.options.OptionDescriptors;
 import org.graalvm.compiler.options.OptionsParser;
+import org.graalvm.compiler.serviceprovider.GraalServices;
 
 /**
  * MBean used to access properties and operations of a {@link HotSpotGraalRuntime} instance.
@@ -170,11 +172,32 @@
             if (DEBUG) {
                 System.out.printf("invoke: %s%s%n", actionName, Arrays.asList(params));
             }
-            Object retvalue = runtime.invokeManagementAction(actionName, params);
+            Object retvalue = null;
+            if ("dumpMethod".equals(actionName)) {
+                retvalue = runtime.invokeManagementAction(actionName, params);
+            } else {
+                boolean found = false;
+                for (HotSpotMBeanOperationProvider p : GraalServices.load(HotSpotMBeanOperationProvider.class)) {
+                    List<MBeanOperationInfo> info = new ArrayList<>();
+                    p.registerOperations(MBeanOperationInfo.class, info);
+                    for (MBeanOperationInfo op : info) {
+                        if (actionName.equals(op.getName())) {
+                            retvalue = p.invoke(actionName, params, signature);
+                            found = true;
+                            break;
+                        }
+                    }
+                }
+                if (!found) {
+                    throw new MBeanException(new IllegalStateException("Cannot find operation " + actionName));
+                }
+            }
             if (DEBUG) {
                 System.out.printf("invoke: %s%s = %s%n", actionName, Arrays.asList(params), retvalue);
             }
             return retvalue;
+        } catch (MBeanException ex) {
+            throw ex;
         } catch (Exception ex) {
             throw new ReflectionException(ex);
         }
@@ -198,30 +221,35 @@
                 return o1.getName().compareTo(o2.getName());
             }
         });
-        MBeanOperationInfo[] ops = {
-                        new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{
-                                        new MBeanParameterInfo("className", "java.lang.String", "Class to observe"),
-                                        new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"),
-                        }, "void", MBeanOperationInfo.ACTION),
-                        new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{
-                                        new MBeanParameterInfo("className", "java.lang.String", "Class to observe"),
-                                        new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"),
-                                        new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"),
-                        }, "void", MBeanOperationInfo.ACTION),
-                        new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{
-                                        new MBeanParameterInfo("className", "java.lang.String", "Class to observe"),
-                                        new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"),
-                                        new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"),
-                                        new MBeanParameterInfo("host", "java.lang.String", "The host where the IGV tool is running at"),
-                                        new MBeanParameterInfo("port", "int", "The port where the IGV tool is listening at"),
-                        }, "void", MBeanOperationInfo.ACTION)
-        };
+        List<MBeanOperationInfo> opts = new ArrayList<>();
+        opts.add(new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{
+                        new MBeanParameterInfo("className", "java.lang.String", "Class to observe"),
+                        new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"),
+        }, "void", MBeanOperationInfo.ACTION));
+        opts.add(new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{
+                        new MBeanParameterInfo("className", "java.lang.String", "Class to observe"),
+                        new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"),
+                        new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"),
+        }, "void", MBeanOperationInfo.ACTION));
+        opts.add(new MBeanOperationInfo("dumpMethod", "Enable IGV dumps for provided method", new MBeanParameterInfo[]{
+                        new MBeanParameterInfo("className", "java.lang.String", "Class to observe"),
+                        new MBeanParameterInfo("methodName", "java.lang.String", "Method to observe"),
+                        new MBeanParameterInfo("filter", "java.lang.String", "The parameter for Dump option"),
+                        new MBeanParameterInfo("host", "java.lang.String", "The host where the IGV tool is running at"),
+                        new MBeanParameterInfo("port", "int", "The port where the IGV tool is listening at"),
+        }, "void", MBeanOperationInfo.ACTION));
+
+        for (HotSpotMBeanOperationProvider p : GraalServices.load(HotSpotMBeanOperationProvider.class)) {
+            p.registerOperations(MBeanOperationInfo.class, opts);
+        }
 
         return new MBeanInfo(
                         HotSpotGraalRuntimeMBean.class.getName(),
                         "Graal",
                         attrs.toArray(new MBeanAttributeInfo[attrs.size()]),
-                        null, ops, null);
+                        null,
+                        opts.toArray(new MBeanOperationInfo[opts.size()]),
+                        null);
     }
 
     private static EconomicMap<String, OptionDescriptor> getOptionDescriptors() {
--- a/src/jdk.internal.vm.compiler/share/classes/module-info.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/module-info.java	Tue Sep 18 16:41:24 2018 -0700
@@ -74,6 +74,7 @@
         jdk.aot,
         jdk.internal.vm.compiler.management;
     exports org.graalvm.compiler.phases                 to jdk.aot;
+    exports org.graalvm.compiler.phases.common.jmx      to jdk.internal.vm.compiler.management;
     exports org.graalvm.compiler.phases.tiers           to jdk.aot;
     exports org.graalvm.compiler.printer                to jdk.aot;
     exports org.graalvm.compiler.runtime                to jdk.aot;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -52,6 +52,8 @@
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.OperandSize.SS;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.OperandSize.WORD;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L128;
+import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L256;
+import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LZ;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F38;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F3A;
@@ -78,7 +80,6 @@
 
 import jdk.vm.ci.amd64.AMD64;
 import jdk.vm.ci.amd64.AMD64.CPUFeature;
-import jdk.vm.ci.amd64.AMD64Kind;
 import jdk.vm.ci.code.Register;
 import jdk.vm.ci.code.Register.RegisterCategory;
 import jdk.vm.ci.code.TargetDescription;
@@ -893,7 +894,7 @@
         }
     }
 
-    private enum AVXOpAssertion {
+    private enum VEXOpAssertion {
         AVX1(CPUFeature.AVX, CPUFeature.AVX),
         AVX1_2(CPUFeature.AVX, CPUFeature.AVX2),
         AVX2(CPUFeature.AVX2, CPUFeature.AVX2),
@@ -903,23 +904,25 @@
         XMM_CPU(CPUFeature.AVX, null, XMM, null, CPU, null),
         XMM_XMM_CPU(CPUFeature.AVX, null, XMM, XMM, CPU, null),
         CPU_XMM(CPUFeature.AVX, null, CPU, null, XMM, null),
-        AVX1_2_CPU_XMM(CPUFeature.AVX, CPUFeature.AVX2, CPU, null, XMM, null);
-
-        private final CPUFeature avx128feature;
-        private final CPUFeature avx256feature;
+        AVX1_2_CPU_XMM(CPUFeature.AVX, CPUFeature.AVX2, CPU, null, XMM, null),
+        BMI1(CPUFeature.BMI1, null, CPU, CPU, CPU, null),
+        BMI2(CPUFeature.BMI2, null, CPU, CPU, CPU, null);
+
+        private final CPUFeature l128feature;
+        private final CPUFeature l256feature;
 
         private final RegisterCategory rCategory;
         private final RegisterCategory vCategory;
         private final RegisterCategory mCategory;
         private final RegisterCategory imm8Category;
 
-        AVXOpAssertion(CPUFeature avx128feature, CPUFeature avx256feature) {
-            this(avx128feature, avx256feature, XMM, XMM, XMM, XMM);
+        VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature) {
+            this(l128feature, l256feature, XMM, XMM, XMM, XMM);
         }
 
-        AVXOpAssertion(CPUFeature avx128feature, CPUFeature avx256feature, RegisterCategory rCategory, RegisterCategory vCategory, RegisterCategory mCategory, RegisterCategory imm8Category) {
-            this.avx128feature = avx128feature;
-            this.avx256feature = avx256feature;
+        VEXOpAssertion(CPUFeature l128feature, CPUFeature l256feature, RegisterCategory rCategory, RegisterCategory vCategory, RegisterCategory mCategory, RegisterCategory imm8Category) {
+            this.l128feature = l128feature;
+            this.l256feature = l256feature;
             this.rCategory = rCategory;
             this.vCategory = vCategory;
             this.mCategory = mCategory;
@@ -927,16 +930,20 @@
         }
 
         public boolean check(AMD64 arch, AVXSize size, Register r, Register v, Register m) {
-            return check(arch, size, r, v, m, null);
+            return check(arch, getLFlag(size), r, v, m, null);
         }
 
         public boolean check(AMD64 arch, AVXSize size, Register r, Register v, Register m, Register imm8) {
-            switch (size) {
-                case XMM:
-                    assert avx128feature != null && arch.getFeatures().contains(avx128feature) : "emitting illegal 128 bit instruction";
+            return check(arch, getLFlag(size), r, v, m, imm8);
+        }
+
+        public boolean check(AMD64 arch, int l, Register r, Register v, Register m, Register imm8) {
+            switch (l) {
+                case L128:
+                    assert l128feature != null && arch.getFeatures().contains(l128feature) : "emitting illegal 128 bit instruction";
                     break;
-                case YMM:
-                    assert avx256feature != null && arch.getFeatures().contains(avx256feature) : "emitting illegal 256 bit instruction";
+                case L256:
+                    assert l256feature != null && arch.getFeatures().contains(l256feature) : "emitting illegal 256 bit instruction";
                     break;
             }
             if (r != null) {
@@ -957,9 +964,9 @@
         public boolean supports(EnumSet<CPUFeature> features, AVXSize avxSize) {
             switch (avxSize) {
                 case XMM:
-                    return avx128feature != null && features.contains(avx128feature);
+                    return l128feature != null && features.contains(l128feature);
                 case YMM:
-                    return avx256feature != null && features.contains(avx256feature);
+                    return l256feature != null && features.contains(l256feature);
                 default:
                     throw GraalError.shouldNotReachHere();
             }
@@ -976,9 +983,9 @@
         protected final int op;
 
         private final String opcode;
-        protected final AVXOpAssertion assertion;
-
-        protected VexOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        protected final VEXOpAssertion assertion;
+
+        protected VexOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             this.pp = pp;
             this.mmmmm = mmmmm;
             this.w = w;
@@ -987,10 +994,6 @@
             this.assertion = assertion;
         }
 
-        public boolean isSupported(AMD64Assembler vasm, AMD64Kind kind) {
-            return assertion.supports(((AMD64) vasm.target.arch).getFeatures(), AVXKind.getRegisterSize(kind));
-        }
-
         public final boolean isSupported(AMD64Assembler vasm, AVXSize size) {
             return assertion.supports(((AMD64) vasm.target.arch).getFeatures(), size);
         }
@@ -1006,14 +1009,14 @@
      */
     public static class VexRROp extends VexOp {
         // @formatter:off
-        public static final VexRROp VMASKMOVDQU = new VexRROp("VMASKMOVDQU", P_66, M_0F, WIG, 0xF7, AVXOpAssertion.AVX1_128ONLY);
+        public static final VexRROp VMASKMOVDQU = new VexRROp("VMASKMOVDQU", P_66, M_0F, WIG, 0xF7, VEXOpAssertion.AVX1_128ONLY);
         // @formatter:on
 
         protected VexRROp(String opcode, int pp, int mmmmm, int w, int op) {
-            this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1);
         }
 
-        protected VexRROp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        protected VexRROp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
         }
 
@@ -1031,10 +1034,10 @@
      */
     public static class VexRMOp extends VexRROp {
         // @formatter:off
-        public static final VexRMOp VCVTTSS2SI      = new VexRMOp("VCVTTSS2SI",      P_F3, M_0F,   W0,  0x2C, AVXOpAssertion.CPU_XMM);
-        public static final VexRMOp VCVTTSS2SQ      = new VexRMOp("VCVTTSS2SQ",      P_F3, M_0F,   W1,  0x2C, AVXOpAssertion.CPU_XMM);
-        public static final VexRMOp VCVTTSD2SI      = new VexRMOp("VCVTTSD2SI",      P_F2, M_0F,   W0,  0x2C, AVXOpAssertion.CPU_XMM);
-        public static final VexRMOp VCVTTSD2SQ      = new VexRMOp("VCVTTSD2SQ",      P_F2, M_0F,   W1,  0x2C, AVXOpAssertion.CPU_XMM);
+        public static final VexRMOp VCVTTSS2SI      = new VexRMOp("VCVTTSS2SI",      P_F3, M_0F,   W0,  0x2C, VEXOpAssertion.CPU_XMM);
+        public static final VexRMOp VCVTTSS2SQ      = new VexRMOp("VCVTTSS2SQ",      P_F3, M_0F,   W1,  0x2C, VEXOpAssertion.CPU_XMM);
+        public static final VexRMOp VCVTTSD2SI      = new VexRMOp("VCVTTSD2SI",      P_F2, M_0F,   W0,  0x2C, VEXOpAssertion.CPU_XMM);
+        public static final VexRMOp VCVTTSD2SQ      = new VexRMOp("VCVTTSD2SQ",      P_F2, M_0F,   W1,  0x2C, VEXOpAssertion.CPU_XMM);
         public static final VexRMOp VCVTPS2PD       = new VexRMOp("VCVTPS2PD",       P_,   M_0F,   WIG, 0x5A);
         public static final VexRMOp VCVTPD2PS       = new VexRMOp("VCVTPD2PS",       P_66, M_0F,   WIG, 0x5A);
         public static final VexRMOp VCVTDQ2PS       = new VexRMOp("VCVTDQ2PS",       P_,   M_0F,   WIG, 0x5B);
@@ -1042,14 +1045,14 @@
         public static final VexRMOp VCVTTPD2DQ      = new VexRMOp("VCVTTPD2DQ",      P_66, M_0F,   WIG, 0xE6);
         public static final VexRMOp VCVTDQ2PD       = new VexRMOp("VCVTDQ2PD",       P_F3, M_0F,   WIG, 0xE6);
         public static final VexRMOp VBROADCASTSS    = new VexRMOp("VBROADCASTSS",    P_66, M_0F38, W0,  0x18);
-        public static final VexRMOp VBROADCASTSD    = new VexRMOp("VBROADCASTSD",    P_66, M_0F38, W0,  0x19, AVXOpAssertion.AVX1_256ONLY);
-        public static final VexRMOp VBROADCASTF128  = new VexRMOp("VBROADCASTF128",  P_66, M_0F38, W0,  0x1A, AVXOpAssertion.AVX1_256ONLY);
-        public static final VexRMOp VPBROADCASTI128 = new VexRMOp("VPBROADCASTI128", P_66, M_0F38, W0,  0x5A, AVXOpAssertion.AVX2_256ONLY);
-        public static final VexRMOp VPBROADCASTB    = new VexRMOp("VPBROADCASTB",    P_66, M_0F38, W0,  0x78, AVXOpAssertion.AVX2);
-        public static final VexRMOp VPBROADCASTW    = new VexRMOp("VPBROADCASTW",    P_66, M_0F38, W0,  0x79, AVXOpAssertion.AVX2);
-        public static final VexRMOp VPBROADCASTD    = new VexRMOp("VPBROADCASTD",    P_66, M_0F38, W0,  0x58, AVXOpAssertion.AVX2);
-        public static final VexRMOp VPBROADCASTQ    = new VexRMOp("VPBROADCASTQ",    P_66, M_0F38, W0,  0x59, AVXOpAssertion.AVX2);
-        public static final VexRMOp VPMOVMSKB       = new VexRMOp("VPMOVMSKB",       P_66, M_0F,   WIG, 0xD7, AVXOpAssertion.AVX1_2_CPU_XMM);
+        public static final VexRMOp VBROADCASTSD    = new VexRMOp("VBROADCASTSD",    P_66, M_0F38, W0,  0x19, VEXOpAssertion.AVX1_256ONLY);
+        public static final VexRMOp VBROADCASTF128  = new VexRMOp("VBROADCASTF128",  P_66, M_0F38, W0,  0x1A, VEXOpAssertion.AVX1_256ONLY);
+        public static final VexRMOp VPBROADCASTI128 = new VexRMOp("VPBROADCASTI128", P_66, M_0F38, W0,  0x5A, VEXOpAssertion.AVX2_256ONLY);
+        public static final VexRMOp VPBROADCASTB    = new VexRMOp("VPBROADCASTB",    P_66, M_0F38, W0,  0x78, VEXOpAssertion.AVX2);
+        public static final VexRMOp VPBROADCASTW    = new VexRMOp("VPBROADCASTW",    P_66, M_0F38, W0,  0x79, VEXOpAssertion.AVX2);
+        public static final VexRMOp VPBROADCASTD    = new VexRMOp("VPBROADCASTD",    P_66, M_0F38, W0,  0x58, VEXOpAssertion.AVX2);
+        public static final VexRMOp VPBROADCASTQ    = new VexRMOp("VPBROADCASTQ",    P_66, M_0F38, W0,  0x59, VEXOpAssertion.AVX2);
+        public static final VexRMOp VPMOVMSKB       = new VexRMOp("VPMOVMSKB",       P_66, M_0F,   WIG, 0xD7, VEXOpAssertion.AVX1_2_CPU_XMM);
         public static final VexRMOp VPMOVSXBW       = new VexRMOp("VPMOVSXBW",       P_66, M_0F38, WIG, 0x20);
         public static final VexRMOp VPMOVSXBD       = new VexRMOp("VPMOVSXBD",       P_66, M_0F38, WIG, 0x21);
         public static final VexRMOp VPMOVSXBQ       = new VexRMOp("VPMOVSXBQ",       P_66, M_0F38, WIG, 0x22);
@@ -1072,10 +1075,10 @@
         // @formatter:on
 
         protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op) {
-            this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1);
         }
 
-        protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        protected VexRMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
         }
 
@@ -1103,17 +1106,17 @@
         public static final VexMoveOp VMOVUPD = new VexMoveOp("VMOVUPD", P_66, M_0F, WIG, 0x10, 0x11);
         public static final VexMoveOp VMOVSS  = new VexMoveOp("VMOVSS",  P_F3, M_0F, WIG, 0x10, 0x11);
         public static final VexMoveOp VMOVSD  = new VexMoveOp("VMOVSD",  P_F2, M_0F, WIG, 0x10, 0x11);
-        public static final VexMoveOp VMOVD   = new VexMoveOp("VMOVD",   P_66, M_0F, W0,  0x6E, 0x7E, AVXOpAssertion.XMM_CPU);
-        public static final VexMoveOp VMOVQ   = new VexMoveOp("VMOVQ",   P_66, M_0F, W1,  0x6E, 0x7E, AVXOpAssertion.XMM_CPU);
+        public static final VexMoveOp VMOVD   = new VexMoveOp("VMOVD",   P_66, M_0F, W0,  0x6E, 0x7E, VEXOpAssertion.XMM_CPU);
+        public static final VexMoveOp VMOVQ   = new VexMoveOp("VMOVQ",   P_66, M_0F, W1,  0x6E, 0x7E, VEXOpAssertion.XMM_CPU);
         // @formatter:on
 
         private final int opReverse;
 
         private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse) {
-            this(opcode, pp, mmmmm, w, op, opReverse, AVXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, opReverse, VEXOpAssertion.AVX1);
         }
 
-        private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, AVXOpAssertion assertion) {
+        private VexMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
             this.opReverse = opReverse;
         }
@@ -1142,13 +1145,13 @@
      */
     public static final class VexRMIOp extends VexOp implements VexRRIOp {
         // @formatter:off
-        public static final VexRMIOp VPERMQ   = new VexRMIOp("VPERMQ",   P_66, M_0F3A, W1,  0x00, AVXOpAssertion.AVX2_256ONLY);
-        public static final VexRMIOp VPSHUFLW = new VexRMIOp("VPSHUFLW", P_F2, M_0F,   WIG, 0x70, AVXOpAssertion.AVX1_2);
-        public static final VexRMIOp VPSHUFHW = new VexRMIOp("VPSHUFHW", P_F3, M_0F,   WIG, 0x70, AVXOpAssertion.AVX1_2);
-        public static final VexRMIOp VPSHUFD  = new VexRMIOp("VPSHUFD",  P_66, M_0F,   WIG, 0x70, AVXOpAssertion.AVX1_2);
+        public static final VexRMIOp VPERMQ   = new VexRMIOp("VPERMQ",   P_66, M_0F3A, W1,  0x00, VEXOpAssertion.AVX2_256ONLY);
+        public static final VexRMIOp VPSHUFLW = new VexRMIOp("VPSHUFLW", P_F2, M_0F,   WIG, 0x70, VEXOpAssertion.AVX1_2);
+        public static final VexRMIOp VPSHUFHW = new VexRMIOp("VPSHUFHW", P_F3, M_0F,   WIG, 0x70, VEXOpAssertion.AVX1_2);
+        public static final VexRMIOp VPSHUFD  = new VexRMIOp("VPSHUFD",  P_66, M_0F,   WIG, 0x70, VEXOpAssertion.AVX1_2);
         // @formatter:on
 
-        private VexRMIOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        private VexRMIOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
         }
 
@@ -1175,15 +1178,15 @@
      */
     public static final class VexMRIOp extends VexOp implements VexRRIOp {
         // @formatter:off
-        public static final VexMRIOp VEXTRACTF128 = new VexMRIOp("VEXTRACTF128", P_66, M_0F3A, W0, 0x19, AVXOpAssertion.AVX1_256ONLY);
-        public static final VexMRIOp VEXTRACTI128 = new VexMRIOp("VEXTRACTI128", P_66, M_0F3A, W0, 0x39, AVXOpAssertion.AVX2_256ONLY);
-        public static final VexMRIOp VPEXTRB      = new VexMRIOp("VPEXTRB",      P_66, M_0F3A, W0, 0x14, AVXOpAssertion.XMM_CPU);
-        public static final VexMRIOp VPEXTRW      = new VexMRIOp("VPEXTRW",      P_66, M_0F3A, W0, 0x15, AVXOpAssertion.XMM_CPU);
-        public static final VexMRIOp VPEXTRD      = new VexMRIOp("VPEXTRD",      P_66, M_0F3A, W0, 0x16, AVXOpAssertion.XMM_CPU);
-        public static final VexMRIOp VPEXTRQ      = new VexMRIOp("VPEXTRQ",      P_66, M_0F3A, W1, 0x16, AVXOpAssertion.XMM_CPU);
+        public static final VexMRIOp VEXTRACTF128 = new VexMRIOp("VEXTRACTF128", P_66, M_0F3A, W0, 0x19, VEXOpAssertion.AVX1_256ONLY);
+        public static final VexMRIOp VEXTRACTI128 = new VexMRIOp("VEXTRACTI128", P_66, M_0F3A, W0, 0x39, VEXOpAssertion.AVX2_256ONLY);
+        public static final VexMRIOp VPEXTRB      = new VexMRIOp("VPEXTRB",      P_66, M_0F3A, W0, 0x14, VEXOpAssertion.XMM_CPU);
+        public static final VexMRIOp VPEXTRW      = new VexMRIOp("VPEXTRW",      P_66, M_0F3A, W0, 0x15, VEXOpAssertion.XMM_CPU);
+        public static final VexMRIOp VPEXTRD      = new VexMRIOp("VPEXTRD",      P_66, M_0F3A, W0, 0x16, VEXOpAssertion.XMM_CPU);
+        public static final VexMRIOp VPEXTRQ      = new VexMRIOp("VPEXTRQ",      P_66, M_0F3A, W1, 0x16, VEXOpAssertion.XMM_CPU);
         // @formatter:on
 
-        private VexMRIOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        private VexMRIOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
         }
 
@@ -1210,12 +1213,12 @@
      */
     public static class VexRVMROp extends VexOp {
         // @formatter:off
-        public static final VexRVMROp VPBLENDVB  = new VexRVMROp("VPBLENDVB",  P_66, M_0F3A, W0, 0x4C, AVXOpAssertion.AVX1_2);
-        public static final VexRVMROp VPBLENDVPS = new VexRVMROp("VPBLENDVPS", P_66, M_0F3A, W0, 0x4A, AVXOpAssertion.AVX1);
-        public static final VexRVMROp VPBLENDVPD = new VexRVMROp("VPBLENDVPD", P_66, M_0F3A, W0, 0x4B, AVXOpAssertion.AVX1);
+        public static final VexRVMROp VPBLENDVB  = new VexRVMROp("VPBLENDVB",  P_66, M_0F3A, W0, 0x4C, VEXOpAssertion.AVX1_2);
+        public static final VexRVMROp VPBLENDVPS = new VexRVMROp("VPBLENDVPS", P_66, M_0F3A, W0, 0x4A, VEXOpAssertion.AVX1);
+        public static final VexRVMROp VPBLENDVPD = new VexRVMROp("VPBLENDVPD", P_66, M_0F3A, W0, 0x4B, VEXOpAssertion.AVX1);
         // @formatter:on
 
-        protected VexRVMROp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        protected VexRVMROp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
         }
 
@@ -1275,43 +1278,43 @@
         public static final VexRVMOp VMAXSD    = new VexRVMOp("VMAXSD",    P_F2, M_0F,   WIG, 0x5F);
         public static final VexRVMOp VADDSUBPS = new VexRVMOp("VADDSUBPS", P_F2, M_0F,   WIG, 0xD0);
         public static final VexRVMOp VADDSUBPD = new VexRVMOp("VADDSUBPD", P_66, M_0F,   WIG, 0xD0);
-        public static final VexRVMOp VPAND     = new VexRVMOp("VPAND",     P_66, M_0F,   WIG, 0xDB, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPOR      = new VexRVMOp("VPOR",      P_66, M_0F,   WIG, 0xEB, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPXOR     = new VexRVMOp("VPXOR",     P_66, M_0F,   WIG, 0xEF, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPADDB    = new VexRVMOp("VPADDB",    P_66, M_0F,   WIG, 0xFC, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPADDW    = new VexRVMOp("VPADDW",    P_66, M_0F,   WIG, 0xFD, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPADDD    = new VexRVMOp("VPADDD",    P_66, M_0F,   WIG, 0xFE, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPADDQ    = new VexRVMOp("VPADDQ",    P_66, M_0F,   WIG, 0xD4, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPMULHUW  = new VexRVMOp("VPMULHUW",  P_66, M_0F,   WIG, 0xE4, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPMULHW   = new VexRVMOp("VPMULHW",   P_66, M_0F,   WIG, 0xE5, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPMULLW   = new VexRVMOp("VPMULLW",   P_66, M_0F,   WIG, 0xD5, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPMULLD   = new VexRVMOp("VPMULLD",   P_66, M_0F38, WIG, 0x40, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPSUBB    = new VexRVMOp("VPSUBB",    P_66, M_0F,   WIG, 0xF8, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPSUBW    = new VexRVMOp("VPSUBW",    P_66, M_0F,   WIG, 0xF9, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPSUBD    = new VexRVMOp("VPSUBD",    P_66, M_0F,   WIG, 0xFA, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPSUBQ    = new VexRVMOp("VPSUBQ",    P_66, M_0F,   WIG, 0xFB, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPSHUFB   = new VexRVMOp("VPSHUFB",   P_66, M_0F38, WIG, 0x00, AVXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPAND     = new VexRVMOp("VPAND",     P_66, M_0F,   WIG, 0xDB, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPOR      = new VexRVMOp("VPOR",      P_66, M_0F,   WIG, 0xEB, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPXOR     = new VexRVMOp("VPXOR",     P_66, M_0F,   WIG, 0xEF, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPADDB    = new VexRVMOp("VPADDB",    P_66, M_0F,   WIG, 0xFC, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPADDW    = new VexRVMOp("VPADDW",    P_66, M_0F,   WIG, 0xFD, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPADDD    = new VexRVMOp("VPADDD",    P_66, M_0F,   WIG, 0xFE, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPADDQ    = new VexRVMOp("VPADDQ",    P_66, M_0F,   WIG, 0xD4, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPMULHUW  = new VexRVMOp("VPMULHUW",  P_66, M_0F,   WIG, 0xE4, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPMULHW   = new VexRVMOp("VPMULHW",   P_66, M_0F,   WIG, 0xE5, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPMULLW   = new VexRVMOp("VPMULLW",   P_66, M_0F,   WIG, 0xD5, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPMULLD   = new VexRVMOp("VPMULLD",   P_66, M_0F38, WIG, 0x40, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPSUBB    = new VexRVMOp("VPSUBB",    P_66, M_0F,   WIG, 0xF8, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPSUBW    = new VexRVMOp("VPSUBW",    P_66, M_0F,   WIG, 0xF9, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPSUBD    = new VexRVMOp("VPSUBD",    P_66, M_0F,   WIG, 0xFA, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPSUBQ    = new VexRVMOp("VPSUBQ",    P_66, M_0F,   WIG, 0xFB, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPSHUFB   = new VexRVMOp("VPSHUFB",   P_66, M_0F38, WIG, 0x00, VEXOpAssertion.AVX1_2);
         public static final VexRVMOp VCVTSD2SS = new VexRVMOp("VCVTSD2SS", P_F2, M_0F,   WIG, 0x5A);
         public static final VexRVMOp VCVTSS2SD = new VexRVMOp("VCVTSS2SD", P_F3, M_0F,   WIG, 0x5A);
-        public static final VexRVMOp VCVTSI2SD = new VexRVMOp("VCVTSI2SD", P_F2, M_0F,   W0,  0x2A, AVXOpAssertion.XMM_XMM_CPU);
-        public static final VexRVMOp VCVTSQ2SD = new VexRVMOp("VCVTSQ2SD", P_F2, M_0F,   W1,  0x2A, AVXOpAssertion.XMM_XMM_CPU);
-        public static final VexRVMOp VCVTSI2SS = new VexRVMOp("VCVTSI2SS", P_F3, M_0F,   W0,  0x2A, AVXOpAssertion.XMM_XMM_CPU);
-        public static final VexRVMOp VCVTSQ2SS = new VexRVMOp("VCVTSQ2SS", P_F3, M_0F,   W1,  0x2A, AVXOpAssertion.XMM_XMM_CPU);
-        public static final VexRVMOp VPCMPEQB  = new VexRVMOp("VPCMPEQB",  P_66, M_0F,   WIG, 0x74, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPCMPEQW  = new VexRVMOp("VPCMPEQW",  P_66, M_0F,   WIG, 0x75, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPCMPEQD  = new VexRVMOp("VPCMPEQD",  P_66, M_0F,   WIG, 0x76, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPCMPEQQ  = new VexRVMOp("VPCMPEQQ",  P_66, M_0F38, WIG, 0x29, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPCMPGTB  = new VexRVMOp("VPCMPGTB",  P_66, M_0F,   WIG, 0x64, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPCMPGTW  = new VexRVMOp("VPCMPGTW",  P_66, M_0F,   WIG, 0x65, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPCMPGTD  = new VexRVMOp("VPCMPGTD",  P_66, M_0F,   WIG, 0x66, AVXOpAssertion.AVX1_2);
-        public static final VexRVMOp VPCMPGTQ  = new VexRVMOp("VPCMPGTQ",  P_66, M_0F38, WIG, 0x37, AVXOpAssertion.AVX1_2);
+        public static final VexRVMOp VCVTSI2SD = new VexRVMOp("VCVTSI2SD", P_F2, M_0F,   W0,  0x2A, VEXOpAssertion.XMM_XMM_CPU);
+        public static final VexRVMOp VCVTSQ2SD = new VexRVMOp("VCVTSQ2SD", P_F2, M_0F,   W1,  0x2A, VEXOpAssertion.XMM_XMM_CPU);
+        public static final VexRVMOp VCVTSI2SS = new VexRVMOp("VCVTSI2SS", P_F3, M_0F,   W0,  0x2A, VEXOpAssertion.XMM_XMM_CPU);
+        public static final VexRVMOp VCVTSQ2SS = new VexRVMOp("VCVTSQ2SS", P_F3, M_0F,   W1,  0x2A, VEXOpAssertion.XMM_XMM_CPU);
+        public static final VexRVMOp VPCMPEQB  = new VexRVMOp("VPCMPEQB",  P_66, M_0F,   WIG, 0x74, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPCMPEQW  = new VexRVMOp("VPCMPEQW",  P_66, M_0F,   WIG, 0x75, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPCMPEQD  = new VexRVMOp("VPCMPEQD",  P_66, M_0F,   WIG, 0x76, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPCMPEQQ  = new VexRVMOp("VPCMPEQQ",  P_66, M_0F38, WIG, 0x29, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPCMPGTB  = new VexRVMOp("VPCMPGTB",  P_66, M_0F,   WIG, 0x64, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPCMPGTW  = new VexRVMOp("VPCMPGTW",  P_66, M_0F,   WIG, 0x65, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPCMPGTD  = new VexRVMOp("VPCMPGTD",  P_66, M_0F,   WIG, 0x66, VEXOpAssertion.AVX1_2);
+        public static final VexRVMOp VPCMPGTQ  = new VexRVMOp("VPCMPGTQ",  P_66, M_0F38, WIG, 0x37, VEXOpAssertion.AVX1_2);
         // @formatter:on
 
         private VexRVMOp(String opcode, int pp, int mmmmm, int w, int op) {
-            this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1);
         }
 
-        protected VexRVMOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        protected VexRVMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
         }
 
@@ -1330,6 +1333,65 @@
         }
     }
 
+    public static final class VexGeneralPurposeRVMOp extends VexOp {
+        // @formatter:off
+        public static final VexGeneralPurposeRVMOp ANDN   = new VexGeneralPurposeRVMOp("ANDN",   P_,   M_0F38, WIG, 0xF2, VEXOpAssertion.BMI1);
+        public static final VexGeneralPurposeRVMOp MULX   = new VexGeneralPurposeRVMOp("MULX",   P_F2, M_0F38, WIG, 0xF6, VEXOpAssertion.BMI2);
+        public static final VexGeneralPurposeRVMOp PDEP   = new VexGeneralPurposeRVMOp("PDEP",   P_F2, M_0F38, WIG, 0xF5, VEXOpAssertion.BMI2);
+        public static final VexGeneralPurposeRVMOp PEXT   = new VexGeneralPurposeRVMOp("PEXT",   P_F3, M_0F38, WIG, 0xF5, VEXOpAssertion.BMI2);
+        // @formatter:on
+
+        private VexGeneralPurposeRVMOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
+            super(opcode, pp, mmmmm, w, op, assertion);
+        }
+
+        public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2) {
+            assert assertion.check((AMD64) asm.target.arch, LZ, dst, src1, src2, null);
+            assert size == AVXSize.DWORD || size == AVXSize.QWORD;
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1);
+            asm.emitByte(op);
+            asm.emitModRM(dst, src2);
+        }
+
+        public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, AMD64Address src2) {
+            assert assertion.check((AMD64) asm.target.arch, LZ, dst, src1, null, null);
+            assert size == AVXSize.DWORD || size == AVXSize.QWORD;
+            asm.vexPrefix(dst, src1, src2, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1);
+            asm.emitByte(op);
+            asm.emitOperandHelper(dst, src2, 0);
+        }
+    }
+
+    public static final class VexGeneralPurposeRMVOp extends VexOp {
+        // @formatter:off
+        public static final VexGeneralPurposeRMVOp BEXTR  = new VexGeneralPurposeRMVOp("BEXTR",  P_,   M_0F38, WIG, 0xF7, VEXOpAssertion.BMI1);
+        public static final VexGeneralPurposeRMVOp BZHI   = new VexGeneralPurposeRMVOp("BZHI",   P_,   M_0F38, WIG, 0xF5, VEXOpAssertion.BMI2);
+        public static final VexGeneralPurposeRMVOp SARX   = new VexGeneralPurposeRMVOp("SARX",   P_F3, M_0F38, WIG, 0xF7, VEXOpAssertion.BMI2);
+        public static final VexGeneralPurposeRMVOp SHRX   = new VexGeneralPurposeRMVOp("SHRX",   P_F2, M_0F38, WIG, 0xF7, VEXOpAssertion.BMI2);
+        public static final VexGeneralPurposeRMVOp SHLX   = new VexGeneralPurposeRMVOp("SHLX",   P_66, M_0F38, WIG, 0xF7, VEXOpAssertion.BMI2);
+        // @formatter:on
+
+        private VexGeneralPurposeRMVOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
+            super(opcode, pp, mmmmm, w, op, assertion);
+        }
+
+        public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2) {
+            assert assertion.check((AMD64) asm.target.arch, LZ, dst, src2, src1, null);
+            assert size == AVXSize.DWORD || size == AVXSize.QWORD;
+            asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1);
+            asm.emitByte(op);
+            asm.emitModRM(dst, src1);
+        }
+
+        public void emit(AMD64Assembler asm, AVXSize size, Register dst, AMD64Address src1, Register src2) {
+            assert assertion.check((AMD64) asm.target.arch, LZ, dst, src2, null, null);
+            assert size == AVXSize.DWORD || size == AVXSize.QWORD;
+            asm.vexPrefix(dst, src2, src1, size, pp, mmmmm, size == AVXSize.DWORD ? W0 : W1);
+            asm.emitByte(op);
+            asm.emitOperandHelper(dst, src1, 0);
+        }
+    }
+
     /**
      * VEX-encoded shift instructions with an operand order of either RVM or VMI.
      */
@@ -1349,7 +1411,7 @@
         private final int r;
 
         private VexShiftOp(String opcode, int pp, int mmmmm, int w, int op, int immOp, int r) {
-            super(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1_2);
+            super(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1_2);
             this.immOp = immOp;
             this.r = r;
         }
@@ -1368,17 +1430,17 @@
         // @formatter:off
         public static final VexMaskMoveOp VMASKMOVPS = new VexMaskMoveOp("VMASKMOVPS", P_66, M_0F38, W0, 0x2C, 0x2E);
         public static final VexMaskMoveOp VMASKMOVPD = new VexMaskMoveOp("VMASKMOVPD", P_66, M_0F38, W0, 0x2D, 0x2F);
-        public static final VexMaskMoveOp VPMASKMOVD = new VexMaskMoveOp("VPMASKMOVD", P_66, M_0F38, W0, 0x8C, 0x8E, AVXOpAssertion.AVX2);
-        public static final VexMaskMoveOp VPMASKMOVQ = new VexMaskMoveOp("VPMASKMOVQ", P_66, M_0F38, W1, 0x8C, 0x8E, AVXOpAssertion.AVX2);
+        public static final VexMaskMoveOp VPMASKMOVD = new VexMaskMoveOp("VPMASKMOVD", P_66, M_0F38, W0, 0x8C, 0x8E, VEXOpAssertion.AVX2);
+        public static final VexMaskMoveOp VPMASKMOVQ = new VexMaskMoveOp("VPMASKMOVQ", P_66, M_0F38, W1, 0x8C, 0x8E, VEXOpAssertion.AVX2);
         // @formatter:on
 
         private final int opReverse;
 
         private VexMaskMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse) {
-            this(opcode, pp, mmmmm, w, op, opReverse, AVXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, opReverse, VEXOpAssertion.AVX1);
         }
 
-        private VexMaskMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, AVXOpAssertion assertion) {
+        private VexMaskMoveOp(String opcode, int pp, int mmmmm, int w, int op, int opReverse, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
             this.opReverse = opReverse;
         }
@@ -1405,15 +1467,15 @@
         // @formatter:off
         public static final VexRVMIOp VSHUFPS     = new VexRVMIOp("VSHUFPS",     P_,   M_0F,   WIG, 0xC6);
         public static final VexRVMIOp VSHUFPD     = new VexRVMIOp("VSHUFPD",     P_66, M_0F,   WIG, 0xC6);
-        public static final VexRVMIOp VINSERTF128 = new VexRVMIOp("VINSERTF128", P_66, M_0F3A, W0,  0x18, AVXOpAssertion.AVX1_256ONLY);
-        public static final VexRVMIOp VINSERTI128 = new VexRVMIOp("VINSERTI128", P_66, M_0F3A, W0,  0x38, AVXOpAssertion.AVX2_256ONLY);
+        public static final VexRVMIOp VINSERTF128 = new VexRVMIOp("VINSERTF128", P_66, M_0F3A, W0,  0x18, VEXOpAssertion.AVX1_256ONLY);
+        public static final VexRVMIOp VINSERTI128 = new VexRVMIOp("VINSERTI128", P_66, M_0F3A, W0,  0x38, VEXOpAssertion.AVX2_256ONLY);
         // @formatter:on
 
         private VexRVMIOp(String opcode, int pp, int mmmmm, int w, int op) {
-            this(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1);
+            this(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1);
         }
 
-        private VexRVMIOp(String opcode, int pp, int mmmmm, int w, int op, AVXOpAssertion assertion) {
+        private VexRVMIOp(String opcode, int pp, int mmmmm, int w, int op, VEXOpAssertion assertion) {
             super(opcode, pp, mmmmm, w, op, assertion);
         }
 
@@ -1528,7 +1590,7 @@
         }
 
         private VexFloatCompareOp(String opcode, int pp, int mmmmm, int w, int op) {
-            super(opcode, pp, mmmmm, w, op, AVXOpAssertion.AVX1);
+            super(opcode, pp, mmmmm, w, op, VEXOpAssertion.AVX1);
         }
 
         public void emit(AMD64Assembler asm, AVXSize size, Register dst, Register src1, Register src2, Predicate p) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -37,7 +37,7 @@
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.EVEXPrefixConfig.Z1;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L128;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.L256;
-import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LIG;
+import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.LZ;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F38;
 import static org.graalvm.compiler.asm.amd64.AMD64BaseAssembler.VEXPrefixConfig.M_0F3A;
@@ -748,7 +748,7 @@
     public static final class VEXPrefixConfig {
         public static final int L128 = 0;
         public static final int L256 = 1;
-        public static final int LIG = 0;
+        public static final int LZ = 0;
 
         public static final int W0 = 0;
         public static final int W1 = 1;
@@ -849,10 +849,10 @@
     protected final void emitVEX(int l, int pp, int mmmmm, int w, int rxb, int vvvv) {
         assert ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX) : "emitting VEX prefix on a CPU without AVX support";
 
-        assert l == L128 || l == L256 || l == LIG : "invalid value for VEX.L";
+        assert l == L128 || l == L256 : "invalid value for VEX.L";
         assert pp == P_ || pp == P_66 || pp == P_F3 || pp == P_F2 : "invalid value for VEX.pp";
         assert mmmmm == M_0F || mmmmm == M_0F38 || mmmmm == M_0F3A : "invalid value for VEX.m-mmmm";
-        assert w == W0 || w == W1 || w == WIG : "invalid value for VEX.W";
+        assert w == W0 || w == W1 : "invalid value for VEX.W";
 
         assert (rxb & 0x07) == rxb : "invalid value for VEX.RXB";
         assert (vvvv & 0x0F) == vvvv : "invalid value for VEX.vvvv";
@@ -887,7 +887,7 @@
         }
     }
 
-    private static int getLFlag(AVXSize size) {
+    public static int getLFlag(AVXSize size) {
         switch (size) {
             case XMM:
                 return L128;
@@ -896,7 +896,7 @@
             case ZMM:
                 return L512;
             default:
-                return LIG;
+                return LZ;
         }
     }
 
@@ -910,6 +910,7 @@
 
     protected static final class EVEXPrefixConfig {
         public static final int L512 = 2;
+        public static final int LIG = 0;
 
         public static final int Z0 = 0x0;
         public static final int Z1 = 0x1;
@@ -1013,10 +1014,10 @@
     private void emitEVEX(int l, int pp, int mm, int w, int rxb, int reg, int vvvvv, int z, int b, int aaa) {
         assert ((AMD64) target.arch).getFeatures().contains(CPUFeature.AVX512F) : "emitting EVEX prefix on a CPU without AVX512 support";
 
-        assert l == L128 || l == L256 || l == L512 || l == LIG : "invalid value for EVEX.L'L";
+        assert l == L128 || l == L256 || l == L512 : "invalid value for EVEX.L'L";
         assert pp == P_ || pp == P_66 || pp == P_F3 || pp == P_F2 : "invalid value for EVEX.pp";
         assert mm == M_0F || mm == M_0F38 || mm == M_0F3A : "invalid value for EVEX.mm";
-        assert w == W0 || w == W1 || w == WIG : "invalid value for EVEX.W";
+        assert w == W0 || w == W1 : "invalid value for EVEX.W";
 
         assert (rxb & 0x07) == rxb : "invalid value for EVEX.RXB";
         assert (reg & 0x1F) == reg : "invalid value for EVEX.R'";
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java	Tue Sep 18 16:41:24 2018 -0700
@@ -41,6 +41,7 @@
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
 
+import org.graalvm.compiler.api.replacements.MethodSubstitution;
 import org.graalvm.compiler.api.replacements.Snippet;
 import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
 import org.graalvm.compiler.api.replacements.Snippet.NonNullParameter;
@@ -279,7 +280,8 @@
                             executor.execute(() -> {
                                 try (DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER)) {
                                     ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
-                                    StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
+                                    boolean isSubstitution = method.getAnnotation(Snippet.class) != null || method.getAnnotation(MethodSubstitution.class) != null;
+                                    StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).setIsSubstitution(isSubstitution).build();
                                     try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("CheckingGraph", graph, method)) {
                                         checkMethod(method);
                                         graphBuilderSuite.apply(graph, context);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/NewInstanceTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,164 @@
+/*
+ * 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 org.graalvm.compiler.core.test;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Constructor;
+
+import org.graalvm.compiler.java.GraphBuilderPhase;
+import org.graalvm.compiler.nodes.DeoptimizeNode;
+import org.graalvm.compiler.nodes.StructuredGraph;
+import org.graalvm.compiler.nodes.StructuredGraph.AllowAssumptions;
+import org.graalvm.compiler.nodes.graphbuilderconf.GraphBuilderConfiguration;
+import org.graalvm.compiler.nodes.java.NewInstanceNode;
+import org.graalvm.compiler.options.OptionValues;
+import org.graalvm.compiler.phases.OptimisticOptimizations;
+import org.junit.Assert;
+import org.junit.Test;
+
+import jdk.vm.ci.meta.ResolvedJavaMethod;
+
+public class NewInstanceTest extends GraalCompilerTest {
+    public static class Template {
+        public Object o = new CCCC();
+    }
+
+    /**
+     * 1. Concrete class, should produce normal {@link NewInstanceNode}
+     */
+    public static class CCCC {
+
+    }
+
+    /**
+     * 2. The test will replace references to {@link CCCC} in the {@link Template} to {@link AAAA}
+     */
+    public abstract static class AAAA {
+
+    }
+
+    /**
+     * 3. The test will replace references to {@link CCCC} in the {@link Template} to {@link IIII}
+     */
+    public interface IIII {
+
+    }
+
+    private StructuredGraph parseAndProcess(Class<?> cl) {
+        Constructor<?>[] constructors = cl.getConstructors();
+        Assert.assertTrue(constructors.length == 1);
+        final ResolvedJavaMethod javaMethod = getMetaAccess().lookupJavaMethod(constructors[0]);
+        OptionValues options = getInitialOptions();
+        StructuredGraph graph = new StructuredGraph.Builder(options, getDebugContext(options, null, javaMethod), AllowAssumptions.YES).method(javaMethod).build();
+
+        GraphBuilderConfiguration conf = GraphBuilderConfiguration.getSnippetDefault(getDefaultGraphBuilderPlugins()).withUnresolvedIsError(false);
+        new GraphBuilderPhase.Instance(getMetaAccess(), getProviders().getStampProvider(), getProviders().getConstantReflection(), getProviders().getConstantFieldProvider(), conf,
+                        OptimisticOptimizations.ALL, null).apply(graph);
+        return graph;
+    }
+
+    private void checkGraph(Class<?> cl, int newInstanceNodeCount, int deoptimizeNodeCount) {
+        StructuredGraph graph = parseAndProcess(cl);
+        Assert.assertEquals(newInstanceNodeCount, graph.getNodes().filter(NewInstanceNode.class).count());
+        Assert.assertEquals(deoptimizeNodeCount, graph.getNodes().filter(DeoptimizeNode.class).count());
+    }
+
+    /**
+     * Use a custom class loader to generate classes, substitute class names at the allocation site.
+     */
+    @Test
+    public void test1() throws ClassNotFoundException {
+        checkGraph(Template.class, 1, 0);
+        ClassTemplateLoader loader1 = new ClassTemplateLoader("CCCC", "AAAA");
+        checkGraph(loader1.findClass("Template"), 0, 1);
+        ClassTemplateLoader loader2 = new ClassTemplateLoader("CCCC", "IIII");
+        checkGraph(loader2.findClass("Template"), 0, 1);
+    }
+
+    private static class ClassTemplateLoader extends ClassLoader {
+        private final String find;
+        private final String replace;
+
+        ClassTemplateLoader(String find, String replace) {
+            assert find.length() == replace.length();
+            this.find = find;
+            this.replace = replace;
+        }
+
+        @Override
+        protected Class<?> findClass(final String name) throws ClassNotFoundException {
+            // copy classfile to byte array
+            byte[] classData = null;
+            try {
+                InputStream is = NewInstanceTest.class.getResourceAsStream("NewInstanceTest$" + name + ".class");
+                assert is != null;
+                ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+                byte[] buf = new byte[1024];
+                int size;
+                while ((size = is.read(buf, 0, buf.length)) != -1) {
+                    baos.write(buf, 0, size);
+                }
+                baos.flush();
+                classData = baos.toByteArray();
+            } catch (IOException e) {
+                Assert.fail("can't access class: " + name);
+            }
+
+            // replace all occurrences of the template in classfile
+            int index = -1;
+            while ((index = indexOfTemplate(classData, index + 1, find)) != -1) {
+                replaceTemplate(classData, index, replace);
+            }
+
+            Class<?> c = defineClass(null, classData, 0, classData.length);
+            return c;
+        }
+
+        private static int indexOfTemplate(byte[] b, int index, String find) {
+            for (int i = index; i < b.length; i++) {
+                boolean match = true;
+                for (int j = i; j < i + find.length(); j++) {
+                    if (b[j] != (byte) find.charAt(j - i)) {
+                        match = false;
+                        break;
+                    }
+                }
+                if (match) {
+                    return i;
+                }
+            }
+            return -1;
+        }
+
+        private static void replaceTemplate(byte[] b, int index, String replace) {
+            for (int i = index; i < index + replace.length(); i++) {
+                b[i] = (byte) replace.charAt(i - index);
+            }
+        }
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,6 +27,7 @@
 import java.util.List;
 
 import org.graalvm.compiler.graph.Node;
+import org.graalvm.compiler.graph.iterators.NodeIterable;
 import org.graalvm.compiler.loop.DefaultLoopPolicies;
 import org.graalvm.compiler.loop.phases.LoopFullUnrollPhase;
 import org.graalvm.compiler.loop.phases.LoopPeelingPhase;
@@ -492,4 +493,21 @@
     public void testDeoptMonitor() {
         test("testDeoptMonitorSnippet", new Object(), 0);
     }
+
+    @Test
+    public void testInterfaceArrayAssignment() {
+        prepareGraph("testInterfaceArrayAssignmentSnippet", false);
+        NodeIterable<ReturnNode> returns = graph.getNodes().filter(ReturnNode.class);
+        assertTrue(returns.count() == 1);
+        assertFalse(returns.first().result().isConstant());
+    }
+
+    private interface TestInterface {
+    }
+
+    public static boolean testInterfaceArrayAssignmentSnippet() {
+        Object[] array = new TestInterface[1];
+        array[0] = new Object();
+        return array[0] == null;
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java	Tue Sep 18 16:41:24 2018 -0700
@@ -41,6 +41,7 @@
 import java.io.PrintStream;
 import java.util.Map;
 
+import org.graalvm.compiler.debug.DebugCloseable;
 import org.graalvm.compiler.debug.DebugContext;
 import org.graalvm.compiler.debug.DiagnosticsOutputDirectory;
 import org.graalvm.compiler.debug.PathUtilities;
@@ -181,15 +182,64 @@
                 actionKey = CompilationFailureAction;
                 causeType = "failure";
             }
-            ExceptionAction action = lookupAction(initialOptions, actionKey, cause);
+            synchronized (CompilationFailureAction) {
+                // Serialize all compilation failure handling.
+                // This prevents retry compilation storms and interleaving
+                // of compilation exception messages.
+                // It also allows for reliable testing of CompilationWrapper
+                // by avoiding a race whereby retry compilation output from a
+                // forced crash (i.e., use of GraalCompilerOptions.CrashAt)
+                // is truncated.
 
-            action = adjustAction(initialOptions, actionKey, action);
+                ExceptionAction action = lookupAction(initialOptions, actionKey, cause);
+
+                action = adjustAction(initialOptions, actionKey, action);
+
+                if (action == ExceptionAction.Silent) {
+                    return handleException(cause);
+                }
 
-            if (action == ExceptionAction.Silent) {
-                return handleException(cause);
-            }
+                if (action == ExceptionAction.Print) {
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream();
+                    try (PrintStream ps = new PrintStream(baos)) {
+                        ps.printf("%s: Compilation of %s failed: ", Thread.currentThread(), this);
+                        cause.printStackTrace(ps);
+                        ps.printf("To disable compilation %s notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n",
+                                        causeType,
+                                        actionKey.getName(), ExceptionAction.Silent,
+                                        actionKey.getName(), ExceptionAction.Silent);
+                        ps.printf("To capture more information for diagnosing or reporting a compilation %s, " +
+                                        "set %s to %s or %s (e.g., -Dgraal.%s=%s).%n",
+                                        causeType,
+                                        actionKey.getName(), ExceptionAction.Diagnose,
+                                        ExceptionAction.ExitVM,
+                                        actionKey.getName(), ExceptionAction.Diagnose);
+                    }
+                    TTY.print(baos.toString());
+                    return handleException(cause);
+                }
 
-            if (action == ExceptionAction.Print) {
+                // action is Diagnose or ExitVM
+
+                if (Dump.hasBeenSet(initialOptions)) {
+                    // If dumping is explicitly enabled, Graal is being debugged
+                    // so don't interfere with what the user is expecting to see.
+                    return handleException(cause);
+                }
+
+                String dir = this.outputDirectory.getPath();
+                if (dir == null) {
+                    return handleException(cause);
+                }
+                String dumpName = PathUtilities.sanitizeFileName(toString());
+                File dumpPath = new File(dir, dumpName);
+                dumpPath.mkdirs();
+                if (!dumpPath.exists()) {
+                    TTY.println("Warning: could not create diagnostics directory " + dumpPath);
+                    return handleException(cause);
+                }
+
+                String message;
                 ByteArrayOutputStream baos = new ByteArrayOutputStream();
                 try (PrintStream ps = new PrintStream(baos)) {
                     ps.printf("%s: Compilation of %s failed: ", Thread.currentThread(), this);
@@ -198,63 +248,16 @@
                                     causeType,
                                     actionKey.getName(), ExceptionAction.Silent,
                                     actionKey.getName(), ExceptionAction.Silent);
-                    ps.printf("To capture more information for diagnosing or reporting a compilation %s, " +
-                                    "set %s to %s or %s (e.g., -Dgraal.%s=%s).%n",
+                    ps.printf("To print a message for a compilation %s without retrying the compilation, " +
+                                    "set %s to %s (e.g., -Dgraal.%s=%s).%n",
                                     causeType,
-                                    actionKey.getName(), ExceptionAction.Diagnose,
-                                    ExceptionAction.ExitVM,
-                                    actionKey.getName(), ExceptionAction.Diagnose);
+                                    actionKey.getName(), ExceptionAction.Print,
+                                    actionKey.getName(), ExceptionAction.Print);
+                    ps.println("Retrying compilation of " + this);
+                    message = baos.toString();
                 }
-                synchronized (CompilationFailureAction) {
-                    // Synchronize to prevent compilation exception
-                    // messages from interleaving.
-                    TTY.println(baos.toString());
-                }
-                return handleException(cause);
-            }
-
-            // action is Diagnose or ExitVM
-
-            if (Dump.hasBeenSet(initialOptions)) {
-                // If dumping is explicitly enabled, Graal is being debugged
-                // so don't interfere with what the user is expecting to see.
-                return handleException(cause);
-            }
 
-            String dir = this.outputDirectory.getPath();
-            if (dir == null) {
-                return handleException(cause);
-            }
-            String dumpName = PathUtilities.sanitizeFileName(toString());
-            File dumpPath = new File(dir, dumpName);
-            dumpPath.mkdirs();
-            if (!dumpPath.exists()) {
-                TTY.println("Warning: could not create diagnostics directory " + dumpPath);
-                return handleException(cause);
-            }
-
-            String message;
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            try (PrintStream ps = new PrintStream(baos)) {
-                ps.printf("%s: Compilation of %s failed: ", Thread.currentThread(), this);
-                cause.printStackTrace(ps);
-                ps.printf("To disable compilation %s notifications, set %s to %s (e.g., -Dgraal.%s=%s).%n",
-                                causeType,
-                                actionKey.getName(), ExceptionAction.Silent,
-                                actionKey.getName(), ExceptionAction.Silent);
-                ps.printf("To print a message for a compilation %s without retrying the compilation, " +
-                                "set %s to %s (e.g., -Dgraal.%s=%s).%n",
-                                causeType,
-                                actionKey.getName(), ExceptionAction.Print,
-                                actionKey.getName(), ExceptionAction.Print);
-                ps.println("Retrying compilation of " + this);
-                message = baos.toString();
-            }
-
-            synchronized (CompilationFailureAction) {
-                // Synchronize here to serialize retry compilations. This
-                // mitigates retry compilation storms.
-                TTY.println(message);
+                TTY.print(message);
                 File retryLogFile = new File(dumpPath, "retry.log");
                 try (PrintStream ps = new PrintStream(new FileOutputStream(retryLogFile))) {
                     ps.print(message);
@@ -267,7 +270,7 @@
                                 MethodFilter, null,
                                 DumpPath, dumpPath.getPath());
 
-                try (DebugContext retryDebug = createRetryDebugContext(retryOptions)) {
+                try (DebugContext retryDebug = createRetryDebugContext(retryOptions); DebugCloseable s = retryDebug.disableIntercept()) {
                     T res = performCompilation(retryDebug);
                     maybeExitVM(action);
                     return res;
@@ -283,16 +286,8 @@
 
     private void maybeExitVM(ExceptionAction action) {
         if (action == ExitVM) {
-            synchronized (ExceptionAction.class) {
-                try {
-                    // Give other compiler threads a chance to flush
-                    // error handling output.
-                    ExceptionAction.class.wait(2000);
-                } catch (InterruptedException e) {
-                }
-                TTY.println("Exiting VM after retry compilation of " + this);
-                System.exit(-1);
-            }
+            TTY.println("Exiting VM after retry compilation of " + this);
+            System.exit(-1);
         }
     }
 
@@ -303,22 +298,24 @@
     private ExceptionAction adjustAction(OptionValues initialOptions, EnumOptionKey<ExceptionAction> actionKey, ExceptionAction initialAction) {
         ExceptionAction action = initialAction;
         int maxProblems = MaxCompilationProblemsPerAction.getValue(initialOptions);
-        synchronized (problemsHandledPerAction) {
-            while (action != ExceptionAction.Silent) {
-                int problems = problemsHandledPerAction.getOrDefault(action, 0);
-                if (problems >= maxProblems) {
-                    if (problems == maxProblems) {
-                        TTY.printf("Warning: adjusting %s from %s to %s after %s (%d) failed compilations%n", actionKey, action, action.quieter(),
-                                        MaxCompilationProblemsPerAction, maxProblems);
-                        // Ensure that the message above is only printed once
-                        problemsHandledPerAction.put(action, problems + 1);
+        if (action != ExceptionAction.ExitVM) {
+            synchronized (problemsHandledPerAction) {
+                while (action != ExceptionAction.Silent) {
+                    int problems = problemsHandledPerAction.getOrDefault(action, 0);
+                    if (problems >= maxProblems) {
+                        if (problems == maxProblems) {
+                            TTY.printf("Warning: adjusting %s from %s to %s after %s (%d) failed compilations%n", actionKey, action, action.quieter(),
+                                            MaxCompilationProblemsPerAction, maxProblems);
+                            // Ensure that the message above is only printed once
+                            problemsHandledPerAction.put(action, problems + 1);
+                        }
+                        action = action.quieter();
+                    } else {
+                        break;
                     }
-                    action = action.quieter();
-                } else {
-                    break;
                 }
+                problemsHandledPerAction.put(action, problemsHandledPerAction.getOrDefault(action, 0) + 1);
             }
-            problemsHandledPerAction.put(action, problemsHandledPerAction.getOrDefault(action, 0) + 1);
         }
         return action;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java	Tue Sep 18 16:41:24 2018 -0700
@@ -50,7 +50,8 @@
                    "The accepted values are the same as for CompilationBailoutAction.", type = OptionType.User)
      public static final EnumOptionKey<ExceptionAction> CompilationFailureAction = new EnumOptionKey<>(ExceptionAction.Diagnose);
     @Option(help = "The maximum number of compilation failures or bailouts to handle with the action specified " +
-                   "by CompilationFailureAction or CompilationBailoutAction before changing to a less verbose action.", type = OptionType.User)
+                   "by CompilationFailureAction or CompilationBailoutAction before changing to a less verbose action. " +
+                   "This does not apply to the ExitVM action.", type = OptionType.User)
     public static final OptionKey<Integer> MaxCompilationProblemsPerAction = new OptionKey<>(2);
     @Option(help = "Alias for CompilationFailureAction=ExitVM.", type = OptionType.User)
     public static final OptionKey<Boolean> ExitVMOnException = new OptionKey<>(false);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/DebugContextTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/DebugContextTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,14 +27,16 @@
 import static org.graalvm.compiler.debug.DebugContext.NO_DESCRIPTION;
 import static org.graalvm.compiler.debug.DebugContext.NO_GLOBAL_METRIC_VALUES;
 
+import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
 import java.io.IOException;
+import java.io.InputStreamReader;
 import java.io.PrintStream;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Formatter;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import jdk.internal.vm.compiler.collections.EconomicMap;
 import org.graalvm.compiler.debug.Assertions;
@@ -158,14 +160,13 @@
                 }
             }
         }
-        DataInputStream in = new DataInputStream(getClass().getResourceAsStream(getClass().getSimpleName() + ".testLogging.input"));
-        byte[] buf = new byte[in.available()];
-        in.readFully(buf);
-        String threadLabel = "[thread:" + Thread.currentThread().getId() + "]";
-        String expect = new String(buf).replace("[thread:1]", threadLabel);
-
-        String log = setup.logOutput.toString();
-        Assert.assertEquals(expect, log);
+        String expected;
+        try (BufferedReader input = new BufferedReader(new InputStreamReader(getClass().getResourceAsStream(getClass().getSimpleName() + ".testLogging.input")))) {
+            String threadLabel = "[thread:" + Thread.currentThread().getId() + "]";
+            expected = input.lines().collect(Collectors.joining(System.lineSeparator(), "", System.lineSeparator())).replace("[thread:1]", threadLabel);
+        }
+        String logged = setup.logOutput.toString();
+        Assert.assertEquals(expected, logged);
     }
 
     @Test
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DiagnosticsOutputDirectory.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DiagnosticsOutputDirectory.java	Tue Sep 18 16:41:24 2018 -0700
@@ -84,7 +84,10 @@
                 }
             }
         }
-        return CLOSED.equals(path) ? null : path;
+        if (CLOSED.equals(path)) {
+            TTY.println("Warning: Graal diagnostic directory already closed");
+        }
+        return path;
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,8 +24,11 @@
 
 package org.graalvm.compiler.debug;
 
+import static java.nio.file.LinkOption.NOFOLLOW_LINKS;
+
 import java.io.File;
 import java.io.IOException;
+import java.nio.file.AccessDeniedException;
 import java.nio.file.FileAlreadyExistsException;
 import java.nio.file.Files;
 import java.nio.file.InvalidPathException;
@@ -118,7 +121,15 @@
                 if (createDirectory) {
                     return Files.createDirectory(result);
                 } else {
-                    return Files.createFile(result);
+                    try {
+                        return Files.createFile(result);
+                    } catch (AccessDeniedException e) {
+                        /*
+                         * Thrown on Windows if a directory with the same name already exists, so
+                         * convert it to FileAlreadyExistsException if that's the case.
+                         */
+                        throw Files.isDirectory(result, NOFOLLOW_LINKS) ? new FileAlreadyExistsException(e.getFile()) : e;
+                    }
                 }
             } catch (FileAlreadyExistsException e) {
                 uniqueTag = "_" + dumpCounter++;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -54,11 +54,13 @@
      */
     @Test
     public void testVMCompilation1() throws IOException, InterruptedException {
-        testHelper(Collections.emptyList(), Arrays.asList("-XX:+BootstrapJVMCI",
+        testHelper(Collections.emptyList(), Arrays.asList("-XX:-TieredCompilation",
                         "-XX:+UseJVMCICompiler",
                         "-Dgraal.CompilationFailureAction=ExitVM",
-                        "-Dgraal.CrashAt=Object.*,String.*",
-                        "-version"));
+                        "-Dgraal.CrashAt=TestProgram.*",
+                        "-Xcomp",
+                        "-XX:CompileCommand=compileonly,*/TestProgram.print*",
+                        TestProgram.class.getName()));
     }
 
     /**
@@ -67,11 +69,13 @@
      */
     @Test
     public void testVMCompilation2() throws IOException, InterruptedException {
-        testHelper(Collections.emptyList(), Arrays.asList("-XX:+BootstrapJVMCI",
+        testHelper(Collections.emptyList(), Arrays.asList("-XX:-TieredCompilation",
                         "-XX:+UseJVMCICompiler",
                         "-Dgraal.ExitVMOnException=true",
-                        "-Dgraal.CrashAt=Object.*,String.*",
-                        "-version"));
+                        "-Dgraal.CrashAt=TestProgram.*",
+                        "-Xcomp",
+                        "-XX:CompileCommand=compileonly,*/TestProgram.print*",
+                        TestProgram.class.getName()));
     }
 
     static class Probe {
@@ -105,23 +109,36 @@
      */
     @Test
     public void testVMCompilation3() throws IOException, InterruptedException {
-        final int maxProblems = 4;
+        final int maxProblems = 2;
+        Probe retryingProbe = new Probe("Retrying compilation of", maxProblems) {
+            @Override
+            String test() {
+                return actualOccurrences > 0 && actualOccurrences <= maxProblems ? null : String.format("expected occurrences to be in [1 .. %d]", maxProblems);
+            }
+        };
+        Probe adjustmentProbe = new Probe("adjusting CompilationFailureAction from Diagnose to Print", 1) {
+            @Override
+            String test() {
+                if (retryingProbe.actualOccurrences >= maxProblems) {
+                    if (actualOccurrences == 0) {
+                        return "expected at least one occurrence";
+                    }
+                }
+                return null;
+            }
+        };
         Probe[] probes = {
-                        new Probe("Retrying compilation of", maxProblems) {
-                            @Override
-                            String test() {
-                                return actualOccurrences > 0 && actualOccurrences <= maxProblems ? null : String.format("expected occurrences to be in [1 .. %d]", maxProblems);
-                            }
-                        },
-                        new Probe("adjusting CompilationFailureAction from Diagnose to Print", 1),
-                        new Probe("adjusting CompilationFailureAction from Print to Silent", 1),
+                        retryingProbe,
+                        adjustmentProbe
         };
-        testHelper(Arrays.asList(probes), Arrays.asList("-XX:+BootstrapJVMCI",
+        testHelper(Arrays.asList(probes), Arrays.asList("-XX:-TieredCompilation",
                         "-XX:+UseJVMCICompiler",
                         "-Dgraal.CompilationFailureAction=Diagnose",
                         "-Dgraal.MaxCompilationProblemsPerAction=" + maxProblems,
-                        "-Dgraal.CrashAt=Object.*,String.*",
-                        "-version"));
+                        "-Dgraal.CrashAt=TestProgram.*",
+                        "-Xcomp",
+                        "-XX:CompileCommand=compileonly,*/TestProgram.print*",
+                        TestProgram.class.getName()));
     }
 
     /**
@@ -246,3 +263,38 @@
         }
     }
 }
+
+class TestProgram {
+    public static void main(String[] args) {
+        printHello1();
+        printWorld1();
+        printHello2();
+        printWorld2();
+        printHello3();
+        printWorld3();
+    }
+
+    private static void printHello1() {
+        System.out.println("Hello1");
+    }
+
+    private static void printWorld1() {
+        System.out.println("World1");
+    }
+
+    private static void printHello2() {
+        System.out.println("Hello2");
+    }
+
+    private static void printWorld2() {
+        System.out.println("World2");
+    }
+
+    private static void printHello3() {
+        System.out.println("Hello3");
+    }
+
+    private static void printWorld3() {
+        System.out.println("World3");
+    }
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,6 @@
 import org.junit.Assert;
 import org.junit.Test;
 
-import jdk.vm.ci.meta.ProfilingInfo;
-import jdk.vm.ci.meta.ResolvedJavaMethod;
-
 /**
  * Test on-stack-replacement with Graal. The test manually triggers a Graal OSR-compilation which is
  * later invoked when hitting the backedge counter overflow.
@@ -103,58 +100,4 @@
         GraalDirectives.controlFlowAnchor();
         return ret;
     }
-
-    @Test
-    public void testOSR04() {
-        testFunnyOSR("testDoWhile", GraalOSRTest::testDoWhile);
-    }
-
-    @Test
-    public void testOSR05() {
-        testFunnyOSR("testDoWhileLocked", GraalOSRTest::testDoWhileLocked);
-    }
-
-    /**
-     * Because of a bug in C1 profile collection HotSpot can sometimes request an OSR compilation
-     * for a backedge which isn't ever taken. This test synthetically creates that situation.
-     */
-    private void testFunnyOSR(String name, Runnable warmup) {
-        ResolvedJavaMethod method = getResolvedJavaMethod(name);
-        int iterations = 0;
-        while (true) {
-            ProfilingInfo profilingInfo = method.getProfilingInfo();
-            if (profilingInfo.isMature()) {
-                break;
-            }
-
-            warmup.run();
-            if (iterations++ % 1000 == 0) {
-                System.err.print('.');
-            }
-            if (iterations > 200000) {
-                throw new AssertionError("no profile");
-            }
-        }
-        compileOSR(getInitialOptions(), method);
-        Result result = executeExpected(method, null);
-        checkResult(result);
-    }
-
-    private static boolean repeatLoop;
-
-    public static ReturnValue testDoWhile() {
-        do {
-            sideEffect++;
-        } while (repeatLoop);
-        return ReturnValue.SUCCESS;
-    }
-
-    public static synchronized ReturnValue testDoWhileLocked() {
-        // synchronized (GraalOSRTest.class) {
-        do {
-            sideEffect++;
-        } while (repeatLoop);
-        // }
-        return ReturnValue.SUCCESS;
-    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -358,14 +358,17 @@
         assertNotNull("Info is found", info);
 
         final MBeanOperationInfo[] arr = info.getOperations();
-        assertEquals("Currently three overloads", 3, arr.length);
         MBeanOperationInfo dumpOp = null;
+        int dumpMethodCount = 0;
         for (int i = 0; i < arr.length; i++) {
-            assertEquals("dumpMethod", arr[i].getName());
-            if (arr[i].getSignature().length == 3) {
-                dumpOp = arr[i];
+            if ("dumpMethod".equals(arr[i].getName())) {
+                if (arr[i].getSignature().length == 3) {
+                    dumpOp = arr[i];
+                }
+                dumpMethodCount++;
             }
         }
+        assertEquals("Currently three overloads", 3, dumpMethodCount);
         assertNotNull("three args variant (as used by VisualVM) found", dumpOp);
 
         MBeanAttributeInfo dumpPath = findAttributeInfo("DumpPath", info);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Tue Sep 18 16:41:24 2018 -0700
@@ -26,6 +26,10 @@
 
 import java.util.EnumSet;
 
+import jdk.internal.vm.compiler.collections.EconomicMap;
+import jdk.internal.vm.compiler.collections.EconomicSet;
+import jdk.internal.vm.compiler.collections.Equivalence;
+import jdk.internal.vm.compiler.collections.MapCursor;
 import org.graalvm.compiler.code.CompilationResult;
 import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.cfg.AbstractBlockBase;
@@ -66,10 +70,6 @@
 import org.graalvm.compiler.options.OptionValues;
 import org.graalvm.compiler.phases.tiers.SuitesProvider;
 import org.graalvm.compiler.word.Word;
-import jdk.internal.vm.compiler.collections.EconomicMap;
-import jdk.internal.vm.compiler.collections.EconomicSet;
-import jdk.internal.vm.compiler.collections.Equivalence;
-import jdk.internal.vm.compiler.collections.MapCursor;
 import jdk.internal.vm.compiler.word.Pointer;
 
 import jdk.vm.ci.code.CompilationRequest;
@@ -286,7 +286,7 @@
     /**
      * New array stub.
      */
-    public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, KlassPointer.class, int.class, boolean.class);
+    public static final ForeignCallDescriptor NEW_ARRAY = new ForeignCallDescriptor("new_array", Object.class, KlassPointer.class, int.class);
 
     /**
      * New instance stub.
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -227,6 +227,7 @@
                             method(substMethod).
                             compilationId(compilationId).
                             recordInlinedMethods(bytecodeProvider.shouldRecordMethodDependencies()).
+                            setIsSubstitution(true).
                             build();
             // @formatter:on
             try (DebugContext.Scope scope = debug.scope("GetIntrinsicGraph", graph)) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntimeProvider.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntimeProvider.java	Tue Sep 18 16:41:24 2018 -0700
@@ -93,7 +93,8 @@
     DiagnosticsOutputDirectory getOutputDirectory();
 
     /**
-     * Gets the map used to count compilation problems at each {@link ExceptionAction} level.
+     * Gets the map used to count compilation problems at each {@link ExceptionAction} level. All
+     * updates and queries to the map should be synchronized.
      */
     Map<ExceptionAction, Integer> getCompilationProblemsPerAction();
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java	Tue Sep 18 16:41:24 2018 -0700
@@ -131,7 +131,7 @@
                     return;
                 }
             } else {
-                // Graal is compatible with all JDK versions as of 9 GA.
+                // Graal is compatible with all JDK versions as of 11 GA.
             }
         }
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Tue Sep 18 16:41:24 2018 -0700
@@ -85,8 +85,6 @@
 import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.G1WBPRECALL;
 import static org.graalvm.compiler.hotspot.replacements.WriteBarrierSnippets.VALIDATE_OBJECT;
 import static org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub.EXCEPTION_HANDLER_FOR_PC;
-import static org.graalvm.compiler.hotspot.stubs.NewArrayStub.NEW_ARRAY_C;
-import static org.graalvm.compiler.hotspot.stubs.NewInstanceStub.NEW_INSTANCE_C;
 import static org.graalvm.compiler.hotspot.stubs.StubUtil.VM_MESSAGE_C;
 import static org.graalvm.compiler.hotspot.stubs.UnwindExceptionToCallerStub.EXCEPTION_HANDLER_FOR_RETURN_ADDRESS;
 import static org.graalvm.compiler.nodes.java.ForeignCallDescriptors.REGISTER_FINALIZER;
@@ -119,8 +117,6 @@
 import org.graalvm.compiler.hotspot.stubs.ExceptionHandlerStub;
 import org.graalvm.compiler.hotspot.stubs.IntegerExactOverflowExceptionStub;
 import org.graalvm.compiler.hotspot.stubs.LongExactOverflowExceptionStub;
-import org.graalvm.compiler.hotspot.stubs.NewArrayStub;
-import org.graalvm.compiler.hotspot.stubs.NewInstanceStub;
 import org.graalvm.compiler.hotspot.stubs.NullPointerExceptionStub;
 import org.graalvm.compiler.hotspot.stubs.OutOfBoundsExceptionStub;
 import org.graalvm.compiler.hotspot.stubs.Stub;
@@ -280,8 +276,6 @@
 
         registerForeignCall(EXCEPTION_HANDLER_FOR_PC, c.exceptionHandlerForPcAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
         registerForeignCall(EXCEPTION_HANDLER_FOR_RETURN_ADDRESS, c.exceptionHandlerForReturnAddressAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
-        registerForeignCall(NEW_ARRAY_C, c.newArrayAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
-        registerForeignCall(NEW_INSTANCE_C, c.newInstanceAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, any());
 
         CreateExceptionStub.registerForeignCalls(c, this);
 
@@ -292,8 +286,8 @@
         registerForeignCall(VM_MESSAGE_C, c.vmMessageAddress, NativeCall, DESTROYS_REGISTERS, SAFEPOINT, REEXECUTABLE, NO_LOCATIONS);
         registerForeignCall(ASSERTION_VM_MESSAGE_C, c.vmMessageAddress, NativeCall, PRESERVES_REGISTERS, LEAF, REEXECUTABLE, NO_LOCATIONS);
 
-        link(new NewInstanceStub(options, providers, registerStubCall(NEW_INSTANCE, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION)));
-        link(new NewArrayStub(options, providers, registerStubCall(NEW_ARRAY, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION)));
+        linkForeignCall(options, providers, NEW_INSTANCE, c.newInstanceAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
+        linkForeignCall(options, providers, NEW_ARRAY, c.newArrayAddress, PREPEND_THREAD, SAFEPOINT, REEXECUTABLE, TLAB_TOP_LOCATION, TLAB_END_LOCATION);
         link(new ExceptionHandlerStub(options, providers, foreignCalls.get(EXCEPTION_HANDLER)));
         link(new UnwindExceptionToCallerStub(options, providers, registerStubCall(UNWIND_EXCEPTION_TO_CALLER, SAFEPOINT, REEXECUTABLE_ONLY_AFTER_EXCEPTION, any())));
         link(new VerifyOopStub(options, providers, registerStubCall(VERIFY_OOP, LEAF_NOFP, REEXECUTABLE, NO_LOCATIONS)));
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java	Tue Sep 18 16:41:24 2018 -0700
@@ -331,14 +331,14 @@
             }
             result = formatArray(hub, allocationSize, length, headerSize, top, prototypeMarkWord, fillContents, maybeUnroll, counters);
         } else {
-            result = newArray(HotSpotBackend.NEW_ARRAY, hub, length, fillContents);
+            result = newArray(HotSpotBackend.NEW_ARRAY, hub, length);
         }
         profileAllocation("array", allocationSize, typeContext, options);
         return result;
     }
 
     @NodeIntrinsic(value = ForeignCallNode.class, injectedStampIsNonNull = true)
-    public static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length, boolean fillContents);
+    public static native Object newArray(@ConstantNodeParameter ForeignCallDescriptor descriptor, KlassPointer hub, int length);
 
     public static final ForeignCallDescriptor DYNAMIC_NEW_ARRAY = new ForeignCallDescriptor("dynamic_new_array", Object.class, Class.class, int.class);
     public static final ForeignCallDescriptor DYNAMIC_NEW_INSTANCE = new ForeignCallDescriptor("dynamic_new_instance", Object.class, Class.class);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewArrayStub.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,122 +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.
- */
-
-
-package org.graalvm.compiler.hotspot.stubs;
-
-import static org.graalvm.compiler.hotspot.GraalHotSpotVMConfig.INJECTED_VMCONFIG;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.arrayAllocationSize;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.getAndClearObjectResult;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperElementTypeMask;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperElementTypeShift;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperHeaderSizeMask;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperHeaderSizeShift;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperLog2ElementSizeMask;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.layoutHelperLog2ElementSizeShift;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.readLayoutHelper;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.handlePendingException;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject;
-
-import org.graalvm.compiler.api.replacements.Fold;
-import org.graalvm.compiler.api.replacements.Snippet;
-import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
-import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
-import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
-import org.graalvm.compiler.graph.Node.NodeIntrinsic;
-import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
-import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
-import org.graalvm.compiler.hotspot.nodes.StubForeignCallNode;
-import org.graalvm.compiler.hotspot.replacements.NewObjectSnippets;
-import org.graalvm.compiler.hotspot.word.KlassPointer;
-import org.graalvm.compiler.options.OptionValues;
-import org.graalvm.compiler.word.Word;
-
-import jdk.vm.ci.code.Register;
-
-/**
- * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is
- * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails.
- * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++
- * runtime to complete the allocation.
- */
-public class NewArrayStub extends SnippetStub {
-
-    public NewArrayStub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) {
-        super("newArray", options, providers, linkage);
-    }
-
-    @Override
-    protected Object[] makeConstArgs() {
-        int count = method.getSignature().getParameterCount(false);
-        Object[] args = new Object[count];
-        assert checkConstArg(2, "threadRegister");
-        assert checkConstArg(3, "options");
-        args[2] = providers.getRegisters().getThreadRegister();
-        args[3] = options;
-        return args;
-    }
-
-    @Fold
-    static boolean logging(OptionValues options) {
-        return StubOptions.TraceNewArrayStub.getValue(options);
-    }
-
-    /**
-     * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to
-     * -XX:-UseTLAB).
-     *
-     * @param hub the hub of the object to be allocated
-     * @param length the length of the array
-     */
-    @Snippet
-    private static Object newArray(KlassPointer hub, int length, @ConstantParameter Register threadRegister, @ConstantParameter OptionValues options) {
-        int layoutHelper = readLayoutHelper(hub);
-        int log2ElementSize = (layoutHelper >> layoutHelperLog2ElementSizeShift(INJECTED_VMCONFIG)) & layoutHelperLog2ElementSizeMask(INJECTED_VMCONFIG);
-        int headerSize = (layoutHelper >> layoutHelperHeaderSizeShift(INJECTED_VMCONFIG)) & layoutHelperHeaderSizeMask(INJECTED_VMCONFIG);
-        int elementKind = (layoutHelper >> layoutHelperElementTypeShift(INJECTED_VMCONFIG)) & layoutHelperElementTypeMask(INJECTED_VMCONFIG);
-        int sizeInBytes = arrayAllocationSize(length, headerSize, log2ElementSize);
-        if (logging(options)) {
-            printf("newArray: element kind %d\n", elementKind);
-            printf("newArray: array length %d\n", length);
-            printf("newArray: array size %d\n", sizeInBytes);
-            printf("newArray: hub=%p\n", hub.asWord().rawValue());
-        }
-
-        Word thread = registerAsWord(threadRegister);
-        if (logging(options)) {
-            printf("newArray: calling new_array_c\n");
-        }
-
-        newArrayC(NEW_ARRAY_C, thread, hub, length);
-        handlePendingException(thread, true, true);
-        return verifyObject(getAndClearObjectResult(thread));
-    }
-
-    public static final ForeignCallDescriptor NEW_ARRAY_C = newDescriptor(NewArrayStub.class, "newArrayC", void.class, Word.class, KlassPointer.class, int.class);
-
-    @NodeIntrinsic(StubForeignCallNode.class)
-    public static native void newArrayC(@ConstantNodeParameter ForeignCallDescriptor newArrayC, Word thread, KlassPointer hub, int length);
-}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/NewInstanceStub.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +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.
- */
-
-
-package org.graalvm.compiler.hotspot.stubs;
-
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.getAndClearObjectResult;
-import static org.graalvm.compiler.hotspot.replacements.HotSpotReplacementsUtil.registerAsWord;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.handlePendingException;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.newDescriptor;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.printf;
-import static org.graalvm.compiler.hotspot.stubs.StubUtil.verifyObject;
-
-import org.graalvm.compiler.api.replacements.Fold;
-import org.graalvm.compiler.api.replacements.Snippet;
-import org.graalvm.compiler.api.replacements.Snippet.ConstantParameter;
-import org.graalvm.compiler.core.common.spi.ForeignCallDescriptor;
-import org.graalvm.compiler.graph.Node.ConstantNodeParameter;
-import org.graalvm.compiler.graph.Node.NodeIntrinsic;
-import org.graalvm.compiler.hotspot.HotSpotForeignCallLinkage;
-import org.graalvm.compiler.hotspot.meta.HotSpotProviders;
-import org.graalvm.compiler.hotspot.nodes.StubForeignCallNode;
-import org.graalvm.compiler.hotspot.replacements.NewObjectSnippets;
-import org.graalvm.compiler.hotspot.word.KlassPointer;
-import org.graalvm.compiler.options.OptionValues;
-import org.graalvm.compiler.word.Word;
-
-import jdk.vm.ci.code.Register;
-
-/**
- * Stub implementing the fast path for TLAB refill during instance class allocation. This stub is
- * called from the {@linkplain NewObjectSnippets inline} allocation code when TLAB allocation fails.
- * If this stub fails to refill the TLAB or allocate the object, it calls out to the HotSpot C++
- * runtime for to complete the allocation.
- */
-public class NewInstanceStub extends SnippetStub {
-
-    public NewInstanceStub(OptionValues options, HotSpotProviders providers, HotSpotForeignCallLinkage linkage) {
-        super("newInstance", options, providers, linkage);
-    }
-
-    @Override
-    protected Object[] makeConstArgs() {
-        int count = method.getSignature().getParameterCount(false);
-        Object[] args = new Object[count];
-        assert checkConstArg(1, "threadRegister");
-        assert checkConstArg(2, "options");
-        args[1] = providers.getRegisters().getThreadRegister();
-        args[2] = options;
-        return args;
-    }
-
-    @Fold
-    static boolean logging(OptionValues options) {
-        return StubOptions.TraceNewInstanceStub.getValue(options);
-    }
-
-    /**
-     * Re-attempts allocation after an initial TLAB allocation failed or was skipped (e.g., due to
-     * -XX:-UseTLAB).
-     *
-     * @param hub the hub of the object to be allocated
-     */
-    @Snippet
-    private static Object newInstance(KlassPointer hub, @ConstantParameter Register threadRegister, @ConstantParameter OptionValues options) {
-        /*
-         * The type is known to be an instance so Klass::_layout_helper is the instance size as a
-         * raw number
-         */
-        Word thread = registerAsWord(threadRegister);
-        if (logging(options)) {
-            printf("newInstance: calling new_instance_c\n");
-        }
-
-        newInstanceC(NEW_INSTANCE_C, thread, hub);
-        handlePendingException(thread, true, true);
-        return verifyObject(getAndClearObjectResult(thread));
-    }
-
-    @Fold
-    static boolean forceSlowPath(OptionValues options) {
-        return StubOptions.ForceUseOfNewInstanceStub.getValue(options);
-    }
-
-    public static final ForeignCallDescriptor NEW_INSTANCE_C = newDescriptor(NewInstanceStub.class, "newInstanceC", void.class, Word.class, KlassPointer.class);
-
-    @NodeIntrinsic(StubForeignCallNode.class)
-    public static native void newInstanceC(@ConstantNodeParameter ForeignCallDescriptor newInstanceC, Word thread, KlassPointer hub);
-}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java	Tue Sep 18 16:41:24 2018 -0700
@@ -107,9 +107,15 @@
         plugins.prependParameterPlugin(new ConstantBindingParameterPlugin(makeConstArgs(), metaAccess, snippetReflection));
         GraphBuilderConfiguration config = GraphBuilderConfiguration.getSnippetDefault(plugins);
 
+        // @formatter:off
         // Stubs cannot have optimistic assumptions since they have
         // to be valid for the entire run of the VM.
-        final StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).compilationId(compilationId).build();
+        final StructuredGraph graph = new StructuredGraph.Builder(options, debug).
+                        method(method).
+                        compilationId(compilationId).
+                        setIsSubstitution(true).
+                        build();
+        // @formatter:on
         try (DebugContext.Scope outer = debug.scope("SnippetStub", graph)) {
             graph.disableUnsafeAccessTracking();
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubOptions.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubOptions.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,8 +25,8 @@
 package org.graalvm.compiler.hotspot.stubs;
 
 import org.graalvm.compiler.options.Option;
+import org.graalvm.compiler.options.OptionKey;
 import org.graalvm.compiler.options.OptionType;
-import org.graalvm.compiler.options.OptionKey;
 
 //JaCoCo Exclude
 
@@ -43,14 +43,5 @@
 
     @Option(help = "Trace execution of the stub that routes an exception to a handler in the calling frame.", type = OptionType.Debug)
     static final OptionKey<Boolean> TraceUnwindStub = new OptionKey<>(false);
-
-    @Option(help = "Trace execution of slow path stub for array allocation.", type = OptionType.Debug)
-    static final OptionKey<Boolean> TraceNewArrayStub = new OptionKey<>(false);
-
-    @Option(help = "Trace execution of slow path stub for non-array object allocation.", type = OptionType.Debug)
-    static final OptionKey<Boolean> TraceNewInstanceStub = new OptionKey<>(false);
-
-    @Option(help = "Force non-array object allocation to always use the slow path.", type = OptionType.Debug)
-    static final OptionKey<Boolean> ForceUseOfNewInstanceStub = new OptionKey<>(false);
     //@formatter:on
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java	Tue Sep 18 16:41:24 2018 -0700
@@ -26,6 +26,7 @@
 
 import static org.graalvm.compiler.bytecode.Bytecodes.AALOAD;
 import static org.graalvm.compiler.bytecode.Bytecodes.AASTORE;
+import static org.graalvm.compiler.bytecode.Bytecodes.ANEWARRAY;
 import static org.graalvm.compiler.bytecode.Bytecodes.ARETURN;
 import static org.graalvm.compiler.bytecode.Bytecodes.ARRAYLENGTH;
 import static org.graalvm.compiler.bytecode.Bytecodes.ATHROW;
@@ -78,6 +79,8 @@
 import static org.graalvm.compiler.bytecode.Bytecodes.LOOKUPSWITCH;
 import static org.graalvm.compiler.bytecode.Bytecodes.LREM;
 import static org.graalvm.compiler.bytecode.Bytecodes.LRETURN;
+import static org.graalvm.compiler.bytecode.Bytecodes.MULTIANEWARRAY;
+import static org.graalvm.compiler.bytecode.Bytecodes.NEW;
 import static org.graalvm.compiler.bytecode.Bytecodes.PUTFIELD;
 import static org.graalvm.compiler.bytecode.Bytecodes.PUTSTATIC;
 import static org.graalvm.compiler.bytecode.Bytecodes.RET;
@@ -679,10 +682,19 @@
                 case SALOAD:
                 case ARRAYLENGTH:
                 case CHECKCAST:
+                case NEW:
+                case ANEWARRAY:
+                case MULTIANEWARRAY:
                 case PUTSTATIC:
                 case GETSTATIC:
                 case PUTFIELD:
                 case GETFIELD: {
+                    /*
+                     * All bytecodes that can trigger lazy class initialization via a
+                     * ClassInitializationPlugin (allocations, static field access) must be listed
+                     * because the class initializer is allowed to throw an exception, which
+                     * requires proper exception handling.
+                     */
                     ExceptionDispatchBlock handler = handleExceptions(blockMap, bci);
                     if (handler != null) {
                         current = null;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java	Tue Sep 18 16:41:24 2018 -0700
@@ -3369,29 +3369,25 @@
 
             NodeSourcePosition currentPosition = graph.currentNodeSourcePosition();
             if (isNeverExecutedCode(probability)) {
-                if (!graph.isOSR() || getParent() != null || graph.getEntryBCI() != trueBlock.startBci) {
-                    NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition()
-                                    ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), falseBlock.startBci)
-                                    : null;
-                    append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, true, survivingSuccessorPosition));
-                    if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
-                        profilingPlugin.profileGoto(this, method, bci(), falseBlock.startBci, stateBefore);
-                    }
-                    appendGoto(falseBlock);
-                    return;
+                NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition()
+                                ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), falseBlock.startBci)
+                                : null;
+                append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, true, survivingSuccessorPosition));
+                if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
+                    profilingPlugin.profileGoto(this, method, bci(), falseBlock.startBci, stateBefore);
                 }
+                appendGoto(falseBlock);
+                return;
             } else if (isNeverExecutedCode(1 - probability)) {
-                if (!graph.isOSR() || getParent() != null || graph.getEntryBCI() != falseBlock.startBci) {
-                    NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition()
-                                    ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), trueBlock.startBci)
-                                    : null;
-                    append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, false, survivingSuccessorPosition));
-                    if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
-                        profilingPlugin.profileGoto(this, method, bci(), trueBlock.startBci, stateBefore);
-                    }
-                    appendGoto(trueBlock);
-                    return;
+                NodeSourcePosition survivingSuccessorPosition = graph.trackNodeSourcePosition()
+                                ? new NodeSourcePosition(currentPosition.getCaller(), currentPosition.getMethod(), trueBlock.startBci)
+                                : null;
+                append(new FixedGuardNode(condition, UnreachedCode, InvalidateReprofile, false, survivingSuccessorPosition));
+                if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
+                    profilingPlugin.profileGoto(this, method, bci(), trueBlock.startBci, stateBefore);
                 }
+                appendGoto(trueBlock);
+                return;
             }
 
             if (profilingPlugin != null && profilingPlugin.shouldProfile(this, method)) {
@@ -4116,6 +4112,11 @@
             return;
         }
         ResolvedJavaType resolvedType = (ResolvedJavaType) type;
+        if (resolvedType.isAbstract() || resolvedType.isInterface()) {
+            handleUnresolvedNewInstance(type);
+            return;
+        }
+
         ClassInitializationPlugin classInitializationPlugin = graphBuilderConfig.getPlugins().getClassInitializationPlugin();
         if (!resolvedType.isInitialized() && classInitializationPlugin == null) {
             handleUnresolvedNewInstance(type);
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java	Tue Sep 18 16:41:24 2018 -0700
@@ -436,7 +436,12 @@
     @SuppressWarnings("try")
     public static boolean verifyEncoding(StructuredGraph originalGraph, EncodedGraph encodedGraph, Architecture architecture) {
         DebugContext debug = originalGraph.getDebug();
-        StructuredGraph decodedGraph = new StructuredGraph.Builder(originalGraph.getOptions(), debug, AllowAssumptions.YES).method(originalGraph.method()).build();
+        // @formatter:off
+        StructuredGraph decodedGraph = new StructuredGraph.Builder(originalGraph.getOptions(), debug, AllowAssumptions.YES).
+                        method(originalGraph.method()).
+                        setIsSubstitution(originalGraph.isSubstitution()).
+                        build();
+        // @formatter:off
         if (originalGraph.trackNodeSourcePosition()) {
             decodedGraph.setTrackNodeSourcePosition();
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java	Tue Sep 18 16:41:24 2018 -0700
@@ -40,6 +40,8 @@
 import jdk.internal.vm.compiler.collections.EconomicSet;
 import jdk.internal.vm.compiler.collections.Equivalence;
 import jdk.internal.vm.compiler.collections.UnmodifiableEconomicMap;
+import org.graalvm.compiler.api.replacements.MethodSubstitution;
+import org.graalvm.compiler.api.replacements.Snippet;
 import org.graalvm.compiler.core.common.CancellationBailoutException;
 import org.graalvm.compiler.core.common.CompilationIdentifier;
 import org.graalvm.compiler.core.common.GraalOptions;
@@ -187,6 +189,7 @@
         private Cancellable cancellable = null;
         private final DebugContext debug;
         private NodeSourcePosition callerContext;
+        private boolean isSubstitution;
 
         /**
          * Creates a builder for a graph.
@@ -217,6 +220,14 @@
             return this;
         }
 
+        /**
+         * @see StructuredGraph#isSubstitution
+         */
+        public Builder setIsSubstitution(boolean flag) {
+            this.isSubstitution = flag;
+            return this;
+        }
+
         public ResolvedJavaMethod getMethod() {
             return rootMethod;
         }
@@ -303,8 +314,22 @@
 
         public StructuredGraph build() {
             List<ResolvedJavaMethod> inlinedMethods = recordInlinedMethods ? new ArrayList<>() : null;
-            return new StructuredGraph(name, rootMethod, entryBCI, assumptions, speculationLog, useProfilingInfo, inlinedMethods,
-                            trackNodeSourcePosition, compilationId, options, debug, cancellable, callerContext);
+            // @formatter:off
+            return new StructuredGraph(name,
+                            rootMethod,
+                            entryBCI,
+                            assumptions,
+                            speculationLog,
+                            useProfilingInfo,
+                            isSubstitution,
+                            inlinedMethods,
+                            trackNodeSourcePosition,
+                            compilationId,
+                            options,
+                            debug,
+                            cancellable,
+                            callerContext);
+            // @formatter:on
         }
     }
 
@@ -323,6 +348,8 @@
     private boolean isAfterExpandLogic = false;
     private final boolean useProfilingInfo;
     private final Cancellable cancellable;
+    private final boolean isSubstitution;
+
     /**
      * The assumptions made while constructing and transforming this graph.
      */
@@ -369,6 +396,7 @@
                     Assumptions assumptions,
                     SpeculationLog speculationLog,
                     boolean useProfilingInfo,
+                    boolean isSubstitution,
                     List<ResolvedJavaMethod> methods,
                     SourcePositionTracking trackNodeSourcePosition,
                     CompilationIdentifier compilationId,
@@ -386,6 +414,8 @@
         this.methods = methods;
         this.speculationLog = speculationLog;
         this.useProfilingInfo = useProfilingInfo;
+        this.isSubstitution = isSubstitution;
+        assert checkIsSubstitutionInvariants(method, isSubstitution);
         this.trackNodeSourcePosition = trackNodeSourcePosition;
         assert trackNodeSourcePosition != null;
         this.cancellable = cancellable;
@@ -393,6 +423,18 @@
         this.callerContext = context;
     }
 
+    private static boolean checkIsSubstitutionInvariants(ResolvedJavaMethod method, boolean isSubstitution) {
+        if (method != null) {
+            if (method.getAnnotation(Snippet.class) != null || method.getAnnotation(MethodSubstitution.class) != null) {
+                assert isSubstitution : "Graph for method " + method.format("%H.%n(%p)") +
+                                " annotated by " + Snippet.class.getName() + " or " +
+                                MethodSubstitution.class.getName() +
+                                " must have its `isSubstitution` field set to true";
+            }
+        }
+        return true;
+    }
+
     public void setLastSchedule(ScheduleResult result) {
         lastSchedule = result;
     }
@@ -535,6 +577,7 @@
                         assumptions == null ? null : new Assumptions(),
                         speculationLog,
                         useProfilingInfo,
+                        isSubstitution,
                         methods != null ? new ArrayList<>(methods) : null,
                         trackNodeSourcePosition,
                         newCompilationId,
@@ -859,6 +902,15 @@
     }
 
     /**
+     * Returns true if this graph is built without parsing the {@linkplain #method() root method} or
+     * if the root method is annotated by {@link Snippet} or {@link MethodSubstitution}. This is
+     * preferred over querying annotations directly as querying annotations can cause class loading.
+     */
+    public boolean isSubstitution() {
+        return isSubstitution;
+    }
+
+    /**
      * Gets the profiling info for the {@linkplain #method() root method} of this graph.
      */
     public ProfilingInfo getProfilingInfo() {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/InstanceOfNode.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/InstanceOfNode.java	Tue Sep 18 16:41:24 2018 -0700
@@ -61,7 +61,7 @@
 public class InstanceOfNode extends UnaryOpLogicNode implements Lowerable, Virtualizable {
     public static final NodeClass<InstanceOfNode> TYPE = NodeClass.create(InstanceOfNode.class);
 
-    private ObjectStamp checkedStamp;
+    private final ObjectStamp checkedStamp;
 
     private JavaTypeProfile profile;
     @OptionalInput(Anchor) protected AnchoringNode anchor;
@@ -77,6 +77,7 @@
         this.anchor = anchor;
         assert (profile == null) || (anchor != null) : "profiles must be anchored";
         assert checkedStamp != null;
+        assert type() != null;
     }
 
     public static LogicNode createAllowNull(TypeReference type, ValueNode object, JavaTypeProfile profile, AnchoringNode anchor) {
@@ -217,11 +218,6 @@
         return checkedStamp;
     }
 
-    public void strengthenCheckedStamp(ObjectStamp newCheckedStamp) {
-        assert this.checkedStamp.join(newCheckedStamp).equals(newCheckedStamp) : "stamp can only improve";
-        this.checkedStamp = newCheckedStamp;
-    }
-
     @Override
     public TriState implies(boolean thisNegated, LogicNode other) {
         if (other instanceof InstanceOfNode) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java	Tue Sep 18 16:41:24 2018 -0700
@@ -60,7 +60,7 @@
 
     protected NewInstanceNode(NodeClass<? extends NewInstanceNode> c, ResolvedJavaType type, boolean fillContents, FrameState stateBefore) {
         super(c, StampFactory.objectNonNull(TypeReference.createExactTrusted(type)), fillContents, stateBefore);
-        assert !type.isArray() && !type.isInterface() && !type.isPrimitive();
+        assert !type.isArray() && !type.isInterface() && !type.isPrimitive() && !type.isAbstract();
         this.instanceClass = type;
     }
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java	Tue Sep 18 16:41:24 2018 -0700
@@ -98,7 +98,7 @@
             VirtualArrayNode virtual = (VirtualArrayNode) alias;
             if (idx >= 0 && idx < virtual.entryCount()) {
                 ResolvedJavaType componentType = virtual.type().getComponentType();
-                if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.getSuperclass() == null ||
+                if (componentType.isPrimitive() || StampTool.isPointerAlwaysNull(value) || componentType.isJavaLangObject() ||
                                 (StampTool.typeReferenceOrNull(value) != null && componentType.isAssignableFrom(StampTool.typeOrNull(value)))) {
                     tool.setVirtualEntry(virtual, idx, value());
                     tool.delete();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,7 +32,6 @@
 
 import jdk.internal.vm.compiler.collections.EconomicMap;
 import jdk.internal.vm.compiler.collections.MapCursor;
-import org.graalvm.util.CollectionsUtil;
 
 /**
  * This class contains methods for parsing Graal options and matching them against a set of
@@ -45,20 +44,21 @@
      * {@link OptionDescriptors} providers.
      */
     public static Iterable<OptionDescriptors> getOptionsLoader() {
-        ServiceLoader<OptionDescriptors> graalLoader = ServiceLoader.load(OptionDescriptors.class, OptionDescriptors.class.getClassLoader());
         boolean java8OrEarlier = System.getProperty("java.specification.version").compareTo("1.9") < 0;
+        ClassLoader loader;
         if (java8OrEarlier) {
-            return graalLoader;
+            // On JDK 8, Graal and its extensions are loaded by same class loader.
+            loader = OptionDescriptors.class.getClassLoader();
         } else {
             /*
              * The Graal module (i.e., jdk.internal.vm.compiler) is loaded by the platform class
-             * loader on JDK 9. Other modules that extend Graal or are Graal dependencies (such as
-             * Truffle) are supplied via --module-path which means they are loaded by the app class
-             * loader. As such, we need to search the app class loader path as well.
+             * loader as of JDK 9. Modules that depend on and extend Graal are loaded by the app
+             * class loader. As such, we need to start the provider search at the app class loader
+             * instead of the platform class loader.
              */
-            ServiceLoader<OptionDescriptors> truffleLoader = ServiceLoader.load(OptionDescriptors.class, ClassLoader.getSystemClassLoader());
-            return CollectionsUtil.concat(graalLoader, truffleLoader);
+            loader = ClassLoader.getSystemClassLoader();
         }
+        return ServiceLoader.load(OptionDescriptors.class, loader);
     }
 
     /**
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java	Tue Sep 18 16:41:24 2018 -0700
@@ -56,7 +56,6 @@
 import org.graalvm.compiler.nodes.AbstractMergeNode;
 import org.graalvm.compiler.nodes.BinaryOpLogicNode;
 import org.graalvm.compiler.nodes.ConditionAnchorNode;
-import org.graalvm.compiler.nodes.DeoptimizeNode;
 import org.graalvm.compiler.nodes.DeoptimizingGuard;
 import org.graalvm.compiler.nodes.EndNode;
 import org.graalvm.compiler.nodes.FixedGuardNode;
@@ -64,6 +63,7 @@
 import org.graalvm.compiler.nodes.FixedWithNextNode;
 import org.graalvm.compiler.nodes.GuardNode;
 import org.graalvm.compiler.nodes.IfNode;
+import org.graalvm.compiler.nodes.LogicConstantNode;
 import org.graalvm.compiler.nodes.LogicNode;
 import org.graalvm.compiler.nodes.LoopExitNode;
 import org.graalvm.compiler.nodes.MergeNode;
@@ -335,11 +335,18 @@
                 if (result != node.isNegated()) {
                     node.replaceAndDelete(guard.asNode());
                 } else {
-                    DeoptimizeNode deopt = node.graph().add(new DeoptimizeNode(node.getAction(), node.getReason(), node.getSpeculation()));
+                    /*
+                     * Don't kill this branch immediately because `killCFG` can have complex
+                     * implications in the presence of loops: it might replace or delete nodes in
+                     * other branches or even above the kill point. Instead of killing immediately,
+                     * just leave the graph in a state that is easy to simplify by a subsequent
+                     * canonicalizer phase.
+                     */
+                    FixedGuardNode deopt = new FixedGuardNode(LogicConstantNode.forBoolean(result, node.graph()), node.getReason(), node.getAction(), node.getSpeculation(), node.isNegated(),
+                                    node.getNodeSourcePosition());
                     AbstractBeginNode beginNode = (AbstractBeginNode) node.getAnchor();
-                    FixedNode next = beginNode.next();
-                    beginNode.setNext(deopt);
-                    GraphUtil.killCFG(next);
+                    graph.addAfterFixed(beginNode, node.graph().add(deopt));
+
                 }
                 return true;
             })) {
@@ -354,10 +361,8 @@
                     GraphUtil.unlinkFixedNode(node);
                     GraphUtil.killWithUnusedFloatingInputs(node);
                 } else {
-                    DeoptimizeNode deopt = node.graph().add(new DeoptimizeNode(node.getAction(), node.getReason(), node.getSpeculation()));
-                    deopt.setStateBefore(node.stateBefore());
-                    node.replaceAtPredecessor(deopt);
-                    GraphUtil.killCFG(node);
+                    node.setCondition(LogicConstantNode.forBoolean(result, node.graph()), node.isNegated());
+                    // Don't kill this branch immediately, see `processGuard`.
                 }
                 debug.log("Kill fixed guard guard");
                 return true;
@@ -368,11 +373,10 @@
 
         protected void processIf(IfNode node) {
             tryProveCondition(node.condition(), (guard, result, guardedValueStamp, newInput) -> {
+                node.setCondition(LogicConstantNode.forBoolean(result, node.graph()));
                 AbstractBeginNode survivingSuccessor = node.getSuccessor(result);
                 survivingSuccessor.replaceAtUsages(InputType.Guard, guard.asNode());
-                survivingSuccessor.replaceAtPredecessor(null);
-                node.replaceAtPredecessor(survivingSuccessor);
-                GraphUtil.killCFG(node);
+                // Don't kill the other branch immediately, see `processGuard`.
                 counterIfsKilled.increment(debug);
                 return true;
             });
@@ -524,8 +528,7 @@
                                     if (input == null) {
                                         input = valueAt;
                                     }
-                                    ValueNode valueNode = graph.maybeAddOrUnique(PiNode.create(input, curBestStamp, (ValueNode) infoElement.guard));
-                                    valueAt = valueNode;
+                                    valueAt = graph.maybeAddOrUnique(PiNode.create(input, curBestStamp, (ValueNode) infoElement.guard));
                                 }
                                 newPhi.addInput(valueAt);
                             }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java	Tue Sep 18 16:41:24 2018 -0700
@@ -41,7 +41,6 @@
 import jdk.internal.vm.compiler.collections.UnmodifiableEconomicMap;
 import jdk.internal.vm.compiler.collections.UnmodifiableMapCursor;
 import org.graalvm.compiler.api.replacements.MethodSubstitution;
-import org.graalvm.compiler.api.replacements.Snippet;
 import org.graalvm.compiler.core.common.GraalOptions;
 import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.core.common.type.StampFactory;
@@ -674,12 +673,12 @@
     @SuppressWarnings("try")
     private static void updateSourcePositions(Invoke invoke, StructuredGraph inlineGraph, UnmodifiableEconomicMap<Node, Node> duplicates, boolean isSub, Mark mark) {
         FixedNode invokeNode = invoke.asNode();
-        boolean isSubstitution = isSub || inlineGraph.method().getAnnotation(MethodSubstitution.class) != null || inlineGraph.method().getAnnotation(Snippet.class) != null;
         StructuredGraph invokeGraph = invokeNode.graph();
-        assert !invokeGraph.trackNodeSourcePosition() || inlineGraph.trackNodeSourcePosition() ||
-                        isSubstitution : String.format("trackNodeSourcePosition mismatch %s %s != %s %s", invokeGraph, invokeGraph.trackNodeSourcePosition(), inlineGraph,
-                                        inlineGraph.trackNodeSourcePosition());
         if (invokeGraph.trackNodeSourcePosition() && invoke.stateAfter() != null) {
+            boolean isSubstitution = isSub || inlineGraph.isSubstitution();
+            assert !invokeGraph.trackNodeSourcePosition() || inlineGraph.trackNodeSourcePosition() ||
+                            isSubstitution : String.format("trackNodeSourcePosition mismatch %s %s != %s %s", invokeGraph, invokeGraph.trackNodeSourcePosition(), inlineGraph,
+                                            inlineGraph.trackNodeSourcePosition());
             final NodeSourcePosition invokePos = invoke.asNode().getNodeSourcePosition();
             updateSourcePosition(invokeGraph, duplicates, mark, invokePos, isSubstitution);
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/jmx/HotSpotMBeanOperationProvider.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.graalvm.compiler.phases.common.jmx;
+
+import java.util.Collection;
+
+public interface HotSpotMBeanOperationProvider {
+    <T> void registerOperations(Class<T> clazz, Collection<? super T> ops);
+
+    Object invoke(String actionName, Object[] params, String[] signature);
+}
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/PhaseContext.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/PhaseContext.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,6 +32,7 @@
 
 import jdk.vm.ci.meta.ConstantReflectionProvider;
 import jdk.vm.ci.meta.MetaAccessProvider;
+import org.graalvm.compiler.core.common.spi.ForeignCallsProvider;
 
 public class PhaseContext {
 
@@ -41,19 +42,22 @@
     private final LoweringProvider lowerer;
     private final Replacements replacements;
     private final StampProvider stampProvider;
+    private final ForeignCallsProvider foreignCalls;
 
     public PhaseContext(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, ConstantFieldProvider constantFieldProvider, LoweringProvider lowerer, Replacements replacements,
-                    StampProvider stampProvider) {
+                    StampProvider stampProvider, ForeignCallsProvider foreignCalls) {
         this.metaAccess = metaAccess;
         this.constantReflection = constantReflection;
         this.constantFieldProvider = constantFieldProvider;
         this.lowerer = lowerer;
         this.replacements = replacements;
         this.stampProvider = stampProvider;
+        this.foreignCalls = foreignCalls;
     }
 
     public PhaseContext(Providers providers) {
-        this(providers.getMetaAccess(), providers.getConstantReflection(), providers.getConstantFieldProvider(), providers.getLowerer(), providers.getReplacements(), providers.getStampProvider());
+        this(providers.getMetaAccess(), providers.getConstantReflection(), providers.getConstantFieldProvider(), providers.getLowerer(), providers.getReplacements(), providers.getStampProvider(),
+                        providers.getForeignCalls());
     }
 
     public MetaAccessProvider getMetaAccess() {
@@ -80,4 +84,7 @@
         return stampProvider;
     }
 
+    public ForeignCallsProvider getForeignCalls() {
+        return foreignCalls;
+    }
 }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -140,7 +140,7 @@
             CachingPEGraphDecoder decoder = new CachingPEGraphDecoder(getTarget().arch, targetGraph, getProviders(), graphBuilderConfig, OptimisticOptimizations.NONE, AllowAssumptions.YES,
                             null, null, new InlineInvokePlugin[]{new InlineAll()}, null, null, null, null);
 
-            decoder.decode(testMethod, false);
+            decoder.decode(testMethod, false, false);
             debug.dump(DebugContext.BASIC_LEVEL, targetGraph, "Target Graph");
             targetGraph.verify();
 
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java	Tue Sep 18 16:41:24 2018 -0700
@@ -83,9 +83,15 @@
     }
 
     @SuppressWarnings("try")
-    private EncodedGraph createGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider) {
-        StructuredGraph graphToEncode = new StructuredGraph.Builder(options, debug, allowAssumptions).useProfilingInfo(false).trackNodeSourcePosition(
-                        graphBuilderConfig.trackNodeSourcePosition()).method(method).build();
+    private EncodedGraph createGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution) {
+        // @formatter:off
+        StructuredGraph graphToEncode = new StructuredGraph.Builder(options, debug, allowAssumptions).
+                        useProfilingInfo(false).
+                        trackNodeSourcePosition(graphBuilderConfig.trackNodeSourcePosition()).
+                        method(method).
+                        setIsSubstitution(isSubstitution).
+                        build();
+        // @formatter:on
         try (DebugContext.Scope scope = debug.scope("createGraph", graphToEncode)) {
             IntrinsicContext initialIntrinsicContext = intrinsicBytecodeProvider != null ? new IntrinsicContext(originalMethod, method, intrinsicBytecodeProvider, INLINE_AFTER_PARSING) : null;
             GraphBuilderPhase.Instance graphBuilderPhaseInstance = createGraphBuilderPhaseInstance(initialIntrinsicContext);
@@ -110,10 +116,11 @@
     }
 
     @Override
-    protected EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean trackNodeSourcePosition) {
+    protected EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution,
+                    boolean trackNodeSourcePosition) {
         EncodedGraph result = graphCache.get(method);
         if (result == null && method.hasBytecodes()) {
-            result = createGraph(method, originalMethod, intrinsicBytecodeProvider);
+            result = createGraph(method, originalMethod, intrinsicBytecodeProvider, isSubstitution);
         }
         return result;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java	Tue Sep 18 16:41:24 2018 -0700
@@ -94,7 +94,7 @@
         this.stampProvider = stampProvider;
         this.code = code;
         this.method = code.getMethod();
-        this.graph = new StructuredGraph.Builder(options, debug, allowAssumptions).method(method).build();
+        this.graph = new StructuredGraph.Builder(options, debug, allowAssumptions).method(method).setIsSubstitution(true).build();
         this.graph.setTrackNodeSourcePosition();
         this.invokeBci = invokeBci;
         this.lastInstr = graph.start();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Tue Sep 18 16:41:24 2018 -0700
@@ -551,8 +551,8 @@
         }
     }
 
-    public void decode(ResolvedJavaMethod method, boolean trackNodeSourcePosition) {
-        PEMethodScope methodScope = new PEMethodScope(graph, null, null, lookupEncodedGraph(method, null, null, trackNodeSourcePosition), method, null, 0, loopExplosionPlugin, null);
+    public void decode(ResolvedJavaMethod method, boolean isSubstitution, boolean trackNodeSourcePosition) {
+        PEMethodScope methodScope = new PEMethodScope(graph, null, null, lookupEncodedGraph(method, null, null, isSubstitution, trackNodeSourcePosition), method, null, 0, loopExplosionPlugin, null);
         decode(createInitialLoopScope(methodScope, null));
         cleanupGraph(methodScope);
 
@@ -783,7 +783,9 @@
             return null;
         }
         ResolvedJavaMethod inlineMethod = inlineInfo.getMethodToInline();
-        EncodedGraph graphToInline = lookupEncodedGraph(inlineMethod, inlineInfo.getOriginalMethod(), inlineInfo.getIntrinsicBytecodeProvider(), graph.trackNodeSourcePosition());
+        ResolvedJavaMethod originalMethod = inlineInfo.getOriginalMethod();
+        boolean isSubstitution = originalMethod != null && !originalMethod.equals(inlineMethod);
+        EncodedGraph graphToInline = lookupEncodedGraph(inlineMethod, originalMethod, inlineInfo.getIntrinsicBytecodeProvider(), isSubstitution, graph.trackNodeSourcePosition());
         if (graphToInline == null) {
             return null;
         }
@@ -1052,7 +1054,8 @@
         }
     }
 
-    protected abstract EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean trackNodeSourcePosition);
+    protected abstract EncodedGraph lookupEncodedGraph(ResolvedJavaMethod method, ResolvedJavaMethod originalMethod, BytecodeProvider intrinsicBytecodeProvider, boolean isSubstitution,
+                    boolean trackNodeSourcePosition);
 
     @Override
     protected void handleFixedNode(MethodScope s, LoopScope loopScope, int nodeOrderId, FixedNode node) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java	Tue Sep 18 16:41:24 2018 -0700
@@ -429,10 +429,16 @@
         @SuppressWarnings("try")
         protected StructuredGraph buildInitialGraph(DebugContext debug, BytecodeProvider bytecodeProvider, final ResolvedJavaMethod methodToParse, Object[] args, boolean trackNodeSourcePosition,
                         NodeSourcePosition replaceePosition) {
+            // @formatter:off
             // Replacements cannot have optimistic assumptions since they have
             // to be valid for the entire run of the VM.
-            final StructuredGraph graph = new StructuredGraph.Builder(replacements.options, debug).method(methodToParse).trackNodeSourcePosition(trackNodeSourcePosition).callerContext(
-                            replaceePosition).build();
+            final StructuredGraph graph = new StructuredGraph.Builder(replacements.options, debug).
+                            method(methodToParse).
+                            trackNodeSourcePosition(trackNodeSourcePosition).
+                            callerContext(replaceePosition).
+                            setIsSubstitution(true).
+                            build();
+            // @formatter:on
 
             // Replacements are not user code so they do not participate in unsafe access
             // tracking
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java	Tue Sep 18 16:41:24 2018 -0700
@@ -723,7 +723,7 @@
 
         // Copy snippet graph, replacing constant parameters with given arguments
         final StructuredGraph snippetCopy = new StructuredGraph.Builder(options, debug).name(snippetGraph.name).method(snippetGraph.method()).trackNodeSourcePosition(
-                        snippetGraph.trackNodeSourcePosition()).build();
+                        snippetGraph.trackNodeSourcePosition()).setIsSubstitution(true).build();
         assert !GraalOptions.TrackNodeSourcePosition.getValue(options) || snippetCopy.trackNodeSourcePosition();
         if (providers.getCodeCache() != null && providers.getCodeCache().shouldDebugNonSafepoints()) {
             snippetCopy.setTrackNodeSourcePosition();
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java	Tue Sep 18 16:41:24 2018 -0700
@@ -155,7 +155,7 @@
     @SuppressWarnings("try")
     protected StructuredGraph lowerReplacement(final StructuredGraph replacementGraph, LoweringTool tool) {
         final PhaseContext c = new PhaseContext(tool.getMetaAccess(), tool.getConstantReflection(), tool.getConstantFieldProvider(), tool.getLowerer(), tool.getReplacements(),
-                        tool.getStampProvider());
+                        tool.getStampProvider(), null);
         if (!graph().hasValueProxies()) {
             new RemoveValueProxyPhase().apply(replacementGraph);
         }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java	Tue Sep 18 16:41:24 2018 -0700
@@ -211,9 +211,9 @@
          * <p>
          * Both GraphOutput (the {@code parent} and the returned one) has to be used in
          * synchronization - e.g. only one
-         * {@link #beginGroup(java.lang.Object, java.lang.String, java.lang.String, java.lang.Object, int, java.util.Map)
-         * begin}, {@link #endGroup() end} of group or
-         * {@link #print(java.lang.Object, java.util.Map, int, java.lang.String, java.lang.Object...)
+         * {@link GraphOutput#beginGroup(java.lang.Object, java.lang.String, java.lang.String, java.lang.Object, int, java.util.Map)
+         * begin}, {@link GraphOutput#endGroup() end} of group or
+         * {@link GraphOutput#print(java.lang.Object, java.util.Map, int, java.lang.String, java.lang.Object...)
          * printing} can be on at a given moment.
          *
          * @param parent the output to inherit {@code channel} and protocol version from
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Tue Sep 18 16:41:24 2018 -0700
@@ -132,24 +132,18 @@
         } else {
             label = item.l;
         }
-        $li = $("<li/>").appendTo(ul);
+        var li = $("<li/>").appendTo(ul);
         if (item.category === catSearchTags) {
             if (item.d) {
-                $("<a/>").attr("href", "#")
-                        .html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span><br><span class=\"searchTagDescResult\">"
-                                + item.d + "</span><br>")
-                        .appendTo($li);
+                li.html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span><br><span class=\"searchTagDescResult\">"
+                                + item.d + "</span><br>");
             } else {
-                $("<a/>").attr("href", "#")
-                        .html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span>")
-                        .appendTo($li);
+                li.html(label + "<span class=\"searchTagHolderResult\"> (" + item.h + ")</span>");
             }
         } else {
-            $("<a/>").attr("href", "#")
-                    .html(label)
-                    .appendTo($li);
+            li.html(label);
         }
-        return $li;
+        return li;
     }
 });
 $(function() {
@@ -328,6 +322,7 @@
                 } else {
                     window.location.href = pathtoroot + url;
                 }
+                $("#search").focus();
             }
         }
     });
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Tue Sep 18 16:41:24 2018 -0700
@@ -325,9 +325,6 @@
                 }
             } else {
                 jf = new JarFile(f, false, ZipFile.OPEN_READ, version);
-                if (!jf.isMultiRelease()) {
-                    throw new MultiReleaseException("err.multirelease.option.exists", f.getName());
-                }
             }
             return jf;
         }
--- a/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.jshell/share/classes/jdk/jshell/CompletenessAnalyzer.java	Tue Sep 18 16:41:24 2018 -0700
@@ -31,6 +31,7 @@
 import com.sun.tools.javac.parser.Tokens.Token;
 import com.sun.tools.javac.parser.Tokens.TokenKind;
 import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.DiagnosticSource;
 import com.sun.tools.javac.util.JCDiagnostic;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -121,6 +122,7 @@
 
         private CaLog(Context context, PrintWriter pw) {
             super(context, pw);
+            this.source = DiagnosticSource.NO_SOURCE;
         }
 
         @Override
--- a/src/jdk.jshell/share/classes/jdk/jshell/MaskCommentsAndModifiers.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.jshell/share/classes/jdk/jshell/MaskCommentsAndModifiers.java	Tue Sep 18 16:41:24 2018 -0700
@@ -67,7 +67,7 @@
     private boolean maskModifiers;
 
     // Does the string end with an unclosed '/*' style comment?
-    private boolean openComment = false;
+    private boolean openToken = false;
 
     MaskCommentsAndModifiers(String s, boolean maskModifiers) {
         this.str = s;
@@ -88,8 +88,8 @@
         return sbMask.toString();
     }
 
-    boolean endsWithOpenComment() {
-        return openComment;
+    boolean endsWithOpenToken() {
+        return openToken;
     }
 
     /****** private implementation methods ******/
@@ -142,7 +142,7 @@
     private void next() {
         switch (c) {
             case '\'':
-            case '"':
+            case '"': {
                 maskModifiers = false;
                 write(c);
                 int match = c;
@@ -154,6 +154,38 @@
                 }
                 write(c); // write match // line-end
                 break;
+            }
+            case '`': { // RawString
+                maskModifiers = false;
+                int backtickCount = 0;
+                do {
+                    write(c);
+                    ++backtickCount;
+                    read();
+                } while (c == '`');
+                while (true) {
+                    if (c == '`') {
+                        int cnt = 0;
+                        do {
+                            write(c);
+                            ++cnt;
+                            read();
+                        } while (c == '`');
+                        if (cnt == backtickCount) {
+                            unread();
+                            break;
+                        }
+                    } else {
+                        write(c);
+                        if (c < 0) {
+                            openToken = true;
+                            break;
+                        }
+                        read();
+                    }
+                }
+                break;
+            }
             case '/':
                 read();
                 switch (c) {
@@ -166,7 +198,7 @@
                             prevc = c;
                         }
                         writeMask(c);
-                        openComment = c < 0;
+                        openToken = c < 0;
                         break;
                     case '/':
                         writeMask('/');
--- a/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.jshell/share/classes/jdk/jshell/SourceCodeAnalysisImpl.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,7 +25,6 @@
 
 package jdk.jshell;
 
-import jdk.jshell.SourceCodeAnalysis.Completeness;
 import com.sun.source.tree.AssignmentTree;
 import com.sun.source.tree.ClassTree;
 import com.sun.source.tree.CompilationUnitTree;
@@ -170,7 +169,7 @@
     @Override
     public CompletionInfo analyzeCompletion(String srcInput) {
         MaskCommentsAndModifiers mcm = new MaskCommentsAndModifiers(srcInput, false);
-        if (mcm.endsWithOpenComment()) {
+        if (mcm.endsWithOpenToken()) {
             proc.debug(DBG_COMPA, "Incomplete (open comment): %s\n", srcInput);
             return new CompletionInfoImpl(DEFINITELY_INCOMPLETE, null, srcInput + '\n');
         }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ByteArrayChannel.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,252 @@
+/*
+ * 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.nio.zipfs;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.NonWritableChannelException;
+import java.nio.channels.SeekableByteChannel;
+import java.util.Arrays;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+public class ByteArrayChannel implements SeekableByteChannel {
+
+    private final ReadWriteLock rwlock = new ReentrantReadWriteLock();
+    private byte buf[];
+
+    /*
+     * The current position of this channel.
+     */
+    private int pos;
+
+    /*
+     * The index that is one greater than the last valid byte in the channel.
+     */
+    private int last;
+
+    private boolean closed;
+    private boolean readonly;
+
+    /*
+     * Creates a {@code ByteArrayChannel} with size {@code sz}.
+     */
+    ByteArrayChannel(int sz, boolean readonly) {
+        this.buf = new byte[sz];
+        this.pos = this.last = 0;
+        this.readonly = readonly;
+    }
+
+    /*
+     * Creates a ByteArrayChannel with its 'pos' at 0 and its 'last' at buf's end.
+     * Note: no defensive copy of the 'buf', used directly.
+     */
+    ByteArrayChannel(byte[] buf, boolean readonly) {
+        this.buf = buf;
+        this.pos = 0;
+        this.last = buf.length;
+        this.readonly = readonly;
+    }
+
+    @Override
+    public boolean isOpen() {
+        return !closed;
+    }
+
+    @Override
+    public long position() throws IOException {
+        beginRead();
+        try {
+            ensureOpen();
+            return pos;
+        } finally {
+            endRead();
+        }
+    }
+
+    @Override
+    public SeekableByteChannel position(long pos) throws IOException {
+        beginWrite();
+        try {
+            ensureOpen();
+            if (pos < 0 || pos >= Integer.MAX_VALUE)
+                throw new IllegalArgumentException("Illegal position " + pos);
+            this.pos = Math.min((int)pos, last);
+            return this;
+        } finally {
+            endWrite();
+        }
+    }
+
+    @Override
+    public int read(ByteBuffer dst) throws IOException {
+        beginWrite();
+        try {
+            ensureOpen();
+            if (pos == last)
+                return -1;
+            int n = Math.min(dst.remaining(), last - pos);
+            dst.put(buf, pos, n);
+            pos += n;
+            return n;
+        } finally {
+            endWrite();
+        }
+    }
+
+    @Override
+    public SeekableByteChannel truncate(long size) throws IOException {
+        if (readonly)
+            throw new NonWritableChannelException();
+        ensureOpen();
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public int write(ByteBuffer src) throws IOException {
+        if (readonly)
+            throw new NonWritableChannelException();
+        beginWrite();
+        try {
+            ensureOpen();
+            int n = src.remaining();
+            ensureCapacity(pos + n);
+            src.get(buf, pos, n);
+            pos += n;
+            if (pos > last) {
+                last = pos;
+            }
+            return n;
+        } finally {
+            endWrite();
+        }
+    }
+
+    @Override
+    public long size() throws IOException {
+        beginRead();
+        try {
+            ensureOpen();
+            return last;
+        } finally {
+            endRead();
+        }
+    }
+
+    @Override
+    public void close() throws IOException {
+        if (closed)
+            return;
+        beginWrite();
+        try {
+            closed = true;
+            buf = null;
+            pos = 0;
+            last = 0;
+        } finally {
+            endWrite();
+        }
+    }
+
+    /**
+     * Creates a newly allocated byte array. Its size is the current
+     * size of this channel and the valid contents of the buffer
+     * have been copied into it.
+     *
+     * @return the current contents of this channel, as a byte array.
+     */
+    public byte[] toByteArray() {
+        beginRead();
+        try {
+            // avoid copy if last == bytes.length?
+            return Arrays.copyOf(buf, last);
+        } finally {
+            endRead();
+        }
+    }
+
+    private void ensureOpen() throws IOException {
+        if (closed)
+            throw new ClosedChannelException();
+    }
+
+    private final void beginWrite() {
+        rwlock.writeLock().lock();
+    }
+
+    private final void endWrite() {
+        rwlock.writeLock().unlock();
+    }
+
+    private final void beginRead() {
+        rwlock.readLock().lock();
+    }
+
+    private final void endRead() {
+        rwlock.readLock().unlock();
+    }
+
+    private void ensureCapacity(int minCapacity) {
+        // overflow-conscious code
+        if (minCapacity - buf.length > 0) {
+            grow(minCapacity);
+        }
+    }
+
+    /**
+     * The maximum size of array to allocate.
+     * Some VMs reserve some header words in an array.
+     * Attempts to allocate larger arrays may result in
+     * OutOfMemoryError: Requested array size exceeds VM limit
+     */
+    private static final int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
+
+    /**
+     * Increases the capacity to ensure that it can hold at least the
+     * number of elements specified by the minimum capacity argument.
+     *
+     * @param minCapacity the desired minimum capacity
+     */
+    private void grow(int minCapacity) {
+        // overflow-conscious code
+        int oldCapacity = buf.length;
+        int newCapacity = oldCapacity << 1;
+        if (newCapacity - minCapacity < 0)
+            newCapacity = minCapacity;
+        if (newCapacity - MAX_ARRAY_SIZE > 0)
+            newCapacity = hugeCapacity(minCapacity);
+        buf = Arrays.copyOf(buf, newCapacity);
+    }
+
+    private static int hugeCapacity(int minCapacity) {
+        if (minCapacity < 0) // overflow
+            throw new OutOfMemoryError();
+        return (minCapacity > MAX_ARRAY_SIZE) ?
+            Integer.MAX_VALUE :
+            MAX_ARRAY_SIZE;
+    }
+}
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Tue Sep 18 16:41:24 2018 -0700
@@ -30,6 +30,7 @@
 import java.io.ByteArrayOutputStream;
 import java.io.EOFException;
 import java.io.File;
+import java.io.FilterOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -70,33 +71,34 @@
     private final ZipFileSystemProvider provider;
     private final Path zfpath;
     final ZipCoder zc;
+    private final ZipPath rootdir;
+    private boolean readOnly = false;    // readonly file system
+
+    // configurable by env map
     private final boolean noExtt;        // see readExtra()
-    private final ZipPath rootdir;
-    // configurable by env map
     private final boolean useTempFile;   // use a temp file for newOS, default
                                          // is to use BAOS for better performance
-    private boolean readOnly = false;    // readonly file system
     private static final boolean isWindows = AccessController.doPrivileged(
             (PrivilegedAction<Boolean>) () -> System.getProperty("os.name")
                                                     .startsWith("Windows"));
     private final boolean forceEnd64;
+    private final int defaultMethod;     // METHOD_STORED if "noCompression=true"
+                                         // METHOD_DEFLATED otherwise
 
     ZipFileSystem(ZipFileSystemProvider provider,
                   Path zfpath,
                   Map<String, ?> env)  throws IOException
     {
-        // create a new zip if not exists
-        boolean createNew = "true".equals(env.get("create"));
         // default encoding for name/comment
         String nameEncoding = env.containsKey("encoding") ?
                               (String)env.get("encoding") : "UTF-8";
         this.noExtt = "false".equals(env.get("zipinfo-time"));
-        this.useTempFile  = TRUE.equals(env.get("useTempFile"));
-        this.forceEnd64 = "true".equals(env.get("forceZIP64End"));
-        this.provider = provider;
-        this.zfpath = zfpath;
+        this.useTempFile  = isTrue(env, "useTempFile");
+        this.forceEnd64 = isTrue(env, "forceZIP64End");
+        this.defaultMethod = isTrue(env, "noCompression") ? METHOD_STORED: METHOD_DEFLATED;
         if (Files.notExists(zfpath)) {
-            if (createNew) {
+            // create a new zip if not exists
+            if (isTrue(env, "create")) {
                 try (OutputStream os = Files.newOutputStream(zfpath, CREATE_NEW, WRITE)) {
                     new END().write(os, 0, forceEnd64);
                 }
@@ -122,6 +124,13 @@
             }
             throw x;
         }
+        this.provider = provider;
+        this.zfpath = zfpath;
+    }
+
+    // returns true if there is a name=true/"true" setting in env
+    private static boolean isTrue(Map<String, ?> env, String name) {
+        return "true".equals(env.get(name)) || TRUE.equals(env.get(name));
     }
 
     @Override
@@ -254,22 +263,23 @@
         try {
             if (!isOpen)
                 return;
-            isOpen = false;             // set closed
+            isOpen = false;          // set closed
         } finally {
             endWrite();
         }
-        if (!streams.isEmpty()) {       // unlock and close all remaining streams
+        if (!streams.isEmpty()) {    // unlock and close all remaining streams
             Set<InputStream> copy = new HashSet<>(streams);
             for (InputStream is: copy)
                 is.close();
         }
-        beginWrite();                   // lock and sync
+        beginWrite();                // lock and sync
         try {
             AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
                 sync(); return null;
             });
-            ch.close();                          // close the ch just in case no update
-        } catch (PrivilegedActionException e) {  // and sync dose not close the ch
+            ch.close();              // close the ch just in case no update
+                                     // and sync didn't close the ch
+        } catch (PrivilegedActionException e) {
             throw (IOException)e.getException();
         } finally {
             endWrite();
@@ -316,8 +326,8 @@
                 IndexNode inode = getInode(path);
                 if (inode == null)
                     return null;
-                e = new Entry(inode.name, inode.isdir);  // pseudo directory
-                e.method = METHOD_STORED;                // STORED for dir
+                // pseudo directory, uses METHOD_STORED
+                e = new Entry(inode.name, inode.isdir, METHOD_STORED);
                 e.mtime = e.atime = e.ctime = zfsDefaultTimeStamp;
             }
         } finally {
@@ -425,8 +435,7 @@
             if (dir.length == 0 || exists(dir))  // root dir, or exiting dir
                 throw new FileAlreadyExistsException(getString(dir));
             checkParents(dir);
-            Entry e = new Entry(dir, Entry.NEW, true);
-            e.method = METHOD_STORED;            // STORED for dir
+            Entry e = new Entry(dir, Entry.NEW, true, METHOD_STORED);
             update(e);
         } finally {
             endWrite();
@@ -467,7 +476,7 @@
                 checkParents(dst);
             }
             Entry u = new Entry(eSrc, Entry.COPY);  // copy eSrc entry
-            u.name(dst);                              // change name
+            u.name(dst);                            // change name
             if (eSrc.type == Entry.NEW || eSrc.type == Entry.FILECH)
             {
                 u.type = eSrc.type;    // make it the same type
@@ -527,7 +536,7 @@
                 if (hasAppend) {
                     InputStream is = getInputStream(e);
                     OutputStream os = getOutputStream(new Entry(e, Entry.NEW));
-                    copyStream(is, os);
+                    is.transferTo(os);
                     is.close();
                     return os;
                 }
@@ -536,7 +545,7 @@
                 if (!hasCreate && !hasCreateNew)
                     throw new NoSuchFileException(getString(path));
                 checkParents(path);
-                return getOutputStream(new Entry(path, Entry.NEW, false));
+                return getOutputStream(new Entry(path, Entry.NEW, false, defaultMethod));
             }
         } finally {
             endRead();
@@ -572,6 +581,37 @@
             throw new IllegalArgumentException("APPEND + TRUNCATE_EXISTING not allowed");
     }
 
+
+    // Returns an output SeekableByteChannel for either
+    // (1) writing the contents of a new entry, if the entry doesn't exit, or
+    // (2) updating/replacing the contents of an existing entry.
+    // Note: The content is not compressed.
+    private class EntryOutputChannel extends ByteArrayChannel {
+        Entry e;
+
+        EntryOutputChannel(Entry e) throws IOException {
+            super(e.size > 0? (int)e.size : 8192, false);
+            this.e = e;
+            if (e.mtime == -1)
+                e.mtime = System.currentTimeMillis();
+            if (e.method == -1)
+                e.method = defaultMethod;
+            // store size, compressed size, and crc-32 in datadescriptor
+            e.flag = FLAG_DATADESCR;
+            if (zc.isUTF8())
+                e.flag |= FLAG_USE_UTF8;
+        }
+
+        @Override
+        public void close() throws IOException {
+            e.bytes = toByteArray();
+            e.size = e.bytes.length;
+            e.crc = -1;
+            super.close();
+            update(e);
+        }
+    }
+
     // Returns a Writable/ReadByteChannel for now. Might consdier to use
     // newFileChannel() instead, which dump the entry data into a regular
     // file on the default file system and create a FileChannel on top of
@@ -585,57 +625,36 @@
         if (options.contains(StandardOpenOption.WRITE) ||
             options.contains(StandardOpenOption.APPEND)) {
             checkWritable();
-            beginRead();
+            beginRead();    // only need a readlock, the "update()" will obtain
+                            // thewritelock when the channel is closed
             try {
-                final WritableByteChannel wbc = Channels.newChannel(
-                    newOutputStream(path, options.toArray(new OpenOption[0])));
-                long leftover = 0;
-                if (options.contains(StandardOpenOption.APPEND)) {
-                    Entry e = getEntry(path);
-                    if (e != null && e.size >= 0)
-                        leftover = e.size;
-                }
-                final long offset = leftover;
-                return new SeekableByteChannel() {
-                    long written = offset;
-                    public boolean isOpen() {
-                        return wbc.isOpen();
-                    }
-
-                    public long position() throws IOException {
-                        return written;
-                    }
-
-                    public SeekableByteChannel position(long pos)
-                        throws IOException
-                    {
-                        throw new UnsupportedOperationException();
+                ensureOpen();
+                Entry e = getEntry(path);
+                if (e != null) {
+                    if (e.isDir() || options.contains(CREATE_NEW))
+                        throw new FileAlreadyExistsException(getString(path));
+                    SeekableByteChannel sbc =
+                            new EntryOutputChannel(new Entry(e, Entry.NEW));
+                    if (options.contains(APPEND)) {
+                        try (InputStream is = getInputStream(e)) {  // copyover
+                            byte[] buf = new byte[8192];
+                            ByteBuffer bb = ByteBuffer.wrap(buf);
+                            int n;
+                            while ((n = is.read(buf)) != -1) {
+                                bb.position(0);
+                                bb.limit(n);
+                                sbc.write(bb);
+                            }
+                        }
                     }
-
-                    public int read(ByteBuffer dst) throws IOException {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    public SeekableByteChannel truncate(long size)
-                        throws IOException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
+                    return sbc;
+                }
+                if (!options.contains(CREATE) && !options.contains(CREATE_NEW))
+                    throw new NoSuchFileException(getString(path));
+                checkParents(path);
+                return new EntryOutputChannel(
+                    new Entry(path, Entry.NEW, false, defaultMethod));
 
-                    public int write(ByteBuffer src) throws IOException {
-                        int n = wbc.write(src);
-                        written += n;
-                        return n;
-                    }
-
-                    public long size() throws IOException {
-                        return written;
-                    }
-
-                    public void close() throws IOException {
-                        wbc.close();
-                    }
-                };
             } finally {
                 endRead();
             }
@@ -646,51 +665,10 @@
                 Entry e = getEntry(path);
                 if (e == null || e.isDir())
                     throw new NoSuchFileException(getString(path));
-                final ReadableByteChannel rbc =
-                    Channels.newChannel(getInputStream(e));
-                final long size = e.size;
-                return new SeekableByteChannel() {
-                    long read = 0;
-                    public boolean isOpen() {
-                        return rbc.isOpen();
-                    }
-
-                    public long position() throws IOException {
-                        return read;
-                    }
-
-                    public SeekableByteChannel position(long pos)
-                        throws IOException
-                    {
-                        throw new UnsupportedOperationException();
-                    }
-
-                    public int read(ByteBuffer dst) throws IOException {
-                        int n = rbc.read(dst);
-                        if (n > 0) {
-                            read += n;
-                        }
-                        return n;
-                    }
-
-                    public SeekableByteChannel truncate(long size)
-                        throws IOException
-                    {
-                        throw new NonWritableChannelException();
-                    }
-
-                    public int write (ByteBuffer src) throws IOException {
-                        throw new NonWritableChannelException();
-                    }
-
-                    public long size() throws IOException {
-                        return size;
-                    }
-
-                    public void close() throws IOException {
-                        rbc.close();
-                    }
-                };
+                try (InputStream is = getInputStream(e)) {
+                    // TBD: if (e.size < NNNNN);
+                    return new ByteArrayChannel(is.readAllBytes(), true);
+                }
             } finally {
                 endRead();
             }
@@ -846,10 +824,6 @@
     private Set<InputStream> streams =
         Collections.synchronizedSet(new HashSet<InputStream>());
 
-    // the ex-channel and ex-path that need to close when their outstanding
-    // input streams are all closed by the obtainers.
-    private Set<ExChannelCloser> exChClosers = new HashSet<>();
-
     private Set<Path> tmppaths = Collections.synchronizedSet(new HashSet<Path>());
     private Path getTempPathForEntry(byte[] path) throws IOException {
         Path tmpPath = createTempFileInSameDirectoryAs(zfpath);
@@ -1087,8 +1061,9 @@
             if (pos + CENHDR + nlen > limit) {
                 zerror("invalid CEN header (bad header size)");
             }
-            IndexNode inode = new IndexNode(cen, nlen, pos);
+            IndexNode inode = new IndexNode(cen, pos, nlen);
             inodes.put(inode, inode);
+
             // skip ext and comment
             pos += (CENHDR + nlen + elen + clen);
         }
@@ -1205,19 +1180,37 @@
         return written;
     }
 
+    private long writeEntry(Entry e, OutputStream os, byte[] buf)
+        throws IOException {
+
+        if (e.bytes == null && e.file == null)    // dir, 0-length data
+            return 0;
+
+        long written = 0;
+        try (OutputStream os2 = e.method == METHOD_STORED ?
+            new EntryOutputStreamCRC32(e, os) : new EntryOutputStreamDef(e, os)) {
+            if (e.bytes != null) {                 // in-memory
+                os2.write(e.bytes, 0, e.bytes.length);
+            } else if (e.file != null) {           // tmp file
+                if (e.type == Entry.NEW || e.type == Entry.FILECH) {
+                    try (InputStream is = Files.newInputStream(e.file)) {
+                        is.transferTo(os2);
+                    }
+                }
+                Files.delete(e.file);
+                tmppaths.remove(e.file);
+            }
+        }
+        written += e.csize;
+        if ((e.flag & FLAG_DATADESCR) != 0) {
+            written += e.writeEXT(os);
+        }
+        return written;
+    }
+
     // sync the zip file system, if there is any udpate
     private void sync() throws IOException {
-        // System.out.printf("->sync(%s) starting....!%n", toString());
-        // check ex-closer
-        if (!exChClosers.isEmpty()) {
-            for (ExChannelCloser ecc : exChClosers) {
-                if (ecc.streams.isEmpty()) {
-                    ecc.ch.close();
-                    Files.delete(ecc.path);
-                    exChClosers.remove(ecc);
-                }
-            }
-        }
+
         if (!hasUpdate)
             return;
         Path tmpFile = createTempFileInSameDirectoryAs(zfpath);
@@ -1243,34 +1236,7 @@
                         } else {                          // NEW, FILECH or CEN
                             e.locoff = written;
                             written += e.writeLOC(os);    // write loc header
-                            if (e.bytes != null) {        // in-memory, deflated
-                                os.write(e.bytes);        // already
-                                written += e.bytes.length;
-                            } else if (e.file != null) {  // tmp file
-                                try (InputStream is = Files.newInputStream(e.file)) {
-                                    int n;
-                                    if (e.type == Entry.NEW) {  // deflated already
-                                        while ((n = is.read(buf)) != -1) {
-                                            os.write(buf, 0, n);
-                                            written += n;
-                                        }
-                                    } else if (e.type == Entry.FILECH) {
-                                        // the data are not deflated, use ZEOS
-                                        try (OutputStream os2 = new EntryOutputStream(e, os)) {
-                                            while ((n = is.read(buf)) != -1) {
-                                                os2.write(buf, 0, n);
-                                            }
-                                        }
-                                        written += e.csize;
-                                        if ((e.flag & FLAG_DATADESCR) != 0)
-                                            written += e.writeEXT(os);
-                                    }
-                                }
-                                Files.delete(e.file);
-                                tmppaths.remove(e.file);
-                            } else {
-                                // dir, 0-length data
-                            }
+                            written += writeEntry(e, os, buf);
                         }
                         elist.add(e);
                     } catch (IOException x) {
@@ -1303,27 +1269,9 @@
             end.cenlen = written - end.cenoff;
             end.write(os, written, forceEnd64);
         }
-        if (!streams.isEmpty()) {
-            //
-            // TBD: ExChannelCloser should not be necessary if we only
-            // sync when being closed, all streams should have been
-            // closed already. Keep the logic here for now.
-            //
-            // There are outstanding input streams open on existing "ch",
-            // so, don't close the "cha" and delete the "file for now, let
-            // the "ex-channel-closer" to handle them
-            ExChannelCloser ecc = new ExChannelCloser(
-                                      createTempFileInSameDirectoryAs(zfpath),
-                                      ch,
-                                      streams);
-            Files.move(zfpath, ecc.path, REPLACE_EXISTING);
-            exChClosers.add(ecc);
-            streams = Collections.synchronizedSet(new HashSet<InputStream>());
-        } else {
-            ch.close();
-            Files.delete(zfpath);
-        }
 
+        ch.close();
+        Files.delete(zfpath);
         Files.move(tmpFile, zfpath, REPLACE_EXISTING);
         hasUpdate = false;    // clear
     }
@@ -1361,16 +1309,6 @@
         }
     }
 
-    private static void copyStream(InputStream is, OutputStream os)
-        throws IOException
-    {
-        byte[] copyBuf = new byte[8192];
-        int n;
-        while ((n = is.read(copyBuf)) != -1) {
-            os.write(copyBuf, 0, n);
-        }
-    }
-
     // Returns an out stream for either
     // (1) writing the contents of a new entry, if the entry exits, or
     // (2) updating/replacing the contents of the specified existing entry.
@@ -1379,9 +1317,9 @@
         if (e.mtime == -1)
             e.mtime = System.currentTimeMillis();
         if (e.method == -1)
-            e.method = METHOD_DEFLATED;  // TBD:  use default method
-        // store size, compressed size, and crc-32 in LOC header
-        e.flag = 0;
+            e.method = defaultMethod;
+        // store size, compressed size, and crc-32 in datadescr
+        e.flag = FLAG_DATADESCR;
         if (zc.isUTF8())
             e.flag |= FLAG_USE_UTF8;
         OutputStream os;
@@ -1394,16 +1332,130 @@
         return new EntryOutputStream(e, os);
     }
 
+    private class EntryOutputStream extends FilterOutputStream {
+        private Entry e;
+        private long written;
+        private boolean isClosed;
+
+        EntryOutputStream(Entry e, OutputStream os) throws IOException {
+            super(os);
+            this.e =  Objects.requireNonNull(e, "Zip entry is null");
+            // this.written = 0;
+        }
+
+        @Override
+        public synchronized void write(int b) throws IOException {
+            out.write(b);
+            written += 1;
+        }
+
+        @Override
+        public synchronized void write(byte b[], int off, int len)
+                throws IOException {
+            out.write(b, off, len);
+            written += len;
+        }
+
+        @Override
+        public synchronized void close() throws IOException {
+            if (isClosed) {
+                return;
+            }
+            isClosed = true;
+            e.size = written;
+            if (out instanceof ByteArrayOutputStream)
+                e.bytes = ((ByteArrayOutputStream)out).toByteArray();
+            super.close();
+            update(e);
+        }
+    }
+
+    // Wrapper output stream class to write out a "stored" entry.
+    // (1) this class does not close the underlying out stream when
+    //     being closed.
+    // (2) no need to be "synchronized", only used by sync()
+    private class EntryOutputStreamCRC32 extends FilterOutputStream {
+        private Entry e;
+        private CRC32 crc;
+        private long written;
+        private boolean isClosed;
+
+        EntryOutputStreamCRC32(Entry e, OutputStream os) throws IOException {
+            super(os);
+            this.e =  Objects.requireNonNull(e, "Zip entry is null");
+            this.crc = new CRC32();
+        }
+
+        @Override
+        public void write(int b) throws IOException {
+            out.write(b);
+            crc.update(b);
+            written += 1;
+        }
+
+        @Override
+        public void write(byte b[], int off, int len)
+                throws IOException {
+            out.write(b, off, len);
+            crc.update(b, off, len);
+            written += len;
+        }
+
+        @Override
+        public void close() throws IOException {
+            if (isClosed)
+                return;
+            isClosed = true;
+            e.size = e.csize = written;
+            e.size = crc.getValue();
+        }
+    }
+
+    // Wrapper output stream class to write out a "deflated" entry.
+    // (1) this class does not close the underlying out stream when
+    //     being closed.
+    // (2) no need to be "synchronized", only used by sync()
+    private class EntryOutputStreamDef extends DeflaterOutputStream {
+        private CRC32 crc;
+        private Entry e;
+        private boolean isClosed;
+
+        EntryOutputStreamDef(Entry e, OutputStream os) throws IOException {
+            super(os, getDeflater());
+            this.e =  Objects.requireNonNull(e, "Zip entry is null");
+            this.crc = new CRC32();
+        }
+
+        @Override
+        public void write(byte b[], int off, int len)
+                throws IOException {
+            super.write(b, off, len);
+            crc.update(b, off, len);
+        }
+
+        @Override
+        public void close() throws IOException {
+            if (isClosed)
+                return;
+            isClosed = true;
+            finish();
+            e.size  = def.getBytesRead();
+            e.csize = def.getBytesWritten();
+            e.crc = crc.getValue();
+        }
+    }
+
     private InputStream getInputStream(Entry e)
         throws IOException
     {
         InputStream eis = null;
 
         if (e.type == Entry.NEW) {
+            // now bytes & file is uncompressed.
             if (e.bytes != null)
-                eis = new ByteArrayInputStream(e.bytes);
+                return new ByteArrayInputStream(e.bytes);
             else if (e.file != null)
-                eis = Files.newInputStream(e.file);
+                return Files.newInputStream(e.file);
             else
                 throw new ZipException("update entry data is missing");
         } else if (e.type == Entry.FILECH) {
@@ -1569,87 +1621,6 @@
         }
     }
 
-    class EntryOutputStream extends DeflaterOutputStream
-    {
-        private CRC32 crc;
-        private Entry e;
-        private long written;
-        private boolean isClosed = false;
-
-        EntryOutputStream(Entry e, OutputStream os)
-            throws IOException
-        {
-            super(os, getDeflater());
-            if (e == null)
-                throw new NullPointerException("Zip entry is null");
-            this.e = e;
-            crc = new CRC32();
-        }
-
-        @Override
-        public synchronized void write(byte b[], int off, int len)
-            throws IOException
-        {
-            if (e.type != Entry.FILECH)    // only from sync
-                ensureOpen();
-            if (isClosed) {
-                throw new IOException("Stream closed");
-            }
-            if (off < 0 || len < 0 || off > b.length - len) {
-                throw new IndexOutOfBoundsException();
-            } else if (len == 0) {
-                return;
-            }
-            switch (e.method) {
-            case METHOD_DEFLATED:
-                super.write(b, off, len);
-                break;
-            case METHOD_STORED:
-                written += len;
-                out.write(b, off, len);
-                break;
-            default:
-                throw new ZipException("invalid compression method");
-            }
-            crc.update(b, off, len);
-        }
-
-        @Override
-        public synchronized void close() throws IOException {
-            if (isClosed) {
-                return;
-            }
-            isClosed = true;
-            // TBD ensureOpen();
-            switch (e.method) {
-            case METHOD_DEFLATED:
-                finish();
-                e.size  = def.getBytesRead();
-                e.csize = def.getBytesWritten();
-                e.crc = crc.getValue();
-                break;
-            case METHOD_STORED:
-                // we already know that both e.size and e.csize are the same
-                e.size = e.csize = written;
-                e.crc = crc.getValue();
-                break;
-            default:
-                throw new ZipException("invalid compression method");
-            }
-            //crc.reset();
-            if (out instanceof ByteArrayOutputStream)
-                e.bytes = ((ByteArrayOutputStream)out).toByteArray();
-
-            if (e.type == Entry.FILECH) {
-                releaseDeflater(def);
-                return;
-            }
-            super.close();
-            releaseDeflater(def);
-            update(e);
-        }
-    }
-
     static void zerror(String msg) throws ZipException {
         throw new ZipException(msg);
     }
@@ -1806,7 +1777,7 @@
         }
 
         // constructor for cenInit() (1) remove tailing '/' (2) pad leading '/'
-        IndexNode(byte[] cen, int nlen, int pos) {
+        IndexNode(byte[] cen, int pos, int nlen) {
             int noff = pos + CENHDR;
             if (cen[noff + nlen - 1] == '/') {
                 isdir = true;
@@ -1902,18 +1873,18 @@
 
         Entry() {}
 
-        Entry(byte[] name, boolean isdir) {
+        Entry(byte[] name, boolean isdir, int method) {
             name(name);
             this.isdir = isdir;
             this.mtime  = this.ctime = this.atime = System.currentTimeMillis();
             this.crc    = 0;
             this.size   = 0;
             this.csize  = 0;
-            this.method = METHOD_DEFLATED;
+            this.method = method;
         }
 
-        Entry(byte[] name, int type, boolean isdir) {
-            this(name, isdir);
+        Entry(byte[] name, int type, boolean isdir, int method) {
+            this(name, isdir, method);
             this.type = type;
         }
 
@@ -1941,9 +1912,8 @@
         }
 
         Entry (byte[] name, Path file, int type) {
-            this(name, type, false);
+            this(name, type, false, METHOD_STORED);
             this.file = file;
-            this.method = METHOD_STORED;
         }
 
         int version() throws ZipException {
@@ -2422,6 +2392,7 @@
         public String toString() {
             StringBuilder sb = new StringBuilder(1024);
             Formatter fm = new Formatter(sb);
+            fm.format("    name            : %s%n", new String(name));
             fm.format("    creationTime    : %tc%n", creationTime().toMillis());
             fm.format("    lastAccessTime  : %tc%n", lastAccessTime().toMillis());
             fm.format("    lastModifiedTime: %tc%n", lastModifiedTime().toMillis());
@@ -2439,20 +2410,6 @@
         }
     }
 
-    private static class ExChannelCloser  {
-        Path path;
-        SeekableByteChannel ch;
-        Set<InputStream> streams;
-        ExChannelCloser(Path path,
-                        SeekableByteChannel ch,
-                        Set<InputStream> streams)
-        {
-            this.path = path;
-            this.ch = ch;
-            this.streams = streams;
-        }
-    }
-
     // ZIP directory has two issues:
     // (1) ZIP spec does not require the ZIP file to include
     //     directory entry
--- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystemProvider.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, 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
@@ -124,9 +124,6 @@
     public FileSystem newFileSystem(Path path, Map<String, ?> env)
         throws IOException
     {
-        if (path.getFileSystem() != FileSystems.getDefault()) {
-            throw new UnsupportedOperationException();
-        }
         ensureFile(path);
          try {
              ZipFileSystem zipfs;
--- a/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -54,13 +54,16 @@
   {}
 
   virtual void main_run() {
-    uintx iterations = 0;
+    size_t iterations = 0;
+    size_t values_changed = 0;
     while (OrderAccess::load_acquire(_continue_running) != 0) {
+      { ThreadBlockInVM tbiv(this); } // Safepoint check outside critical section.
       ++iterations;
       SingleWriterSynchronizer::CriticalSection cs(_synchronizer);
       uintx value = OrderAccess::load_acquire(_synchronized_value);
+      uintx new_value = value;
       for (uint i = 0; i < reader_iterations; ++i) {
-        uintx new_value = OrderAccess::load_acquire(_synchronized_value);
+        new_value = OrderAccess::load_acquire(_synchronized_value);
         // A reader can see either the value it first read after
         // entering the critical section, or that value + 1.  No other
         // values are possible.
@@ -68,8 +71,12 @@
           ASSERT_EQ((value + 1), new_value);
         }
       }
+      if (value != new_value) {
+        ++values_changed;
+      }
     }
-    tty->print_cr("reader iterations: " UINTX_FORMAT, iterations);
+    tty->print_cr("reader iterations: " SIZE_FORMAT ", changes: " SIZE_FORMAT,
+                  iterations, values_changed);
   }
 };
 
@@ -93,13 +100,14 @@
     while (OrderAccess::load_acquire(_continue_running) != 0) {
       ++*_synchronized_value;
       _synchronizer->synchronize();
+      { ThreadBlockInVM tbiv(this); } // Safepoint check.
     }
     tty->print_cr("writer iterations: " UINTX_FORMAT, *_synchronized_value);
   }
 };
 
 const uint nreaders = 5;
-const uint milliseconds_to_run = 3000;
+const uint milliseconds_to_run = 1000;
 
 TEST_VM(TestSingleWriterSynchronizer, stress) {
   Semaphore post;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/ProblemList-Xcomp.txt	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+#############################################################################
+#
+# List of quarantined tests for testing in Xcomp mode.
+#
+#############################################################################
+
+vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/Test.java 8208235 solaris-all
+runtime/appcds/cacheObject/DifferentHeapSizes.java 8210102 solaris-all
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Tue Sep 18 16:41:24 2018 -0700
@@ -147,9 +147,6 @@
 
 vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/TestDescription.java         8051349   generic-all
 
-runtime/appcds/cacheObject/ArchivedModuleCompareTest.java                          8209534   generic-all
-runtime/appcds/cacheObject/ArchivedModuleComboTest.java                            8209534   generic-all
-
 serviceability/jvmti/FieldAccessWatch/FieldAccessWatch.java                        8202482   generic-all
 
 compiler/stable/TestStableBoolean.java                           8204347   generic-all
--- a/test/hotspot/jtreg/ProblemList.txt	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/ProblemList.txt	Tue Sep 18 16:41:24 2018 -0700
@@ -214,11 +214,4 @@
 
 vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java 7199837 generic-all
 
-vmTestbase/metaspace/stressHierarchy/stressHierarchy007/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy008/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy009/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy010/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy011/TestDescription.java 8208697 generic-all
-vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java 8208697 generic-all
-
 #############################################################################
--- a/test/hotspot/jtreg/TEST.ROOT	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/TEST.ROOT	Tue Sep 18 16:41:24 2018 -0700
@@ -56,7 +56,7 @@
     vm.hasSAandCanAttach \
     vm.hasJFR \
     vm.rtm.cpu \
-    vm.rtm.os \
+    vm.rtm.compiler \
     vm.aot \
     vm.cds \
     vm.cds.custom.loaders \
--- a/test/hotspot/jtreg/compiler/aot/AotCompiler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/aot/AotCompiler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -100,6 +100,7 @@
         }
         List<String> args = new ArrayList<>();
         args.add("--compile-with-assertions");
+        args.add("--info");
         args.add("--output");
         args.add(libName);
         if (file != null) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c2/TestUnreachableRegionDuringCCP.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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.
+ */
+
+/**
+ * @test
+ * @bug 8210387
+ * @summary Test removal of unreachable regions during CCP.
+ * @library /test/lib
+ * @run main/othervm -Xcomp -XX:-TieredCompilation
+ *                   -XX:CompileOnly=compiler.c2.TestUnreachableRegionDuringCCP::test
+ *                   compiler.c2.TestUnreachableRegionDuringCCP
+ */
+
+package compiler.c2;
+
+import jdk.test.lib.Asserts;
+
+public class TestUnreachableRegionDuringCCP {
+    static int iFld1 = -1;
+    static int iFld2 = -1;
+    static int iArrFld[] = new int[100];
+
+    public static void test() {
+        int i = 1;
+        do {
+            iArrFld[i] = iFld1;
+            iFld1 = 42;
+            for (int j = 1; j < 5; j++) {
+                if (i != 0) {
+                    return; // Always returns
+                }
+                iFld2 += j;
+            }
+        } while (++i < 10);
+    }
+
+    public static void main(String[] args) {
+        test();
+        Asserts.assertEQ(iFld1, 42);
+        Asserts.assertEQ(iFld2, -1);
+        Asserts.assertEQ(iArrFld[1], -1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/intrinsics/math/Test8210461.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Cavium (by BELLSOFT). All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute 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 8210461
+ * @summary Math cos instrinsic returns incorrect result for large value
+ *
+ * @run main/othervm compiler.intrinsics.math.Test8210461
+ */
+
+package compiler.intrinsics.math;
+
+import java.util.Arrays;
+
+public class Test8210461 {
+    private static final double[] testCases = new double[] {
+        1647100.0d,
+        16471000.0d,
+        164710000.0d
+    };
+
+    public static void main(String[] args) {
+        Arrays.stream(testCases).forEach(Test8210461::test);
+    }
+
+    private static void test(double arg) {
+        double strictResult = StrictMath.cos(arg);
+        double mathResult = Math.cos(arg);
+        if (Math.abs(strictResult - mathResult) > Math.ulp(strictResult))
+            throw new AssertionError(mathResult + " while expecting " + strictResult);
+    }
+}
--- a/test/hotspot/jtreg/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/jvmci/compilerToVM/AllocateCompileIdTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -33,7 +33,8 @@
  *          jdk.internal.vm.ci/jdk.vm.ci.hotspot
  *          jdk.internal.vm.ci/jdk.vm.ci.code
  *
- * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox
+ * @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
+ *        sun.hotspot.WhiteBox sun.hotspot.parser.DiagnosticCommand
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.parser.DiagnosticCommand
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify PrintPreciseRTMLockingStatistics on CPUs with
+ * @summary Verify PrintPreciseRTMLockingStatistics on CPUs and OSs with
  *          rtm support and on VM with rtm locking support,
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify PrintPreciseRTMLockingStatistics on CPUs without
+ * @summary Verify PrintPreciseRTMLockingStatistics on CPUs or OSs without
  *          rtm support and/or unsupported VM.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os)
+ * @requires !vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @build compiler.rtm.cli.TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- *
+ * @requires vm.rtm.compiler
  * @run main/othervm compiler.rtm.cli.TestRTMAbortThresholdOption
  */
 
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- *
+ * @requires vm.rtm.compiler
  * @run main/othervm compiler.rtm.cli.TestRTMLockingCalculationDelayOption
  */
 
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- *
+ * @requires vm.rtm.compiler
  * @run main/othervm compiler.rtm.cli.TestRTMLockingThresholdOption
  */
 
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- *
+ * @requires vm.rtm.compiler
  * @run main/othervm compiler.rtm.cli.TestRTMRetryCountOption
  */
 
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- *
+ * @requires vm.rtm.compiler
  * @run main/othervm compiler.rtm.cli.TestRTMSpinLoopCountOption
  */
 
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify RTMTotalCountIncrRate option processing on CPU with
+ * @summary Verify RTMTotalCountIncrRate option processing on CPU and OS with
  *          rtm support and on VM with rtm locking support.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify UseRTMDeopt option processing on CPUs without rtm support
+ * @summary Verify UseRTMDeopt option processing on CPUs or OSs without rtm support
  *          or on VMs without rtm locking support.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os)
+ * @requires !vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify UseRTMForStackLocks option processing on CPU with
+ * @summary Verify UseRTMForStackLocks option processing on CPU and OS with
  *          rtm support when VM supports rtm locking.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify UseRTMForStackLocks option processing on CPUs without
+ * @summary Verify UseRTMForStackLocks option processing on CPUs or OSs without
  *          rtm support and/or on VMs without rtm locking support.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires !(vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os)
+ * @requires !vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify UseRTMLocking option processing on CPU with rtm support and
- *          on VM with rtm-locking support.
+ * @summary Verify UseRTMLocking option processing on CPU and OS with rtm support and
+ *          on VM with rtm locking support.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,12 @@
 /**
  * @test
  * @bug 8031320
- * @summary Verify UseRTMLocking option processing on CPU without
+ * @summary Verify UseRTMLocking option processing on CPUs without
  *          rtm support.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires (!vm.rtm.cpu) & (vm.flavor == "server" & !vm.emulatedClient)
+ * @requires !vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,11 +25,11 @@
  * @test
  * @bug 8031320
  * @summary Verify processing of UseRTMLocking and UseBiasedLocking
- *          options combination on CPU and VM with rtm support.
+ *          options combination on CPU, OS, and VM with rtm support.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- *
+ * @requires vm.rtm.compiler
  * @run main/othervm compiler.rtm.cli.TestUseRTMXendForLockBusyOption
  */
 
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Tue Sep 18 16:41:24 2018 -0700
@@ -31,7 +31,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,11 +25,11 @@
  * @test
  * @bug 8031320
  * @summary Verify that UseRTMDeopt affects uncommon trap installation in
- *          copmpiled methods with synchronized block.
+ *          compiled methods with synchronized block.
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Tue Sep 18 16:41:24 2018 -0700
@@ -30,7 +30,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Tue Sep 18 16:41:24 2018 -0700
@@ -31,7 +31,7 @@
  * @library /test/lib /
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @requires vm.flavor == "server" & !vm.emulatedClient & vm.rtm.cpu & vm.rtm.os
+ * @requires vm.rtm.cpu & vm.rtm.compiler
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                                sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java	Tue Sep 18 16:41:24 2018 -0700
@@ -166,7 +166,14 @@
         System.out.println("Allocating new objects to provoke mixed GC");
         // allocate more objects to provoke GC
         for (int i = 0; i < (TestLogging.ALLOCATION_COUNT * 20); i++) {
-            newObjects.add(new byte[TestLogging.ALLOCATION_SIZE]);
+            try {
+                newObjects.add(new byte[TestLogging.ALLOCATION_SIZE]);
+            } catch (OutOfMemoryError e) {
+                newObjects.clear();
+                WB.youngGC();
+                WB.youngGC();
+                break;
+            }
         }
         // check that liveOldObjects still alive
         Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects),
--- a/test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java	Tue Sep 18 16:41:24 2018 -0700
@@ -33,7 +33,7 @@
  * @modules java.management
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
- * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -verbose:gc -XX:SurvivorRatio=1 -Xmx12m -Xms12m -XX:MaxTenuringThreshold=1 -XX:InitiatingHeapOccupancyPercent=100 -XX:-G1UseAdaptiveIHOP -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000 -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100 TestOldGenCollectionUsage
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UseG1GC -XX:+UnlockExperimentalVMOptions -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -verbose:gc -XX:SurvivorRatio=1 -Xmx14m -Xms14m -XX:MaxTenuringThreshold=1 -XX:InitiatingHeapOccupancyPercent=100 -XX:-G1UseAdaptiveIHOP -XX:G1MixedGCCountTarget=4 -XX:MaxGCPauseMillis=30000 -XX:G1HeapRegionSize=1m -XX:G1HeapWastePercent=0 -XX:G1MixedGCLiveThresholdPercent=100 TestOldGenCollectionUsage
  */
 
 import jdk.test.lib.Asserts;
@@ -209,7 +209,15 @@
             // Provoke a mixed collection. G1MixedGCLiveThresholdPercent=100
             // guarantees that full old gen regions will be included.
             for (int i = 0; i < (ALLOCATION_COUNT * 20); i++) {
-                newObjects.add(new byte[ALLOCATION_SIZE]);
+                try {
+                    newObjects.add(new byte[ALLOCATION_SIZE]);
+                } catch (OutOfMemoryError e) {
+                    newObjects.clear();
+                    WB.youngGC();
+                    WB.youngGC();
+                    System.out.println("OutOfMemoryError is reported, stop allocating new objects");
+                    break;
+                }
             }
             // check that liveOldObjects still alive
             Asserts.assertTrue(WB.isObjectInOldGen(liveOldObjects),
--- a/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/gc/stress/TestStressIHOPMultiThread.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -181,7 +181,13 @@
         public void run() {
             System.out.println("Start the thread " + threadId);
             while (TestStressIHOPMultiThread.this.isRunning()) {
-                allocate(amountOfGarbage);
+                try {
+                    allocate(amountOfGarbage);
+                } catch (OutOfMemoryError e) {
+                    free();
+                    System.out.println("OutOfMemoryError occurred in thread " + threadId);
+                    break;
+                }
                 free();
             }
         }
--- a/test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,6 +23,7 @@
 
 /*
  * @test UnloadTest
+ * @bug 8210559
  * @requires vm.opt.final.ClassUnloading
  * @modules java.base/jdk.internal.misc
  * @library /runtime/testlibrary /test/lib
@@ -30,7 +31,7 @@
  * @build sun.hotspot.WhiteBox test.Empty
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI UnloadTest
+ * @run main/othervm -Xbootclasspath/a:. -Xmn8m -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xlog:class+unload=debug UnloadTest
  */
 import sun.hotspot.WhiteBox;
 
@@ -60,8 +61,16 @@
 
         ClassUnloadCommon.failIf(!wb.isClassAlive(className), "should be live here");
 
+        String loaderName = cl.getName();
+        int loadedRefcount = wb.getSymbolRefcount(loaderName);
+        System.out.println("Refcount of symbol " + loaderName + " is " + loadedRefcount);
+
         cl = null; c = null; o = null;
         ClassUnloadCommon.triggerUnloading();
         ClassUnloadCommon.failIf(wb.isClassAlive(className), "should have been unloaded");
+
+        int unloadedRefcount = wb.getSymbolRefcount(loaderName);
+        System.out.println("Refcount of symbol " + loaderName + " is " + unloadedRefcount);
+        ClassUnloadCommon.failIf(unloadedRefcount != (loadedRefcount - 1), "Refcount must be decremented");
     }
 }
--- a/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java	Tue Sep 18 16:41:24 2018 -0700
@@ -45,6 +45,7 @@
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
                                   "-Xlog:protectiondomain+table=debug",
                                   "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED",
+                                  "-XX:+UnlockDiagnosticVMOptions",
                                   "-XX:+WhiteBoxAPI",
                                   "-Xbootclasspath/a:.",
                                   Test.class.getName());
@@ -70,13 +71,20 @@
 
       test();
 
-      System.gc();
       // Wait until ServiceThread cleans ProtectionDomain table.
       // When the TestClassLoader is unloaded by GC, at least one
       // ProtectionDomainCacheEntry will be eligible for removal.
-      do {
-        removedCount = wb.protectionDomainRemovedCount();
-      } while (removedCountOrig == removedCount);
+      int cnt = 0;
+      while (true) {
+        if (cnt++ % 30 == 0) {
+          System.gc();
+        }
+        removedCount = wb.resolvedMethodRemovedCount();
+        if (removedCountOrig != removedCount) {
+          break;
+        }
+        Thread.sleep(100);
+      }
     }
 
     private static class TestClassLoader extends ClassLoader {
--- a/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,7 +27,8 @@
  * @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
- * @build jdk.testlibrary.Utils JarUtils
+ * @library /test/lib
+ * @build jdk.test.lib.Utils 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
  */
@@ -39,7 +40,7 @@
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.List;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * Create .jar, load ClassForName from .jar using a URLClassLoader
--- a/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,6 +29,7 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
+ *          jdk.jartool/sun.tools.jar
  * @run main LongBCP
  */
 
@@ -84,6 +85,23 @@
         output.shouldContain("Hello World")
               .shouldHaveExitValue(0);
 
+        // create a hello.jar
+        sun.tools.jar.Main jarTool = new sun.tools.jar.Main(System.out, System.err, "jar");
+        String helloJar = destDir.toString() + File.separator + "hello.jar";
+        if (!jarTool.run(new String[]
+            {"-cf", helloJar, "-C", destDir.toString(), "Hello.class"})) {
+            throw new RuntimeException("Could not write the Hello jar file");
+        }
+
+        // run with long bootclasspath to hello.jar
+        bootCP = "-Xbootclasspath/a:" + helloJar;
+        pb = ProcessTools.createJavaProcessBuilder(
+            bootCP, "Hello");
+
+        output = new OutputAnalyzer(pb.start());
+        output.shouldContain("Hello World")
+              .shouldHaveExitValue(0);
+
         // relative path tests
         // We currently cannot handle relative path specified in the
         // -Xbootclasspath/a on windows.
--- a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java	Tue Sep 18 16:41:24 2018 -0700
@@ -56,19 +56,26 @@
           mh.invokeExact(leak);
         }
 
-        System.gc();  // make mh unused
-
         // Wait until ServiceThread cleans ResolvedMethod table
-        do {
+        int cnt = 0;
+        while (true) {
+          if (cnt++ % 30 == 0) {
+            System.gc();  // make mh unused
+          }
           removedCount = wb.resolvedMethodRemovedCount();
-        } while (removedCountOrig == removedCount);
+          if (removedCountOrig != removedCount) {
+            break;
+          }
+          Thread.sleep(100);
+        }
       }
     }
 
     public static void test(String gc) throws Throwable {
-       // Run this Leak class with logging
+        // Run this Leak class with logging
         ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
                                       "-Xlog:membername+table=trace",
+                                      "-XX:+UnlockDiagnosticVMOptions",
                                       "-XX:+WhiteBoxAPI",
                                       "-Xbootclasspath/a:.",
                                       gc, Leak.class.getName());
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckArchivedModuleApp.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckArchivedModuleApp.java	Tue Sep 18 16:41:24 2018 -0700
@@ -47,8 +47,16 @@
            throw new RuntimeException(
                "FAILED. Incorrect argument length: " + args.length);
         }
+
         boolean expectArchivedDescriptors = "yes".equals(args[0]);
         boolean expectArchivedConfiguration = "yes".equals(args[1]);
+        // -XX:+EnableJVMCI adds extra system modules, in which case the system
+        // module objects are not archived.
+        if (wb.getBooleanVMFlag("EnableJVMCI")) {
+            expectArchivedDescriptors = false;
+            expectArchivedConfiguration = false;
+        }
+
         checkModuleDescriptors(expectArchivedDescriptors);
         checkConfiguration(expectArchivedConfiguration);
         checkEmptyConfiguration(expectArchivedConfiguration);
--- a/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java	Tue Sep 18 16:41:24 2018 -0700
@@ -40,6 +40,8 @@
 import jdk.test.lib.cds.CDSTestUtils;
 
 public class DifferentHeapSizes {
+    static final String DEDUP = "-XX:+UseStringDeduplication"; // This increases code coverage.
+
     static class Scenario {
         int dumpSize;   // in MB
         int runSizes[]; // in MB
@@ -59,7 +61,6 @@
     };
 
     public static void main(String[] args) throws Exception {
-        String dedup = "-XX:+UseStringDeduplication"; // This increases code coverage.
         JarBuilder.getOrCreateHelloJar();
         String appJar = TestCommon.getTestJar("hello.jar");
         String appClasses[] = TestCommon.list("Hello");
@@ -71,7 +72,7 @@
             for (int runSize : s.runSizes) {
                 String runXmx = "-Xmx" + runSize + "m";
                 CDSTestUtils.Result result = TestCommon.run("-cp", appJar, "-showversion",
-                        "-Xlog:cds", runXmx, dedup, "Hello");
+                        "-Xlog:cds", runXmx, DEDUP, "Hello");
                 if (runSize < 32768) {
                     result
                         .assertNormalExit("Hello World")
@@ -80,21 +81,49 @@
                             out.shouldNotContain(CDSTestUtils.MSG_RANGE_ALREADT_IN_USE);
                         });
                 } else {
-                    result.assertAbnormalExit("Unable to use shared archive: UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces.");
+                    result.assertAbnormalExit(CDSTestUtils.MSG_COMPRESSION_MUST_BE_USED);
                 }
             }
         }
-        String flag = "HeapBaseMinAddress";
-        String xxflag = "-XX:" + flag + "=";
-        String mx = "-Xmx128m";
-        long base = WhiteBox.getWhiteBox().getSizeTVMFlag(flag).longValue();
+
+        // Test various settings of -XX:HeapBaseMinAddress that would trigger
+        // "CDS heap data need to be relocated because the desired range ... is outside of the heap"
+        long default_base = WhiteBox.getWhiteBox().getSizeTVMFlag("HeapBaseMinAddress").longValue();
+        long M = 1024 * 1024;
+        long bases[] = new long[] {
+            /* dump xmx */   /* run xmx */   /* dump base */             /* run base */
+            128 * M,         128 * M,        default_base,               default_base + 256L * 1024 * 1024,
+            128 * M,         16376 * M,      0x0000000119200000L,        -1,
+        };
+
+        for (int i = 0; i < bases.length; i += 4) {
+            String dump_xmx  = getXmx(bases[i+0]);
+            String run_xmx   = getXmx(bases[i+1]);
+            String dump_base = getHeapBaseMinAddress(bases[i+2]);
+            String run_base  = getHeapBaseMinAddress(bases[i+3]);
 
-        TestCommon.dump(appJar, appClasses, mx, xxflag + base);
-        TestCommon.run("-cp", appJar, "-showversion", "-Xlog:cds", mx, xxflag + (base + 256 * 1024 * 1024), dedup, "Hello")
-            .assertNormalExit("Hello World")
-            .assertNormalExit(out -> {
-                    out.shouldNotContain(CDSTestUtils.MSG_RANGE_NOT_WITHIN_HEAP);
-                    out.shouldNotContain(CDSTestUtils.MSG_RANGE_ALREADT_IN_USE);
-                });
+            TestCommon.dump(appJar, appClasses, dump_xmx, dump_base);
+            TestCommon.run("-cp", appJar, "-showversion", "-Xlog:cds", run_xmx, run_base, DEDUP, "Hello")
+                .assertNormalExit("Hello World")
+                .assertNormalExit(out -> {
+                        out.shouldNotContain(CDSTestUtils.MSG_RANGE_NOT_WITHIN_HEAP);
+                        out.shouldNotContain(CDSTestUtils.MSG_RANGE_ALREADT_IN_USE);
+                    });
+        }
+    }
+
+    static String getXmx(long value) {
+        if (value < 0) {
+            return "-showversion"; // This is a harmless command line arg
+        } else {
+            return "-Xmx" + (value / 1024 / 1024) + "m";
+        }
+    }
+    static String getHeapBaseMinAddress(long value) {
+        if (value < 0) {
+            return "-showversion"; // This is a harmless command line arg
+        } else {
+            return "-XX:HeapBaseMinAddress=0x" + Long.toHexString(value);
+        }
     }
 }
--- a/test/hotspot/jtreg/runtime/testlibrary/ClassUnloadCommon.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/runtime/testlibrary/ClassUnloadCommon.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, 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
@@ -73,7 +73,7 @@
                 .map(Paths::get)
                 .map(ClassUnloadCommon::toURL)
                 .toArray(URL[]::new);
-        return new URLClassLoader(urls) {
+        return new URLClassLoader("ClassUnloadCommonClassLoader", urls, new ClassUnloadCommon().getClass().getClassLoader()) {
             @Override
             public Class<?> loadClass(String cn, boolean resolve)
                 throws ClassNotFoundException
--- a/test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -40,7 +40,6 @@
 import jdk.test.lib.apps.LingeredAppWithDeadlock;
 
 import jdk.test.lib.Utils;
-import jdk.test.lib.Platform;
 import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
--- a/test/hotspot/jtreg/vmTestbase/gc/gctests/mallocWithGC1/libmallocWithGC1.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/mallocWithGC1/libmallocWithGC1.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdlib.h>
 #include <time.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL Java_gc_gctests_mallocWithGC1_mallocWithGC1_getMallocLock01
 (JNIEnv *env, jobject obj) {
@@ -43,6 +41,4 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/gc/gctests/mallocWithGC2/libmallocWithGC2.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/mallocWithGC2/libmallocWithGC2.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdlib.h>
 #include <time.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL Java_gc_gctests_mallocWithGC2_mallocWithGC2_getMallocLock02
 (JNIEnv *env, jobject obj) {
@@ -43,6 +41,4 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/gc/gctests/mallocWithGC3/libmallocWithGC3.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/mallocWithGC3/libmallocWithGC3.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdlib.h>
 #include <time.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL
 Java_gc_gctests_mallocWithGC3_mallocWithGC3_getMallocLock03
@@ -44,6 +42,4 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC01/libnativeGC01.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC01/libnativeGC01.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <jni.h>
 #include <stdio.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * A C function that takes a reference to java Object( a circular Linked list)
@@ -66,6 +64,4 @@
         return elementCount;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC02/libnativeGC02.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC02/libnativeGC02.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -23,9 +23,7 @@
 #include <jni.h>
 #include <stdio.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* A C function that takes a reference to java Object( a circular Linked list)
     and utilizes this reference to do a java method callback to determine the
@@ -76,6 +74,4 @@
         return elementCount;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -22,9 +22,7 @@
  */
 #include <jni.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL
 Java_gc_gctests_nativeGC03_nativeGC03_nativeMethod03
@@ -57,6 +55,4 @@
 
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC05/libnativeGC05.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC05/libnativeGC05.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -23,9 +23,7 @@
 #include <jni.h>
 #include <stdio.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL
 Java_gc_gctests_nativeGC05_nativeGC05_kickOffRefillers
@@ -91,6 +89,4 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java	Tue Sep 18 16:41:24 2018 -0700
@@ -137,10 +137,10 @@
                 }
             }
         } catch (OutOfMemoryError e) {
-            if (e.getMessage().trim().toLowerCase().contains("metadata")) {
-                System.out.println("Got OOME in metaspace in PerformChecksHelper.callMethods(Class clazz). " +
-                                "This happened because reflection generates a too many accessors. " +
-                                "There is nothing we can do with it, so we are just suppressing.");
+            if (e.getMessage().trim().toLowerCase().contains("metaspace")) {
+                // avoid string concatenation, which may create more classes.
+                System.out.println("Got OOME in metaspace in PerformChecksHelper.callMethods(Class clazz). ");
+                System.out.println("This is possible with -triggerUnloadingByFillingMetaspace");
             } else {
                 throw e;
             }
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java	Tue Sep 18 16:41:24 2018 -0700
@@ -39,15 +39,13 @@
 import nsk.share.test.ExecutionController;
 import nsk.share.test.Stresser;
 import nsk.share.test.TestBase;
-import nsk.share.test.timeoutwatchdog.TimeoutHandler;
-import nsk.share.test.timeoutwatchdog.TimeoutWatchdog;
 
 
 /**
  * Superclass for StressHierarchy* tests. It provides util methods to create and load
  * classes hierarchy and perform checks.
  */
-abstract public class StressHierarchyBaseClass extends TestBase implements TimeoutHandler {
+abstract public class StressHierarchyBaseClass extends TestBase {
 
     protected static String[] args;
 
@@ -101,7 +99,6 @@
             long startTimeStamp = System.currentTimeMillis();
             ExecutionController stresser = new Stresser(args);
             stresser.start(1);
-            TimeoutWatchdog.watch(stresser, this);
             TreeDescriptor treeDescriptor = GenerateHierarchyHelper.generateHierarchy(treeDepth, minLevelSize, maxLevelSize, hierarchyType);
             Tree tree = buildTree(treeDescriptor);
             System.out.println("Generating took " + ((System.currentTimeMillis() - startTimeStamp)/1000) +" sec");
@@ -128,12 +125,6 @@
         }
     }
 
-    @Override
-    public void handleTimeout() {
-        System.out.println("Shutting down vm because of time expired.");
-        System.exit(95);
-    }
-
     abstract protected void runTestLogic(Tree tree, ExecutionController stresser) throws Throwable;
 
     private Tree buildTree(TreeDescriptor treeDescriptor) throws MalformedURLException,
--- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java	Tue Sep 18 16:41:24 2018 -0700
@@ -37,7 +37,7 @@
  * @comment generate and compile metaspace.stressHierarchy.common.HumongousClass
  * @run driver metaspace.stressHierarchy.common.GenClassesBuilder
  * @run main/othervm
- *      -XX:MaxMetaspaceSize=450m
+ *      -XX:MaxMetaspaceSize=250m
  *      -Xss10m
  *      -Xbootclasspath/a:.
  *      -XX:+UnlockDiagnosticVMOptions
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <jni.h>
 #include <aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define AGENT_NAME "VMNativeAgent00"
 
@@ -65,6 +63,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <jni.h>
 #include <aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define AGENT_NAME "VMNativeAgent01"
 
@@ -68,6 +66,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <jni.h>
 #include <aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define AGENT_NAME "VMNativeAgent02"
 
@@ -70,6 +68,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <jni.h>
 #include <aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define AGENT_NAME "VMNativeAgent03"
 
@@ -59,6 +57,4 @@
     return ON_ATTACH_EXIT_CODE;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <jni.h>
 #include <aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Test checks following spec clause: "Agent_OnAttach function is invoked even if the agent library was loaded
@@ -68,6 +66,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java	Tue Sep 18 16:41:24 2018 -0700
@@ -81,7 +81,7 @@
        int[]   arrVar
                               )
    {
-       System.out.println("Arguments but no locals"); // locals002.BREAKPOINT_LINE1
+       int x = 3; // locals002.BREAKPOINT_LINE1
    }
 
    static void allKindsOfLocals()  {
@@ -97,6 +97,6 @@
        int[]   arrVar    = new int[5];
 
        for (int j = 0; j < 5 ; j++) arrVar[j] = j;
-       System.out.println("Locals but no arguments"); // locals002.BREAKPOINT_LINE2
+       int x = 4; // locals002.BREAKPOINT_LINE2
    }
 }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java	Tue Sep 18 16:41:24 2018 -0700
@@ -118,7 +118,8 @@
         // + 'includedIntoReferrersCountTypes.size()' referrers was additionally created
         // +1 referrer is classloader
         // +1 referrer is debugee class unloader
-        int expectedReferrersCount = createInstances + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size() + 2;
+        // +1 self-reference from this_class index
+        int expectedReferrersCount = createInstances + HeapwalkingDebuggee.includedIntoReferrersCountTypes.size() + 3;
 
         ClassObjectReference classObjectReference = debuggee.classByName(className).classObject();
 
@@ -132,7 +133,8 @@
         // Only this referrers should left:
         // 1 referrer is classloader
         // 1 referrer is debugee class unloader
-        expectedReferrersCount = 2;
+        // 1 self-reference from this_class index
+        expectedReferrersCount = 3;
 
         checkClassObjectReferrersCount(classObjectReference, expectedReferrersCount);
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -348,6 +346,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -372,6 +370,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -221,6 +219,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -88,6 +86,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -69,6 +67,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -69,6 +67,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -83,6 +81,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -75,8 +62,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -185,6 +171,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -241,6 +239,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -130,6 +128,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -148,6 +146,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -160,6 +158,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Agent tries to get all potential capabilities
@@ -91,6 +89,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define LOADED_CLASS_NAME "Lnsk/jvmti/AttachOnDemand/attach014/ClassToLoad;"
 
@@ -122,6 +120,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -114,6 +112,4 @@
 
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -114,6 +112,4 @@
 
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define LOADED_CLASS_NAME "nsk/jvmti/AttachOnDemand/attach015/ClassToLoad2"
 
@@ -42,6 +40,4 @@
     return NSK_CPP_STUB2(FindClass, jni, LOADED_CLASS_NAME) ? JNI_TRUE : JNI_FALSE;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -194,6 +192,4 @@
 
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -166,6 +164,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define OBJECTS_FOR_ALLOCATION_TEST_CLASS_NAME "Lnsk/jvmti/AttachOnDemand/attach022/ClassForAllocationEventsTest;"
 
@@ -232,6 +230,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -147,6 +145,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -137,6 +135,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -178,6 +176,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -169,6 +167,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -190,6 +188,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Expected agent work scenario:
@@ -154,6 +152,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Agent receives expected number of ClassLoad events and finishes work
@@ -134,6 +132,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Agent receives expected number of ClassPrepare events and finishes work
@@ -145,6 +143,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Agent receives expected number of ThreadStart/ThreadEnd events and finishes work
@@ -166,6 +164,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Agent receives expected number of VMObjectAlloc events and finishes work
@@ -161,6 +159,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * In this test the same agent library is attached 3 times, but with
@@ -141,6 +139,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 
 #define ON_UNLOAD_MARKER "attach050.on_unload"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * This agent gets JVMTI environment and calls nsk_aod_agentLoaded and
@@ -94,6 +92,4 @@
     fflush(stdout);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <aod.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Simple agent, doesn't perform any specific checks,
@@ -77,6 +75,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Breakpoint/breakpoint001/breakpoint001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -303,6 +301,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -108,6 +106,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -350,6 +348,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -412,6 +410,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -303,6 +301,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -365,6 +363,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -429,6 +427,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -455,6 +453,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -391,6 +389,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -391,6 +389,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassLoad/classload001/classload001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -206,6 +204,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -257,8 +244,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -333,6 +319,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -79,8 +66,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -131,8 +117,7 @@
 
 JNIEXPORT void JNICALL
 Java_nsk_jvmti_ClearBreakpoint_clrbrk001_getReady(JNIEnv *env, jclass cls, jint i) {
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "trial", "(I)I");
+    mid = env->GetStaticMethodID(cls, "trial", "(I)I");
     if (mid == NULL) {
         printf("Cannot find method \"trial(I)I\"\n");
         result = STATUS_FAILED;
@@ -213,6 +198,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -121,8 +107,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I");
+    mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I");
     if (mid == NULL) {
         printf("Cannot find method run\n");
         return STATUS_FAILED;
@@ -158,6 +143,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -119,8 +105,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    mid = env->GetStaticMethodID(cls, "checkPoint", "()V");
     if (mid == 0) {
         printf("Cannot find Method ID for method checkPoint\n");
         return STATUS_FAILED;
@@ -153,6 +138,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -74,14 +61,12 @@
     field fld = fields[ind];
     const char *msg;
 
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, fld.klass));
+    cls = env->FindClass(fld.klass);
     if (fld.fid == NULL) {
         if (fld.stat) {
-            fields[ind].fid = JNI_ENV_PTR(env)->
-                    GetStaticFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig);
+            fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig);
         } else {
-            fields[ind].fid = JNI_ENV_PTR(env)->
-                    GetFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig);
+            fields[ind].fid = env->GetFieldID(cls, fld.name, fld.sig);
         }
     }
 
@@ -123,8 +108,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -191,7 +175,7 @@
         jobject obj) {
     jint val;
 
-    val = JNI_ENV_PTR(env)->GetIntField(JNI_ENV_ARG(env, obj), fields[0].fid);
+    val = env->GetIntField(obj, fields[0].fid);
 }
 
 JNIEXPORT void JNICALL
@@ -216,6 +200,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -71,8 +58,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -128,10 +114,8 @@
     jvmtiError err;
     jfieldID fid1, fid2;
 
-    fid1 = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld1", "I");
-    fid2 = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld2", "I");
+    fid1 = env->GetStaticFieldID(cls, "fld1", "I");
+    fid2 = env->GetStaticFieldID(cls, "fld2", "I");
 
     if (!caps.can_generate_field_access_events) {
         err = jvmti->ClearFieldAccessWatch(cls, fid1);
@@ -169,6 +153,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -74,14 +61,12 @@
     field fld = fields[ind];
     const char *msg;
 
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, fld.klass));
+    cls = env->FindClass(fld.klass);
     if (fld.fid == NULL) {
         if (fld.stat) {
-            fields[ind].fid = JNI_ENV_PTR(env)->
-                GetStaticFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig);
+            fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig);
         } else {
-            fields[ind].fid = JNI_ENV_PTR(env)->
-                GetFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig);
+            fields[ind].fid = env->GetFieldID(cls, fld.name, fld.sig);
         }
     }
 
@@ -123,8 +108,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -185,7 +169,7 @@
 }
 
 JNIEXPORT void JNICALL Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw001_touchfld0(JNIEnv *env, jobject obj) {
-    JNI_ENV_PTR(env)->SetIntField(JNI_ENV_ARG(env, obj), fields[0].fid, 2000);
+    env->SetIntField(obj, fields[0].fid, 2000);
 }
 
 JNIEXPORT void JNICALL
@@ -208,6 +192,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -72,8 +59,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -129,10 +115,8 @@
     jvmtiError err;
     jfieldID fid1, fid2;
 
-    fid1 = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld1", "I");
-    fid2 = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld2", "I");
+    fid1 = env->GetStaticFieldID(cls, "fld1", "I");
+    fid2 = env->GetStaticFieldID(cls, "fld2", "I");
 
     if (!caps.can_generate_field_modification_events) {
         printf("Warning: ClearFieldModificationWatch is not implemented\n");
@@ -172,6 +156,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -156,6 +154,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -204,6 +202,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -96,8 +83,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -126,6 +112,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -111,6 +97,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -133,6 +131,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -103,6 +89,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -109,8 +96,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -139,6 +125,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -124,6 +110,4 @@
     return PASSED;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -105,6 +91,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -67,6 +65,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -117,6 +115,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -138,6 +136,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -102,7 +89,7 @@
     if (printdump == JNI_TRUE) {
         printf(">>> retrieving Exception info ...\n");
     }
-    cls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG((JNIEnv *)env, exception));
+    cls = env->GetObjectClass(exception);
     err = jvmti_env->GetClassSignature(cls, &ex.name, &generic);
     if (err != JVMTI_ERROR_NONE) {
         printf("(GetClassSignature) unexpected error: %s (%d)\n",
@@ -204,8 +191,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -263,26 +249,22 @@
         return result;
     }
 
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/Exception/exception001c"));
+    clz = env->FindClass("nsk/jvmti/Exception/exception001c");
     if (clz == NULL) {
         printf("Cannot find exception001c class!\n");
         return STATUS_FAILED;
     }
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/Exception/exception001b"));
+    clz = env->FindClass("nsk/jvmti/Exception/exception001b");
     if (clz == NULL) {
         printf("Cannot find exception001b class!\n");
         return STATUS_FAILED;
     }
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/Exception/exception001a"));
+    clz = env->FindClass("nsk/jvmti/Exception/exception001a");
     if (clz == NULL) {
         printf("Cannot find exception001a class!\n");
         return STATUS_FAILED;
     }
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clz),
-        "run", "()V");
+    mid = env->GetStaticMethodID(clz, "run", "()V");
     if (mid == NULL) {
         printf("Cannot find method run!\n");
         return STATUS_FAILED;
@@ -304,7 +286,7 @@
         result = STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(env)->CallStaticVoidMethod(JNI_ENV_ARG(env, clz), mid);
+    env->CallStaticVoidMethod(clz, mid);
 
     err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,
             JVMTI_EVENT_EXCEPTION, thread);
@@ -322,6 +304,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ExceptionCatch/excatch001/excatch001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ExceptionCatch/excatch001/excatch001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -90,7 +77,7 @@
     if (printdump == JNI_TRUE) {
         printf(">>> retrieving ExceptionCatch info ...\n");
     }
-    cls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG((JNIEnv *)env, exception));
+    cls = env->GetObjectClass(exception);
     err = jvmti_env->GetClassSignature(cls, &ex.name, &generic);
     if (err != JVMTI_ERROR_NONE) {
         printf("(GetClassSignature#e) unexpected error: %s (%d)\n",
@@ -163,8 +150,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -221,26 +207,22 @@
         return result;
     }
 
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/ExceptionCatch/excatch001c"));
+    clz = env->FindClass("nsk/jvmti/ExceptionCatch/excatch001c");
     if (clz == NULL) {
         printf("Cannot find excatch001c class!\n");
         return STATUS_FAILED;
     }
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/ExceptionCatch/excatch001b"));
+    clz = env->FindClass("nsk/jvmti/ExceptionCatch/excatch001b");
     if (clz == NULL) {
         printf("Cannot find excatch001b class!\n");
         return STATUS_FAILED;
     }
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/ExceptionCatch/excatch001a"));
+    clz = env->FindClass("nsk/jvmti/ExceptionCatch/excatch001a");
     if (clz == NULL) {
         printf("Cannot find excatch001a class!\n");
         return STATUS_FAILED;
     }
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clz),
-        "run", "()V");
+    mid = env->GetStaticMethodID(clz, "run", "()V");
     if (mid == NULL) {
         printf("Cannot find method run!\n");
         return STATUS_FAILED;
@@ -256,7 +238,7 @@
         result = STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(env)->CallStaticVoidMethod(JNI_ENV_ARG(env, clz), mid);
+    env->CallStaticVoidMethod(clz, mid);
 
     err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,
             JVMTI_EVENT_EXCEPTION_CATCH, NULL);
@@ -274,6 +256,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc001/fieldacc001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc001/fieldacc001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -258,8 +245,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -323,8 +309,7 @@
     if (printdump == JNI_TRUE) {
         printf(">>> setting field access watches ...\n");
     }
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/FieldAccess/fieldacc001a"));
+    cls = env->FindClass("nsk/jvmti/FieldAccess/fieldacc001a");
     if (cls == NULL) {
         printf("Cannot find fieldacc001a class!\n");
         result = STATUS_FAILED;
@@ -332,11 +317,11 @@
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid = JNI_ENV_PTR(env)->GetFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         }
         if (watches[i].fid == NULL) {
             printf("Cannot find field \"%s\"!\n", watches[i].f_name);
@@ -367,6 +352,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc002/fieldacc002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc002/fieldacc002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -257,8 +244,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -321,8 +307,7 @@
         printf(">>> setting field access watches ...\n");
     }
 
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/FieldAccess/fieldacc002a"));
+    cls = env->FindClass("nsk/jvmti/FieldAccess/fieldacc002a");
     if (cls == NULL) {
         printf("Cannot find fieldacc002a class!\n");
         result = STATUS_FAILED;
@@ -330,11 +315,11 @@
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid = JNI_ENV_PTR(env)->GetFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         }
         if (watches[i].fid == NULL) {
             printf("Cannot find field \"%s\"!\n", watches[i].f_name);
@@ -368,44 +353,33 @@
         printf(">>> accessing fields ...\n");
     }
 
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/FieldAccess/fieldacc002a"));
+    cls = env->FindClass("nsk/jvmti/FieldAccess/fieldacc002a");
     if (cls == NULL) {
         printf("Cannot find fieldacc002a class!\n");
         return STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(env)->GetStaticBooleanField(JNI_ENV_ARG(env, cls),
-        watches[0].fid);
-    JNI_ENV_PTR(env)->GetStaticByteField(JNI_ENV_ARG(env, cls),
-        watches[1].fid);
-    JNI_ENV_PTR(env)->GetStaticShortField(JNI_ENV_ARG(env, cls),
-        watches[2].fid);
-    JNI_ENV_PTR(env)->GetStaticIntField(JNI_ENV_ARG(env, cls),
-        watches[3].fid);
-    JNI_ENV_PTR(env)->GetStaticLongField(JNI_ENV_ARG(env, cls),
-        watches[4].fid);
-    JNI_ENV_PTR(env)->GetStaticFloatField(JNI_ENV_ARG(env, cls),
-        watches[5].fid);
-    JNI_ENV_PTR(env)->GetStaticDoubleField(JNI_ENV_ARG(env, cls),
-        watches[6].fid);
-    JNI_ENV_PTR(env)->GetStaticCharField(JNI_ENV_ARG(env, cls),
-        watches[7].fid);
-    JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG(env, cls),
-        watches[8].fid);
-    JNI_ENV_PTR(env)->GetStaticObjectField(JNI_ENV_ARG(env, cls),
-        watches[9].fid);
+    env->GetStaticBooleanField(cls, watches[0].fid);
+    env->GetStaticByteField(cls, watches[1].fid);
+    env->GetStaticShortField(cls, watches[2].fid);
+    env->GetStaticIntField(cls, watches[3].fid);
+    env->GetStaticLongField(cls, watches[4].fid);
+    env->GetStaticFloatField(cls, watches[5].fid);
+    env->GetStaticDoubleField(cls, watches[6].fid);
+    env->GetStaticCharField(cls, watches[7].fid);
+    env->GetStaticObjectField(cls, watches[8].fid);
+    env->GetStaticObjectField(cls, watches[9].fid);
 
-    JNI_ENV_PTR(env)->GetBooleanField(JNI_ENV_ARG(env, obj), watches[10].fid);
-    JNI_ENV_PTR(env)->GetByteField(JNI_ENV_ARG(env, obj), watches[11].fid);
-    JNI_ENV_PTR(env)->GetShortField(JNI_ENV_ARG(env, obj), watches[12].fid);
-    JNI_ENV_PTR(env)->GetIntField(JNI_ENV_ARG(env, obj), watches[13].fid);
-    JNI_ENV_PTR(env)->GetLongField(JNI_ENV_ARG(env, obj), watches[14].fid);
-    JNI_ENV_PTR(env)->GetFloatField(JNI_ENV_ARG(env, obj), watches[15].fid);
-    JNI_ENV_PTR(env)->GetDoubleField(JNI_ENV_ARG(env, obj), watches[16].fid);
-    JNI_ENV_PTR(env)->GetCharField(JNI_ENV_ARG(env, obj), watches[17].fid);
-    JNI_ENV_PTR(env)->GetObjectField(JNI_ENV_ARG(env, obj), watches[18].fid);
-    JNI_ENV_PTR(env)->GetObjectField(JNI_ENV_ARG(env, obj), watches[19].fid);
+    env->GetBooleanField(obj, watches[10].fid);
+    env->GetByteField(obj, watches[11].fid);
+    env->GetShortField(obj, watches[12].fid);
+    env->GetIntField(obj, watches[13].fid);
+    env->GetLongField(obj, watches[14].fid);
+    env->GetFloatField(obj, watches[15].fid);
+    env->GetDoubleField(obj, watches[16].fid);
+    env->GetCharField(obj, watches[17].fid);
+    env->GetObjectField(obj, watches[18].fid);
+    env->GetObjectField(obj, watches[19].fid);
 
     if (printdump == JNI_TRUE) {
         printf(">>> ... done\n");
@@ -419,6 +393,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc003/fieldacc003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc003/fieldacc003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -237,8 +224,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -302,18 +288,18 @@
         printf(">>> setting field access watches ...\n");
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
-        cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, watches[i].f_cls));
+        cls = env->FindClass(watches[i].f_cls);
         if (cls == NULL) {
             printf("Cannot find %s class!\n", watches[i].f_cls);
             result = STATUS_FAILED;
             return;
         }
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid = JNI_ENV_PTR(env)->GetFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         }
         if (watches[i].fid == NULL) {
             printf("Cannot get field ID for \"%s:%s\"\n",
@@ -345,6 +331,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc004/fieldacc004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc004/fieldacc004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -223,8 +210,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -288,18 +274,18 @@
         printf(">>> setting field access watches ...\n");
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
-        cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, watches[i].f_cls));
+        cls = env->FindClass(watches[i].f_cls);
         if (cls == NULL) {
             printf("Cannot find %s class!\n", watches[i].f_cls);
             result = STATUS_FAILED;
             return;
         }
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid = JNI_ENV_PTR(env)->GetFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         }
         if (watches[i].fid == NULL) {
             printf("Cannot get field ID for \"%s:%s\"\n",
@@ -331,6 +317,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod001/fieldmod001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod001/fieldmod001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -170,8 +157,7 @@
         return (v1.d == v2.d);
     case 'L':
     case '[':
-        return (JNI_TRUE ==
-            JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, v1.l), v2.l));
+        return env->IsSameObject(v1.l, v2.l);
     case 'Z':
         return (v1.z == v2.z);
     case 'B':
@@ -335,8 +321,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -400,8 +385,7 @@
     if (printdump == JNI_TRUE) {
         printf(">>> setting field modification watches ...\n");
     }
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/FieldModification/fieldmod001a"));
+    cls = env->FindClass("nsk/jvmti/FieldModification/fieldmod001a");
     if (cls == NULL) {
         printf("Cannot find fieldmod001a class!\n");
         result = STATUS_FAILED;
@@ -409,11 +393,11 @@
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid = JNI_ENV_PTR(env)->GetFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         }
         if (watches[i].fid == NULL) {
             printf("Cannot get field ID for \"%s:%s\"\n",
@@ -468,6 +452,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod002/fieldmod002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod002/fieldmod002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -170,8 +157,7 @@
         return (v1.d == v2.d);
     case 'L':
     case '[':
-        return (JNI_TRUE ==
-            JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, v1.l), v2.l));
+        return env->IsSameObject(v1.l, v2.l);
     case 'Z':
         return (v1.z == v2.z);
     case 'B':
@@ -218,8 +204,7 @@
                TranslateError(err), err);
         result = STATUS_FAILED;
     }
-    err = jvmti_env->GetMethodName(method,
-        &watch.m_name, &watch.m_sig, &generic);
+    err = jvmti_env->GetMethodName(method, &watch.m_name, &watch.m_sig, &generic);
     if (err != JVMTI_ERROR_NONE) {
         printf("(GetMethodName) unexpected error: %s (%d)\n",
                TranslateError(err), err);
@@ -335,8 +320,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -402,8 +386,7 @@
     if (printdump == JNI_TRUE) {
         printf(">>> setting field modification watches ...\n");
     }
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/FieldModification/fieldmod002a"));
+    cls = env->FindClass("nsk/jvmti/FieldModification/fieldmod002a");
     if (cls == NULL) {
         printf("Cannot find fieldmod001a class!\n");
         result = STATUS_FAILED;
@@ -411,11 +394,11 @@
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid = JNI_ENV_PTR(env)->GetFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(
+                cls, watches[i].f_name, watches[i].f_sig);
         }
         if (watches[i].fid == NULL) {
             printf("Cannot get field ID for \"%s:%s\"\n",
@@ -433,16 +416,11 @@
         }
     }
 
-    ctor = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "<init>", "()V");
-    obj1 = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env,
-        JNI_ENV_PTR(env)->NewObject(JNI_ENV_ARG(env, cls), ctor)));
-    obj2 = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env,
-        JNI_ENV_PTR(env)->NewObject(JNI_ENV_ARG(env, cls), ctor)));
-    arr1 = (jintArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env,
-        JNI_ENV_PTR(env)->NewIntArray(JNI_ENV_ARG(env, (jsize)1))));
-    arr2 = (jintArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env,
-        JNI_ENV_PTR(env)->NewIntArray(JNI_ENV_ARG(env, (jsize)1))));
+    ctor = env->GetMethodID(cls, "<init>", "()V");
+    obj1 = env->NewGlobalRef(env->NewObject(cls, ctor));
+    obj2 = env->NewGlobalRef(env->NewObject(cls, ctor));
+    arr1 = (jintArray) env->NewGlobalRef(env->NewIntArray((jsize) 1));
+    arr2 = (jintArray) env->NewGlobalRef(env->NewIntArray((jsize) 1));
 
     watches[0].val.z = JNI_TRUE;
     watches[1].val.b = 1;
@@ -480,60 +458,37 @@
         return PASSED;
     }
 
-
-
     if (printdump == JNI_TRUE) {
         printf(">>> modifying fields ...\n");
     }
 
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/FieldModification/fieldmod002a"));
+    cls = env->FindClass("nsk/jvmti/FieldModification/fieldmod002a");
     if (cls == NULL) {
         printf("Cannot find fieldmod001a class!\n");
         return STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(env)->SetStaticBooleanField(JNI_ENV_ARG(env, cls),
-        watches[0].fid, watches[0].val.z);
-    JNI_ENV_PTR(env)->SetStaticByteField(JNI_ENV_ARG(env, cls),
-        watches[1].fid, watches[1].val.b);
-    JNI_ENV_PTR(env)->SetStaticShortField(JNI_ENV_ARG(env, cls),
-        watches[2].fid, watches[2].val.s);
-    JNI_ENV_PTR(env)->SetStaticIntField(JNI_ENV_ARG(env, cls),
-        watches[3].fid, watches[3].val.i);
-    JNI_ENV_PTR(env)->SetStaticLongField(JNI_ENV_ARG(env, cls),
-        watches[4].fid, watches[4].val.j);
-    JNI_ENV_PTR(env)->SetStaticFloatField(JNI_ENV_ARG(env, cls),
-        watches[5].fid, watches[5].val.f);
-    JNI_ENV_PTR(env)->SetStaticDoubleField(JNI_ENV_ARG(env, cls),
-        watches[6].fid, watches[6].val.d);
-    JNI_ENV_PTR(env)->SetStaticCharField(JNI_ENV_ARG(env, cls),
-        watches[7].fid, watches[7].val.c);
-    JNI_ENV_PTR(env)->SetStaticObjectField(JNI_ENV_ARG(env, cls),
-        watches[8].fid, watches[8].val.l);
-    JNI_ENV_PTR(env)->SetStaticObjectField(JNI_ENV_ARG(env, cls),
-        watches[9].fid, watches[9].val.l);
+    env->SetStaticBooleanField(cls, watches[0].fid, watches[0].val.z);
+    env->SetStaticByteField(cls, watches[1].fid, watches[1].val.b);
+    env->SetStaticShortField(cls, watches[2].fid, watches[2].val.s);
+    env->SetStaticIntField(cls, watches[3].fid, watches[3].val.i);
+    env->SetStaticLongField(cls, watches[4].fid, watches[4].val.j);
+    env->SetStaticFloatField(cls, watches[5].fid, watches[5].val.f);
+    env->SetStaticDoubleField(cls, watches[6].fid, watches[6].val.d);
+    env->SetStaticCharField(cls, watches[7].fid, watches[7].val.c);
+    env->SetStaticObjectField(cls, watches[8].fid, watches[8].val.l);
+    env->SetStaticObjectField(cls, watches[9].fid, watches[9].val.l);
 
-    JNI_ENV_PTR(env)->SetBooleanField(JNI_ENV_ARG(env, obj),
-        watches[10].fid, watches[10].val.z);
-    JNI_ENV_PTR(env)->SetByteField(JNI_ENV_ARG(env, obj),
-        watches[11].fid, watches[11].val.b);
-    JNI_ENV_PTR(env)->SetShortField(JNI_ENV_ARG(env, obj),
-        watches[12].fid, watches[12].val.s);
-    JNI_ENV_PTR(env)->SetIntField(JNI_ENV_ARG(env, obj),
-        watches[13].fid, watches[13].val.i);
-    JNI_ENV_PTR(env)->SetLongField(JNI_ENV_ARG(env, obj),
-        watches[14].fid, watches[14].val.j);
-    JNI_ENV_PTR(env)->SetFloatField(JNI_ENV_ARG(env, obj),
-        watches[15].fid, watches[15].val.f);
-    JNI_ENV_PTR(env)->SetDoubleField(JNI_ENV_ARG(env, obj),
-        watches[16].fid, watches[16].val.d);
-    JNI_ENV_PTR(env)->SetCharField(JNI_ENV_ARG(env, obj),
-        watches[17].fid, watches[17].val.c);
-    JNI_ENV_PTR(env)->SetObjectField(JNI_ENV_ARG(env, obj),
-        watches[18].fid, watches[18].val.l);
-    JNI_ENV_PTR(env)->SetObjectField(JNI_ENV_ARG(env, obj),
-        watches[19].fid, watches[19].val.l);
+    env->SetBooleanField(obj, watches[10].fid, watches[10].val.z);
+    env->SetByteField(obj, watches[11].fid, watches[11].val.b);
+    env->SetShortField(obj, watches[12].fid, watches[12].val.s);
+    env->SetIntField(obj, watches[13].fid, watches[13].val.i);
+    env->SetLongField(obj, watches[14].fid, watches[14].val.j);
+    env->SetFloatField(obj, watches[15].fid, watches[15].val.f);
+    env->SetDoubleField(obj, watches[16].fid, watches[16].val.d);
+    env->SetCharField(obj, watches[17].fid, watches[17].val.c);
+    env->SetObjectField(obj, watches[18].fid, watches[18].val.l);
+    env->SetObjectField(obj, watches[19].fid, watches[19].val.l);
 
     if (printdump == JNI_TRUE) {
         printf(">>> ... done\n");
@@ -547,6 +502,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "JVMTITools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -272,6 +270,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -94,6 +92,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -138,6 +136,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop001/framepop001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop001/framepop001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -188,8 +175,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -249,8 +235,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "chain", "()V");
+    mid = env->GetStaticMethodID(cls, "chain", "()V");
     if (mid == 0) {
         printf("Cannot find Method ID for method chain\n");
         return STATUS_FAILED;
@@ -276,20 +261,18 @@
         result = STATUS_FAILED;
     }
 
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/FramePop/framepop001a"));
+    clz = env->FindClass("nsk/jvmti/FramePop/framepop001a");
     if (clz == NULL) {
         printf("Cannot find framepop001a class!\n");
         result = STATUS_FAILED;
         return STATUS_FAILED;
     }
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clz),
-        "dummy", "()V");
+    mid = env->GetStaticMethodID(clz, "dummy", "()V");
     if (mid == 0) {
         printf("Cannot find Method ID for method dummy\n");
         return STATUS_FAILED;
     }
-    JNI_ENV_PTR(env)->CallStaticVoidMethod(JNI_ENV_ARG(env, clz), mid);
+    env->CallStaticVoidMethod(clz, mid);
 
     if (eventsCount != eventsExpected) {
         printf("Wrong number of frame pop events: %" PRIuPTR ", expected: %" PRIuPTR "\n",
@@ -300,6 +283,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop002/framepop002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop002/framepop002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,21 +29,8 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -139,8 +126,7 @@
     int i, count = 0;
 
     for (i = 0; i < thr_count; i++) {
-        if (JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, threads[i].thread),
-                thr) == JNI_TRUE) {
+        if (env->IsSameObject(threads[i].thread, thr)) {
             break;
         }
     }
@@ -184,8 +170,7 @@
     int i;
 
     for (i = 0; i < thr_count; i++) {
-        if (JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, threads[i].thread),
-                thr) == JNI_TRUE) {
+        if (env->IsSameObject(threads[i].thread, thr)) {
             break;
         }
     }
@@ -332,8 +317,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -436,6 +420,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -243,6 +241,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -155,6 +153,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -244,6 +242,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -220,6 +218,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -34,15 +34,6 @@
 
 extern "C" {
 
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
-
 #define PASSED  0
 #define STATUS_FAILED  2
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,15 +29,6 @@
 
 extern "C" {
 
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
-
 #define PASSED  0
 #define STATUS_FAILED  2
 
@@ -89,7 +80,7 @@
        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(JNI_ENV_ARG1(vm))) != 0)
+    if ((err = vm->DetachCurrentThread()) != 0)
         printf("(%s,%d): Warning: DetachCurrentThread() returns: %d\n\
 \tcheck with the detached main thread skipped\n",
             __FILE__, __LINE__, err);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -184,6 +182,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -65,8 +52,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -124,6 +110,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -66,8 +53,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -140,6 +126,4 @@
     return JNI_FALSE;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -115,6 +101,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -125,6 +111,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -116,7 +102,7 @@
         return STATUS_FAILED;
     }
 
-    fid = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld", "I");
+    fid = env->GetFieldID(cls, "fld", "I");
     if (fid == NULL) {
         printf("Cannot get field ID!\n");
         return STATUS_FAILED;
@@ -168,6 +154,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -81,15 +68,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
-    if (res != JNI_OK || jvmti == NULL) {
-        printf("Wrong result of a valid call to GetEnv!\n");
-        return JNI_ERR;
-    }
-
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -141,8 +120,7 @@
     }
 
     for (i = 0; i < sizeof(fields) / sizeof(field_info); i++) {
-        fid = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, clazz),
-            fields[i].name, fields[i].sig);
+        fid = env->GetFieldID(clazz, fields[i].name, fields[i].sig);
         if (fid == NULL) {
             printf("(%" PRIuPTR ") cannot get field ID for %s:\"%s\"\n",
                    i, fields[i].name, fields[i].sig);
@@ -175,6 +153,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -115,6 +101,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -123,6 +109,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -89,9 +75,9 @@
     jboolean is_native;
 
     if (stat) {
-        mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cl), name, sig);
+        mid = env->GetStaticMethodID(cl, name, sig);
     } else {
-        mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cl), name, sig);
+        mid = env->GetMethodID(cl, name, sig);
     }
     if (mid == NULL) {
         printf("Cannot find MethodID for \"%s%s\"\n", name, sig);
@@ -129,8 +115,7 @@
     checkMeth(env, cls, "nmeth", "()V", 0, JNI_TRUE);
     checkMeth(env, cls, "check", "()I", 1, JNI_TRUE);
 
-    clsId = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/IsMethodNative/isnative001$Inn"));
+    clsId = env->FindClass("nsk/jvmti/IsMethodNative/isnative001$Inn");
     if (clsId == NULL) {
         printf("Cannot find nsk.jvmti.IsMethodNative.isnative001$Inn class!\n");
         return STATUS_FAILED;
@@ -141,6 +126,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -89,8 +75,7 @@
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "<init>", "()V");
+    mid = env->GetMethodID(cls, "<init>", "()V");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -123,6 +108,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -410,6 +408,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -93,8 +80,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -149,11 +135,9 @@
         cl = ((methods[i].class_id == 1) ? cls1 :
                 ((methods[i].class_id == 2) ? cls2 : cls3));
         if (methods[i].is_static == JNI_TRUE) {
-            mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cl),
-                methods[i].name, methods[i].signature);
+            mid = env->GetStaticMethodID(cl, methods[i].name, methods[i].signature);
         } else {
-            mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cl),
-                methods[i].name, methods[i].signature);
+            mid = env->GetMethodID(cl, methods[i].name, methods[i].signature);
         }
         if (mid == NULL) {
             printf("Cannot find MethodID for \"%s%s\"\n",
@@ -190,6 +174,4 @@
 Java_nsk_jvmti_IsMethodSynthetic_issynth001a_nmeth(JNIEnv *env, jclass cls) {
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -116,8 +102,7 @@
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "<init>", "()V");
+    mid = env->GetMethodID(cls, "<init>", "()V");
     if (mid == NULL) {
         printf("Cannot find method \"<init>()V\"!\n");
         return STATUS_FAILED;
@@ -156,6 +141,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -567,6 +565,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -575,6 +573,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -576,6 +574,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static JNIEnv *jni = NULL;
 static jvmtiEnv *jvmti = NULL;
@@ -279,6 +277,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -189,6 +187,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -150,6 +148,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -179,6 +177,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -586,6 +584,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -594,6 +592,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -595,6 +593,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -215,6 +213,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -198,6 +196,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -160,6 +158,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -190,6 +188,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -545,6 +543,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -237,6 +235,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -219,6 +217,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -189,6 +187,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -221,6 +219,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -738,6 +736,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static JNIEnv *jni = NULL;
 static jvmtiEnv *jvmti = NULL;
@@ -513,6 +511,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -349,6 +347,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -269,6 +267,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -346,6 +344,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include "jvmti_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static int timeout = 0;
 
@@ -159,6 +157,4 @@
   return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include "jvmti_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATIC_FIELD 0x0008
 
@@ -639,6 +637,4 @@
   return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include "jvmti_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define TEST_OBJECT_TAG 0x8000
 #define EXPECTED_NON_PRIMITIVES_COUNT 1
@@ -313,6 +311,4 @@
   return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include "jvmti_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATIC_FIELD 0x0008
 
@@ -607,6 +605,4 @@
   return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include "jvmti_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 //expected values
 #define EXPECTED_PRIMITIVES 2
@@ -242,6 +240,4 @@
   return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodEntry/mentry001/mentry001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodEntry/mentry001/mentry001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,21 +29,7 @@
 #include "jni_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -170,8 +156,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -240,14 +225,13 @@
 Java_nsk_jvmti_MethodEntry_mentry001_check(JNIEnv *env, jclass cls) {
     jmethodID mid;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "dummy", "()V");
+    mid = env->GetStaticMethodID(cls, "dummy", "()V");
     if (mid == NULL) {
         printf("Cannot find metod \"dummy()\"!\n");
         return STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(env)->CallStaticVoidMethod(JNI_ENV_ARG(env, cls), mid);
+    env->CallStaticVoidMethod(cls, mid);
     if (eventsCount != eventsExpected) {
         printf("Wrong number of MethodEntry events: %" PRIuPTR ", expected: %" PRIuPTR "\n",
             eventsCount, eventsExpected);
@@ -279,6 +263,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodEntry/mentry002/mentry002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodEntry/mentry002/mentry002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -91,8 +78,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -150,8 +136,7 @@
         return;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-            "emptyMethod", "()V");
+    mid = env->GetStaticMethodID(cls, "emptyMethod", "()V");
     if (mid == NULL) {
         printf("Cannot find Method ID for emptyMethod\n");
         result = STATUS_FAILED;
@@ -198,6 +183,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit001/mexit001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit001/mexit001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,21 +29,8 @@
 #include "jni_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -172,8 +159,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -252,21 +238,19 @@
         return result;
     }
 
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/MethodExit/mexit001a"));
+    clz = env->FindClass("nsk/jvmti/MethodExit/mexit001a");
     if (clz == NULL) {
         printf("Cannot find nsk.jvmti.MethodExit.mexit001a class!\n");
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clz),
-        "dummy", "()V");
+    mid = env->GetStaticMethodID(clz, "dummy", "()V");
     if (mid == NULL) {
         printf("Cannot find metod \"dummy()\"!\n");
         return STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(env)->CallStaticVoidMethod(JNI_ENV_ARG(env, clz), mid);
+    env->CallStaticVoidMethod(clz, mid);
 
     err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,
             JVMTI_EVENT_METHOD_EXIT, NULL);
@@ -289,6 +273,4 @@
     printf("Executing chain()\n");
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit002/mexit002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit002/mexit002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,21 +29,8 @@
 #include "jni_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -172,8 +159,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -230,15 +216,13 @@
         return result;
     }
 
-    clz = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/MethodExit/mexit002a"));
+    clz = env->FindClass("nsk/jvmti/MethodExit/mexit002a");
     if (clz == NULL) {
         printf("Failed to find class \"mexit002a\"!\n");
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clz),
-        "dummy", "()V");
+    mid = env->GetStaticMethodID(clz, "dummy", "()V");
     if (mid == NULL) {
         printf("Failed to get method \"dummy\"!\n");
         return STATUS_FAILED;
@@ -254,7 +238,7 @@
         result = STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(env)->CallStaticVoidMethod(JNI_ENV_ARG(env, clz), mid);
+    env->CallStaticVoidMethod(clz, mid);
 
     err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,
             JVMTI_EVENT_METHOD_EXIT, NULL);
@@ -279,6 +263,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEnter/mcontenter001/mcontenter001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEnter/mcontenter001/mcontenter001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -265,6 +263,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEntered/mcontentered001/mcontentered001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorContendedEntered/mcontentered001/mcontentered001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -293,6 +291,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWait/monitorwait001/monitorwait001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWait/monitorwait001/monitorwait001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -268,6 +266,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWaited/monitorwaited001/monitorwaited001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MonitorWaited/monitorwaited001/monitorwaited001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -269,6 +267,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind001/nativemethbind001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -255,6 +253,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind002/nativemethbind002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -186,6 +184,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind003/nativemethbind003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -249,6 +247,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NativeMethodBind/nativemethbind004/nativemethbind004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -219,6 +217,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -63,8 +50,7 @@
         jmethodID method, jboolean wasPopedByException) {
     jvmtiError err;
 
-    popThread = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG((JNIEnv *)env,
-        thread));
+    popThread = env->NewGlobalRef(thread);
 
     err = jvmti_env->GetMethodDeclaringClass(method, &popClass);
     if (err != JVMTI_ERROR_NONE) {
@@ -72,8 +58,7 @@
                TranslateError(err), err);
         result = STATUS_FAILED;
     }
-    popClass = (jclass) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG((JNIEnv *)env,
-        popClass));
+    popClass = (jclass) env->NewGlobalRef(popClass);
 
     popMethod = method;
     popFlag = wasPopedByException;
@@ -95,8 +80,7 @@
     jvmtiError err;
 
     if (method == mid1 || method == mid2) {
-        currThread = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG((JNIEnv *)env,
-            thread));
+        currThread = env->NewGlobalRef(thread);
 
         err = jvmti_env->GetMethodDeclaringClass(
             method, &currClass);
@@ -105,8 +89,7 @@
                    TranslateError(err), err);
             result = STATUS_FAILED;
         }
-        currClass = (jclass) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG((JNIEnv *)env,
-            currClass));
+        currClass = (jclass) env->NewGlobalRef(currClass);
 
         currMethod = method;
 
@@ -147,8 +130,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -215,16 +197,14 @@
         }
     }
 
-    mid1 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cl),
-        "meth01", "(I)V");
+    mid1 = env->GetMethodID(cl, "meth01", "(I)V");
     if (mid1 == NULL) {
         printf("Cannot find method \"meth01\"\n");
         result = STATUS_FAILED;
         return;
     }
 
-    mid2 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cl),
-        "meth02", "(I)V");
+    mid2 = env->GetMethodID(cl, "meth02", "(I)V");
     if (mid2 == NULL) {
         printf("Cannot find method \"meth02\"\n");
         result = STATUS_FAILED;
@@ -259,19 +239,17 @@
         result = STATUS_FAILED;
     }
 
-    currThread = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, thr));
+    currThread = env->NewGlobalRef(thr);
 
-    currClass = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/NotifyFramePop/nframepop001a"));
+    currClass = env->FindClass("nsk/jvmti/NotifyFramePop/nframepop001a");
     if (currClass == NULL) {
         printf("Cannot find nsk.jvmti.NotifyFramePop.nframepop001a class!\n");
         result = STATUS_FAILED;
         return;
     }
-    currClass = (jclass) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, currClass));
+    currClass = (jclass) env->NewGlobalRef(currClass);
 
-    currMethod = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, currClass),
-        "run", "()V");
+    currMethod = env->GetMethodID(currClass, "run", "()V");
     if (currMethod == NULL) {
         printf("Cannot find method \"run\"\n");
         result = STATUS_FAILED;
@@ -310,14 +288,12 @@
         return;
     }
 
-    if (JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, currThread),
-            popThread) != JNI_TRUE) {
+    if (!env->IsSameObject(currThread, popThread)) {
         printf("Point %d: thread is not the same as expected\n", point);
         result = STATUS_FAILED;
     }
 
-    if (JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, currClass),
-            popClass) != JNI_TRUE) {
+    if (!env->IsSameObject(currClass, popClass)) {
         printf("Point %d: class is not the same as expected\n", point);
         result = STATUS_FAILED;
     }
@@ -352,6 +328,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -65,8 +52,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -123,6 +109,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -65,8 +52,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -133,6 +119,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -299,6 +297,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -327,6 +325,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -195,8 +182,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -257,6 +243,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -211,8 +198,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -268,6 +254,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -196,8 +183,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -258,6 +244,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -220,8 +207,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -289,12 +275,10 @@
 
 void nativeMeth2(JNIEnv *env, jobject obj, jint vrb,
         jobject frameThr) {
-    jclass cls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, frameThr));
+    jclass cls = env->GetObjectClass(frameThr);
     jmethodID mid = NULL;
 
-    if ((mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "activeMethod", "()V")) == NULL) {
+    if ((mid = env->GetMethodID(cls, "activeMethod", "()V")) == NULL) {
         printf("TEST FAILURE: nativeMeth2(): Unable to get method ID\n");
         tot_result = STATUS_FAILED;
         return;
@@ -303,7 +287,7 @@
         printf("nativeMeth2(): calling the Java activeMethod()\n");
         fflush(stdout);
     }
-    JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG(env, frameThr), mid);
+    env->CallVoidMethod(frameThr, mid);
 }
 
 JNIEXPORT void JNICALL
@@ -316,6 +300,4 @@
     nativeMeth2(env, obj, vrb, frameThr);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <jvmti_tools.h>
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 // Deallocate memory region allocated by VM
 #define DEALLOCATE(p) \
@@ -391,6 +389,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -364,8 +351,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -435,39 +421,35 @@
         return;
     }
 
-    clazz = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, thr));
+    clazz = env->GetObjectClass(thr);
     if (clazz == NULL) {
         printf("Cannot get the class of thread object\n");
         result = STATUS_FAILED;
         return;
     }
 
-    mid_run = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-        "run", "()V");
+    mid_run = env->GetMethodID(clazz, "run", "()V");
     if (mid_run == NULL) {
         printf("Cannot find Method ID for method \"run\"\n");
         result = STATUS_FAILED;
         return;
     }
 
-    mid_A = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clazz),
-        "A", "()V");
+    mid_A = env->GetStaticMethodID(clazz, "A", "()V");
     if (mid_A == NULL) {
         printf("Cannot find Method ID for method \"A\"\n");
         result = STATUS_FAILED;
         return;
     }
 
-    mid_B = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clazz),
-        "B", "()V");
+    mid_B = env->GetStaticMethodID(clazz, "B", "()V");
     if (mid_B == NULL) {
         printf("Cannot find Method ID for method \"B\"\n");
         result = STATUS_FAILED;
         return;
     }
 
-    mid_C = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clazz),
-        "C", "()V");
+    mid_C = env->GetStaticMethodID(clazz, "C", "()V");
     if (mid_C == NULL) {
         printf("Cannot find Method ID for method \"C\"\n");
         result = STATUS_FAILED;
@@ -529,6 +511,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -103,8 +90,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -166,15 +152,14 @@
         return;
     }
 
-    clazz = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, thr));
+    clazz = env->GetObjectClass(thr);
     if (clazz == NULL) {
         printf("Cannot get class of the thread object\n");
         result = STATUS_FAILED;
         return;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, clazz),
-        "C", "()V");
+    mid = env->GetStaticMethodID(clazz, "C", "()V");
     if (mid == NULL) {
         printf("Cannot find Method ID for method \"C\"\n");
         result = STATUS_FAILED;
@@ -206,10 +191,8 @@
 JNIEXPORT void JNICALL
 Java_nsk_jvmti_PopFrame_popframe007_B(JNIEnv *env, jclass cls) {
     if (mid != NULL) {
-        JNI_ENV_PTR(env)->CallStaticVoidMethod(JNI_ENV_ARG(env, cls), mid);
+        env->CallStaticVoidMethod(cls, mid);
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -212,8 +199,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -279,22 +265,21 @@
         return;
     }
 
-    clazz = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, thr));
+    clazz = env->GetObjectClass(thr);
     if (clazz == NULL) {
         printf("Cannot get class of the thread object\n");
         result = STATUS_FAILED;
         return;
     }
 
-    midD = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz), "D", "()V");
+    midD = env->GetMethodID(clazz, "D", "()V");
     if (midD == NULL) {
         printf("Cannot get Method ID for method \"D\"\n");
         result = STATUS_FAILED;
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-        "run", "()V");
+    midRun = env->GetMethodID(clazz, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot get Method ID for method \"run\"\n");
         result = STATUS_FAILED;
@@ -328,6 +313,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -182,8 +169,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -251,8 +237,7 @@
         return;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetStaticMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         result = STATUS_FAILED;
@@ -426,21 +411,19 @@
         result = STATUS_FAILED;
     }
 
-    midFibonacci = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "fibonacci", "(I)I");
+    midFibonacci = env->GetStaticMethodID(cls, "fibonacci", "(I)I");
     if (midFibonacci == NULL) {
         printf("Cannot get method ID for method \"fibonacci\"\n");
         result = STATUS_FAILED;
     }
 
-    clazz = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, thr));
+    clazz = env->GetObjectClass(thr);
     if (clazz == NULL) {
         printf("Cannot get class of thread object\n");
         return STATUS_FAILED;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-        "run", "()V");
+    midRun = env->GetMethodID(clazz, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot get method ID for \"run\"\n");
         return STATUS_FAILED;
@@ -608,6 +591,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -249,8 +236,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -314,16 +300,14 @@
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         result = STATUS_FAILED;
         return;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         result = STATUS_FAILED;
@@ -359,6 +343,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -257,8 +244,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -314,6 +300,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -119,8 +106,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -194,6 +180,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -105,6 +91,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -107,6 +93,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -74,8 +61,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -137,15 +123,14 @@
         return STATUS_FAILED;
     }
 
-    threads_limit = JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, threads));
+    threads_limit = env->GetArrayLength(threads);
 
     if (printdump == JNI_TRUE) {
         printf(">>> starting %d threads ...\n", threads_limit);
     }
 
     for (i = 0; i < threads_limit; i++) {
-        thr = JNI_ENV_PTR(env)->GetObjectArrayElement(JNI_ENV_ARG(env,
-            threads), i);
+        thr = env->GetObjectArrayElement(threads, i);
         err = jvmti->RunAgentThread(thr, increment_thread, NULL,
                                     JVMTI_THREAD_NORM_PRIORITY);
         if (err != JVMTI_ERROR_NONE) {
@@ -192,6 +177,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -132,8 +119,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -220,6 +206,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -105,6 +91,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -107,6 +93,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -114,6 +100,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -145,8 +132,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -246,6 +232,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -105,6 +91,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -107,6 +93,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -113,6 +99,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -145,8 +132,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -246,6 +232,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -105,6 +91,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -107,6 +93,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -113,6 +99,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -146,8 +133,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -247,6 +233,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -69,8 +56,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -106,6 +92,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -71,8 +58,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -108,6 +94,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -69,8 +56,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -114,6 +100,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -74,8 +61,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -300,6 +286,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -53,8 +40,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -104,11 +90,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes),
-            NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (fl == 2) {
         printf(">>>>>>>> Invoke RedefineClasses():\n");
@@ -128,6 +111,4 @@
     return PASSED;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefineWithoutBytecodeCorruption/TestDescription.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefineWithoutBytecodeCorruption/TestDescription.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,6 +32,7 @@
  *          /test/lib
  * @run driver jdk.test.lib.FileInstaller . .
  * @run main/othervm/native
+ *      -Xlog:redefine+class+iklass+purge=trace,redefine+class+iklass+add=trace
  *      -agentlib:stressRedefine
  *      nsk.jvmti.RedefineClasses.StressRedefine
  *      ./bin
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -64,8 +51,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -115,11 +101,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes),
-            NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (fl == 2) {
         printf(">>>>>>>> Invoke RedefineClasses():\n");
@@ -139,6 +122,4 @@
     return PASSED;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -64,8 +51,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -155,10 +141,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (vrb == 1)
         printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
@@ -175,6 +159,4 @@
     return PASSED;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -66,8 +53,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -118,10 +104,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (vrb == 1)
         printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
@@ -153,23 +137,19 @@
     jint intFld;
     jlong longFld;
 
-    if ((fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, redefCls),
-        "intComplNewFld", "I")) == NULL) {
+    if ((fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I")) == NULL) {
         printf("%s: Failed to get the field ID for the static field \"intComplNewFld\"\n",
             __FILE__);
         return STATUS_FAILED;
     }
-    intFld = JNI_ENV_PTR(env)->GetStaticIntField(JNI_ENV_ARG(env, redefCls),
-        fid);
+    intFld = env->GetStaticIntField(redefCls, fid);
 
-    if ((fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, redefCls),
-        "longComplNewFld", "J")) == NULL) {
+    if ((fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J")) == NULL) {
         printf("%s: Failed to get the field ID for the static field \"longComplNewFld\"\n",
             __FILE__);
         return STATUS_FAILED;
     }
-    longFld = JNI_ENV_PTR(env)->GetStaticLongField(JNI_ENV_ARG(env, redefCls),
-        fid);
+    longFld = env->GetStaticLongField(redefCls, fid);
 
     if (intFld != 33 || longFld != 44) {
         printf("Completely new static variable has not assigned its default value:\n");
@@ -184,6 +164,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -71,8 +58,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -123,10 +109,8 @@
 
 /* fill the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (vrb == 1)
         printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
@@ -154,8 +138,7 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_RedefineClasses_redefclass004_checkNewFields(JNIEnv *env,
         jobject obj, jint vrb, jobject redefObj) {
-    jclass redefCls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, redefObj));
+    jclass redefCls = env->GetObjectClass(redefObj);
     jfieldID fid;
     jint intFld;
     jlong longFld;
@@ -163,34 +146,29 @@
     const char *strFld = NULL;
 
 /* get value of new instance field "intComplNewFld" */
-    if ((fid = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, redefCls),
-        "intComplNewFld", "I")) == NULL) {
+    if ((fid = env->GetFieldID(redefCls, "intComplNewFld", "I")) == NULL) {
         printf("%s: Failed to get the field ID for the field \"intComplNewFld\"\n",
             __FILE__);
         return STATUS_FAILED;
     }
-    intFld = JNI_ENV_PTR(env)->GetIntField(JNI_ENV_ARG(env, redefObj), fid);
+    intFld = env->GetIntField(redefObj, fid);
 
 /* get value of new instance field "longComplNewFld" */
-    if ((fid = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, redefCls),
-        "longComplNewFld", "J")) == NULL) {
+    if ((fid = env->GetFieldID(redefCls, "longComplNewFld", "J")) == NULL) {
         printf("%s: Failed to get the field ID for the field \"longComplNewFld\"\n",
             __FILE__);
         return STATUS_FAILED;
     }
-    longFld = JNI_ENV_PTR(env)->GetLongField(JNI_ENV_ARG(env, redefObj), fid);
+    longFld = env->GetLongField(redefObj, fid);
 
 /* get value of new instance field "stringComplNewFld" */
-    if ((fid = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, redefCls),
-        "stringComplNewFld", "Ljava/lang/String;")) == NULL) {
+    if ((fid = env->GetFieldID(redefCls, "stringComplNewFld", "Ljava/lang/String;")) == NULL) {
         printf("%s: Failed to get the field ID for the field \"stringComplNewFld\"\n",
             __FILE__);
         return STATUS_FAILED;
     }
-    stringObj = (jstring) JNI_ENV_PTR(env)->GetObjectField(JNI_ENV_ARG(env,
-        redefObj), fid);
-    strFld = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env,
-        stringObj), 0);
+    stringObj = (jstring) env->GetObjectField(redefObj, fid);
+    strFld = env->GetStringUTFChars(stringObj, 0);
 
     if (intFld != INTFLD || longFld != LONGFLD ||
         strcmp(strFld, STRFLD) != 0) {
@@ -201,8 +179,7 @@
         printf(",\texpected %" LL "d\n", LONGFLD);
         printf("\tstringComplNewFld = \"%s\",\texpected \"%s\"\n",
             strFld, STRFLD);
-        JNI_ENV_PTR(env)->ReleaseStringUTFChars(JNI_ENV_ARG(env,
-            stringObj), strFld);
+        env->ReleaseStringUTFChars(stringObj, strFld);
         return STATUS_FAILED;
     } else {
         if (vrb == 1)
@@ -210,12 +187,9 @@
 \tstringComplNewFld = \"%s\"\n\tintComplNewFld = %d\n\
 \tlongComplNewFld = %" LL "d\n",
                 strFld, intFld, longFld);
-        JNI_ENV_PTR(env)->ReleaseStringUTFChars(JNI_ENV_ARG(env,
-            stringObj), strFld);
+        env->ReleaseStringUTFChars(stringObj, strFld);
         return PASSED;
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -119,8 +106,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -213,10 +199,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     set_watch_ev(1); /* watch JVMTI events */
 
@@ -250,6 +234,4 @@
     return(result);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -64,8 +51,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -132,8 +118,7 @@
         case 2:
             /* partly fill the structure jvmtiClassDefinition */
             classDef.klass = redefCls;
-            classDef.class_byte_count =
-                JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
+            classDef.class_byte_count = env->GetArrayLength(classBytes);
             classDef.class_bytes = NULL;
             classDefPtr = &classDef;
             break;
@@ -150,6 +135,4 @@
     return PASSED;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define BP_NUM 5 /* overall number of breakpoints */
 
@@ -90,8 +77,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -146,25 +132,24 @@
         return PASSED;
     }
 
-    redefCls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, redefObj));
+    redefCls = env->GetObjectClass(redefObj);
 
     for (i=0; i<BP_NUM; i++) {
 /* get the JNI method ID for a method with name m_name and
    signature m_sign */
         if (breakpoints[i].inst) { /* an instance method */
-            if ((breakpoints[i].mid =
-                    JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, redefCls),
-                    breakpoints[i].m_name, breakpoints[i].m_sign)) == NULL) {
+            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",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
                 return STATUS_FAILED;
             }
         } else {                   /* a static method */
-            if ((breakpoints[i].mid =
-                    JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, redefCls),
-                    breakpoints[i].m_name, breakpoints[i].m_sign)) == NULL) {
+            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",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
@@ -215,10 +200,8 @@
 
 /* fill the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (vrb == 1)
         printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
@@ -246,26 +229,25 @@
         return PASSED;
     }
 
-    redefCls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, redefObj));
+    redefCls = env->GetObjectClass(redefObj);
 
 /* all breakpoints should be cleared after the redefinition */
     for (i=0; i<BP_NUM; i++) {
 /* get again the JNI method ID for a method with name m_name and
    signature m_sign */
         if (breakpoints[i].inst) { /* an instance method */
-            if ((breakpoints[i].mid =
-                    JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, redefCls),
-                    breakpoints[i].m_name, breakpoints[i].m_sign)) == NULL) {
+            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",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
                 return STATUS_FAILED;
             }
         } else {                   /* a static method */
-            if ((breakpoints[i].mid =
-                    JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, redefCls),
-                    breakpoints[i].m_name, breakpoints[i].m_sign)) == NULL) {
+            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",
                     __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign);
@@ -303,6 +285,4 @@
     return totRes;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define METH_NUM 4 /* overall number of methods */
 
@@ -127,8 +114,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -178,16 +164,15 @@
     }
 
     for (i=0; i<METH_NUM; i++) {
-/* get the JNI method ID for a method with name m_name and
-   signature m_sign */
-        if (methodsInfo[i].inst) /* an instance method */
-            methodsInfo[i].mid =
-                JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, redefCls),
+      /* get the JNI method ID for a method with name m_name and
+         signature m_sign */
+        if (methodsInfo[i].inst) { /* an instance method */
+            methodsInfo[i].mid = env->GetMethodID(redefCls,
                 methodsInfo[i].m_name, methodsInfo[i].m_sign);
-        else                     /* a static method */
-            methodsInfo[i].mid =
-                JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, redefCls),
+        } else {                    /* a static method */
+            methodsInfo[i].mid = env->GetStaticMethodID(redefCls,
                 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",
@@ -196,7 +181,7 @@
             return STATUS_FAILED;
         }
 
-/* get the LocalVariableTable attribute */
+        /* get the LocalVariableTable attribute */
         if ((err = (jvmti->GetLocalVariableTable(methodsInfo[i].mid,
                 &count, &lv_table))) != JVMTI_ERROR_NONE) {
             printf("%s: Failed to call GetLocalVariableTable(): error=%d: %s\n",
@@ -250,9 +235,8 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_RedefineClasses_redefclass009_checkOrigAttr(JNIEnv *env,
         jclass cls, jobject redefObj) {
-    jclass redefCls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, redefObj));
-/* check only the number of local variables */
+    jclass redefCls = env->GetObjectClass(redefObj);
+    /* check only the number of local variables */
     return checkAttr(env, redefCls, origMethInfo, 0, 0);
 }
 
@@ -271,12 +255,10 @@
         return PASSED;
     }
 
-/* fill the structure jvmtiClassDefinition */
+    /* fill the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (vrb)
         printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
@@ -296,12 +278,8 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_RedefineClasses_redefclass009_getResult(JNIEnv *env,
         jclass cls, jint vrb, jobject redefObj) {
-    jclass redefCls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, redefObj));
-
+    jclass redefCls = env->GetObjectClass(redefObj);
     return checkAttr(env, redefCls, redefMethInfo, vrb, 1);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define METH_NUM 4 /* overall number of methods */
 
@@ -106,8 +93,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -156,16 +142,15 @@
     }
 
     for (i=0; i<METH_NUM; i++) {
-/* get the JNI method ID for a method with name m_name and
-   signature m_sign */
-        if (methodsInfo[i].inst) /* an instance method */
-            methodsInfo[i].mid =
-                JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, redefCls),
+        /* get the JNI method ID for a method with name m_name and
+           signature m_sign */
+        if (methodsInfo[i].inst) { /* an instance method */
+            methodsInfo[i].mid = env->GetMethodID(redefCls,
                     methodsInfo[i].m_name, methodsInfo[i].m_sign);
-        else                     /* a static method */
-            methodsInfo[i].mid =
-                JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, redefCls),
+        } else {                   /* a static method */
+            methodsInfo[i].mid = env->GetStaticMethodID(redefCls,
                     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",
@@ -174,7 +159,7 @@
             return STATUS_FAILED;
         }
 
-/* get the LineNumberTable attribute */
+        /* get the LineNumberTable attribute */
         if ((err = (jvmti->GetLineNumberTable(methodsInfo[i].mid,
                 &count, &ln_table))) != JVMTI_ERROR_NONE) {
             printf("%s: Failed to call GetLineNumberTable(): error=%d: %s\n",
@@ -228,9 +213,7 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_RedefineClasses_redefclass010_checkOrigAttr(JNIEnv *env,
         jclass cls, jobject redefObj) {
-    jclass redefCls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, redefObj));
-
+    jclass redefCls = env->GetObjectClass(redefObj);
     return checkAttr(env, redefCls, origMethInfo, 2);
 }
 
@@ -249,12 +232,10 @@
         return PASSED;
     }
 
-/* fill the structure jvmtiClassDefinition */
+    /* fill the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (vrb)
         printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n",
@@ -274,12 +255,8 @@
 JNIEXPORT jint JNICALL
 Java_nsk_jvmti_RedefineClasses_redefclass010_getResult(JNIEnv *env,
     jclass cls, jint vrb, jobject redefObj) {
-    jclass redefCls =
-        JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, redefObj));
-
+    jclass redefCls = env->GetObjectClass(redefObj);
     return checkAttr(env, redefCls, redefMethInfo, vrb);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = NULL;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> invalid class check ...\n");
@@ -142,6 +126,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -118,10 +104,8 @@
     }
 
     classDef.klass = cls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, jbytes));
-    bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, jbytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(jbytes);
+    bytes = (unsigned char *) env->GetByteArrayElements(jbytes, NULL);
 
     /* put 0,0 into version fields */
     bytes[4] = 0;
@@ -151,6 +135,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -118,10 +104,8 @@
     }
 
     classDef.klass = cls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, jbytes));
-    bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, jbytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(jbytes);
+    bytes = (unsigned char *) env->GetByteArrayElements(jbytes, NULL);
 
     /* put 0 into magic field */
     bytes[0] = 0;
@@ -151,6 +135,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -123,10 +109,8 @@
     }
 
     classDef.klass = cls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> circularity error check ...\n");
@@ -150,6 +134,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> verify error check ...\n");
@@ -142,6 +126,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -157,11 +144,8 @@
     bpeakpointsCount++;
 
     classDef.klass = klass;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG((JNIEnv *)env, classBytes));
-    bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG((JNIEnv *)env,
-            classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     for (i = 0; i < classDef.class_byte_count - 3; i++) {
         if (((jint)bytes[i+3] |
@@ -219,8 +203,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -292,14 +275,14 @@
         !caps.can_get_line_numbers ||
         !caps.can_access_local_variables) return;
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz), "run", "()V");
+    mid = env->GetMethodID(clazz, "run", "()V");
     if (mid == NULL) {
         printf("Cannot find Method ID for method run\n");
         result = STATUS_FAILED;
         return;
     }
 
-    classBytes = (jbyteArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, bytes));
+    classBytes = (jbyteArray) env->NewGlobalRef(bytes);
 
     err = jvmti->GetLineNumberTable(mid, &entryCount, &lines);
     if (err != JVMTI_ERROR_NONE) {
@@ -353,6 +336,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -75,11 +62,9 @@
     }
 
     classDef.klass = klass;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG((JNIEnv *)env, classBytes));
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
     classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG((JNIEnv *)env,
-            classBytes), NULL);
+        env->GetByteArrayElements(classBytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> bp: about to call RedefineClasses\n");
@@ -112,8 +97,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -173,15 +157,14 @@
     if (!caps.can_redefine_classes ||
         !caps.can_generate_breakpoint_events) return;
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-        "checkPoint", "()V");
+    mid = env->GetMethodID(clazz, "checkPoint", "()V");
     if (mid == NULL) {
         printf("Cannot find Method ID for method run\n");
         result = STATUS_FAILED;
         return;
     }
 
-    classBytes = (jbyteArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, bytes));
+    classBytes = (jbyteArray) env->NewGlobalRef(bytes);
 
     err = jvmti->SetBreakpoint(mid, 0);
     if (err != JVMTI_ERROR_NONE) {
@@ -205,6 +188,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -78,11 +65,8 @@
     }
 
     classDef.klass = klass;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG((JNIEnv *)env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG((JNIEnv *)env,
-            classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> about to call RedefineClasses\n");
@@ -115,8 +99,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -177,7 +160,7 @@
     if (!caps.can_redefine_classes ||
         !caps.can_generate_exception_events) return;
 
-    classBytes = (jbyteArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, bytes));
+    classBytes = (jbyteArray) env->NewGlobalRef(bytes);
 
     if ((err = (jvmti->GetCurrentThread(&thread))) != JVMTI_ERROR_NONE) {
         printf("Failed to get current thread: %s (%d)\n", TranslateError(err), err);
@@ -199,6 +182,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -316,11 +303,9 @@
     }
 
     classDef.klass = klass;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG((JNIEnv *)env, classBytes));
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
     classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG((JNIEnv *)env,
-            classBytes), NULL);
+        env->GetByteArrayElements(classBytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> about to call RedefineClasses\n");
@@ -381,8 +366,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -455,18 +439,16 @@
         !caps.can_get_line_numbers ||
         !caps.can_access_local_variables) return;
 
-    classBytes = (jbyteArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, bytes));
+    classBytes = (jbyteArray) env->NewGlobalRef(bytes);
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-         "run", "()V");
+    midRun = env->GetMethodID(clazz, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         result = STATUS_FAILED;
         return;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(clazz, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         result = STATUS_FAILED;
@@ -511,6 +493,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> add method capability check ...\n");
@@ -145,6 +129,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> delete method capability check ...\n");
@@ -144,6 +128,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> change fields capability check ...\n");
@@ -145,6 +129,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> change implemented interface capability check ...\n");
@@ -145,6 +129,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> change class modifiers capability check ...\n");
@@ -145,6 +129,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> change method modifiers capability check ...\n");
@@ -145,6 +129,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -117,10 +103,8 @@
     }
 
     classDef.klass = clazz;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, bytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, bytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(bytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> changed class name check ...\n");
@@ -142,6 +126,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "JVMTITools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -311,10 +298,8 @@
     jvmtiError err;
 
     classDef.klass = cls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (printdump == JNI_TRUE) {
         printf(">>> about to call RedefineClasses %d\n", redefinesCount);
@@ -615,8 +600,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -713,24 +697,21 @@
         !caps.can_get_line_numbers ||
         !caps.can_access_local_variables) return;
 
-    classBytes = (jbyteArray) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, bytes));
+    classBytes = (jbyteArray) env->NewGlobalRef(bytes);
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-         "run", "()V");
+    midRun = env->GetMethodID(clazz, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         result = STATUS_FAILED;
     }
 
-    mid1 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-         "method1", "(I)V");
+    mid1 = env->GetMethodID(clazz, "method1", "(I)V");
     if (mid1 == NULL) {
         printf("Cannot find Method ID for method1\n");
         result = STATUS_FAILED;
     }
 
-    mid2 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, clazz),
-         "method2", "(I)V");
+    mid2 = env->GetMethodID(clazz, "method2", "(I)V");
     if (mid2 == NULL) {
         printf("Cannot find Method ID for method2\n");
         result = STATUS_FAILED;
@@ -755,8 +736,7 @@
         }
     }
 
-    fid1 = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, clazz),
-        "staticInt", "I");
+    fid1 = env->GetStaticFieldID(clazz, "staticInt", "I");
     if (fid1 == NULL) {
         printf("Cannot find Field ID for staticInt\n");
         result = STATUS_FAILED;
@@ -781,8 +761,7 @@
         }
     }
 
-    fid2 = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, clazz),
-        "instanceInt", "I");
+    fid2 = env->GetFieldID(clazz, "instanceInt", "I");
     if (fid2 == NULL) {
         printf("Cannot find Field ID for instanceInt\n");
         result = STATUS_FAILED;
@@ -848,6 +827,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -289,6 +287,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -288,6 +286,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -289,6 +287,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -90,8 +77,7 @@
     jint res;
     jvmtiError err;
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -163,10 +149,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes), NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     set_watch_ev(1); /* watch JVMTI events */
 
@@ -201,6 +185,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -392,6 +390,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -381,6 +379,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jvmtiEnv* gJvmti = NULL;
 static volatile jboolean gGotEvent = JNI_FALSE;
@@ -102,6 +100,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -155,6 +153,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -194,6 +192,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -290,6 +288,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -351,6 +349,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <jvmti_tools.h>
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jvmtiEnv *jvmti = NULL;
 
@@ -168,8 +166,6 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
 
 /* ============================================================================= */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include <jvmti_tools.h>
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -284,8 +282,6 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
 
 /* ============================================================================= */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include <jvmti_tools.h>
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -181,8 +179,6 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
 
 /* ============================================================================= */
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -61,9 +48,9 @@
     jmethodID cid;
     jthread res;
 
-    thrClass = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, "java/lang/Thread"));
-    cid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, thrClass), "<init>", "()V");
-    res = JNI_ENV_PTR(env)->NewObject(JNI_ENV_ARG(env, thrClass), cid);
+    thrClass = env->FindClass("java/lang/Thread");
+    cid = env->GetMethodID(thrClass, "<init>", "()V");
+    res = env->NewObject(thrClass, cid);
     return res;
 }
 
@@ -257,8 +244,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -337,6 +323,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -69,8 +56,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -172,6 +158,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -145,6 +131,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -120,8 +106,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I");
+    mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I");
     if (mid == NULL) {
         printf("Cannot find method run\n");
         return STATUS_FAILED;
@@ -157,6 +142,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -119,8 +105,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "check", "()I");
+    mid = env->GetStaticMethodID(cls, "check", "()I");
     if (mid == NULL) {
         printf("Cannot find method check\n");
         return STATUS_FAILED;
@@ -139,6 +124,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -119,8 +105,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "trial", "()I");
+    mid = env->GetStaticMethodID(cls, "trial", "()I");
     if (mid == NULL) {
         printf("Cannot find method trial\n");
         return STATUS_FAILED;
@@ -146,6 +131,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -119,8 +105,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    mid = env->GetStaticMethodID(cls, "checkPoint", "()V");
     if (mid == 0) {
         printf("Cannot find Method ID for method checkPoint\n");
         return STATUS_FAILED;
@@ -143,6 +128,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -133,8 +120,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -192,8 +178,7 @@
         return;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         exp_name, exp_sig);
+    mid = env->GetStaticMethodID(cls, exp_name, exp_sig);
     if (mid == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         result = STATUS_FAILED;
@@ -234,6 +219,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -252,6 +250,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -247,6 +245,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -250,6 +248,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -205,6 +203,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -208,6 +206,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -213,6 +211,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -132,8 +119,7 @@
     jfieldID fid;
     jmethodID mid;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "meth01", "(I)V");
+    mid = env->GetStaticMethodID(cls, "meth01", "(I)V");
     err = jvmti->SetBreakpoint(mid, 0);
     if (err == JVMTI_ERROR_NONE) {
         enable(jvmti_env, JVMTI_EVENT_BREAKPOINT);
@@ -143,7 +129,7 @@
                TranslateError(err), err);
     }
 
-    fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls), "fld", "I");
+    fid = env->GetStaticFieldID(cls, "fld", "I");
     if (caps.can_generate_field_access_events) {
         err = jvmti->SetFieldAccessWatch(cls, fid);
         if (err == JVMTI_ERROR_NONE) {
@@ -322,8 +308,7 @@
     memset(enbl_scale, 0, SCALE_SIZE);
     memset(ev_scale, 0, SCALE_SIZE);
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -429,6 +414,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -164,6 +162,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -74,7 +61,7 @@
     jclass cls;
     field fld = fields[ind];
 
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, fld.klass));
+    cls = env->FindClass(fld.klass);
     if (cls == NULL) {
         printf("Cannot find class \"%s\"\n", fld.klass);
         result = STATUS_FAILED;
@@ -82,11 +69,9 @@
     }
     if (fld.fid == NULL) {
         if (fld.stat) {
-            fields[ind].fid = JNI_ENV_PTR(env)->
-                GetStaticFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig);
+            fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig);
         } else {
-            fields[ind].fid = JNI_ENV_PTR(env)->
-                GetFieldID(JNI_ENV_ARG(env, cls), fld.name, fld.sig);
+            fields[ind].fid = env->GetFieldID(cls, fld.name, fld.sig);
         }
     }
 
@@ -147,8 +132,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -210,7 +194,7 @@
     jint val;
 
     setWatch(env, (jint)0);
-    val = JNI_ENV_PTR(env)->GetIntField(JNI_ENV_ARG(env, obj), fields[0].fid);
+    val = env->GetIntField(obj, fields[0].fid);
 }
 
 JNIEXPORT void JNICALL
@@ -236,6 +220,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -71,8 +58,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -127,8 +113,7 @@
     jvmtiError err;
     jfieldID fid;
 
-    fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-         "fld1", "I");
+    fid = env->GetStaticFieldID(cls, "fld1", "I");
 
     if (!caps.can_generate_field_access_events) {
         err = jvmti->SetFieldAccessWatch(cls, fid);
@@ -170,6 +155,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -83,8 +70,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -135,12 +121,10 @@
         return;
     }
 
-    fids[0] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld0", "I");
-    fids[1] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld1", "I");
-    fids[2] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld2", "I");
-    fids[3] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld3", "I");
+    fids[0] = env->GetStaticFieldID(cls, "fld0", "I");
+    fids[1] = env->GetStaticFieldID(cls, "fld1", "I");
+    fids[2] = env->GetFieldID(cls, "fld2", "I");
+    fids[3] = env->GetFieldID(cls, "fld3", "I");
     for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) {
         if (fids[i] == NULL) {
             printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i);
@@ -185,6 +169,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -83,8 +70,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -141,12 +127,10 @@
         return;
     }
 
-    fids[0] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld0", "I");
-    fids[1] = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-        "fld1", "I");
-    fids[2] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld2", "I");
-    fids[3] = JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls), "fld3", "I");
+    fids[0] = env->GetStaticFieldID(cls, "fld0", "I");
+    fids[1] = env->GetStaticFieldID(cls, "fld1", "I");
+    fids[2] = env->GetFieldID(cls, "fld2", "I");
+    fids[3] = env->GetFieldID(cls, "fld3", "I");
     for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) {
         if (fids[i] == NULL) {
             printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i);
@@ -191,6 +175,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -108,8 +95,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -168,13 +154,9 @@
 
     for (i = 0; i < sizeof(fields) / sizeof(field); i++) {
         if (fields[i].stat == JNI_TRUE) {
-            fields[i].fid = JNI_ENV_PTR(env)->
-                GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                                 fields[i].name, fields[i].sig);
+            fields[i].fid = env->GetStaticFieldID(cls, fields[i].name, fields[i].sig);
         } else {
-            fields[i].fid = JNI_ENV_PTR(env)->
-                GetFieldID(JNI_ENV_ARG(env, cls),
-                           fields[i].name, fields[i].sig);
+            fields[i].fid = env->GetFieldID(cls, fields[i].name, fields[i].sig);
         }
         if (fields[i].fid == NULL) {
             printf("Unable to set access watch on %s fld%" PRIuPTR ", fieldID=0",
@@ -220,6 +202,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -120,8 +107,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -190,11 +176,9 @@
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid = JNI_ENV_PTR(env)->GetFieldID(
-                JNI_ENV_ARG(env, cls), watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
         }
         err = jvmti->SetFieldAccessWatch(cls, watches[i].fid);
         if (err == JVMTI_ERROR_NONE) {
@@ -243,6 +227,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -73,16 +60,12 @@
     jclass cls;
     jvmtiError err;
 
-    cls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, fields[ind].klass));
+    cls = env->FindClass(fields[ind].klass);
     if (fields[ind].fid == NULL) {
         if (fields[ind].stat) {
-            fields[ind].fid =
-                JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                    fields[ind].name, fields[ind].sig);
+            fields[ind].fid = env->GetStaticFieldID(cls, fields[ind].name, fields[ind].sig);
         } else {
-            fields[ind].fid =
-                JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls),
-                    fields[ind].name, fields[ind].sig);
+            fields[ind].fid = env->GetFieldID(cls, fields[ind].name, fields[ind].sig);
         }
     }
 
@@ -143,8 +126,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -204,7 +186,7 @@
 Java_nsk_jvmti_SetFieldModificationWatch_setfmodw001_touchfld0(JNIEnv *env,
         jclass cls) {
     setWatch(env, (jint)0);
-    JNI_ENV_PTR(env)->SetIntField(JNI_ENV_ARG(env, cls), fields[0].fid, (jint)2000);
+    env->SetIntField(cls, fields[0].fid, (jint)2000);
 }
 
 JNIEXPORT void JNICALL
@@ -231,6 +213,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -71,8 +58,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -128,8 +114,7 @@
     jvmtiError err;
     jfieldID fid;
 
-    fid = JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-         "fld1", "I");
+    fid = env->GetStaticFieldID(cls, "fld1", "I");
 
     if (!caps.can_generate_field_modification_events) {
         err = jvmti->SetFieldModificationWatch(cls, fid);
@@ -171,6 +156,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -101,8 +88,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -156,13 +142,9 @@
 
     for (i = 0; i < sizeof(flds) / sizeof(field); i++) {
         if (flds[i].stat == JNI_TRUE) {
-            flds[i].fid =
-                JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                    flds[i].name, "I");
+            flds[i].fid = env->GetStaticFieldID(cls, flds[i].name, "I");
         } else {
-            flds[i].fid =
-                JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls),
-                    flds[i].name, "I");
+            flds[i].fid = env->GetFieldID(cls, flds[i].name, "I");
         }
         if (flds[i].fid == NULL) {
             printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i);
@@ -224,6 +206,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -101,8 +88,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -154,13 +140,9 @@
 
     for (i = 0; i < sizeof(flds) / sizeof(field); i++) {
         if (flds[i].stat == JNI_TRUE) {
-            flds[i].fid =
-                JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                    flds[i].name, "I");
+            flds[i].fid = env->GetStaticFieldID(cls, flds[i].name, "I");
         } else {
-            flds[i].fid =
-                JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls),
-                    flds[i].name, "I");
+            flds[i].fid = env->GetFieldID(cls, flds[i].name, "I");
         }
         if (flds[i].fid == NULL) {
             printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i);
@@ -222,6 +204,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -90,9 +77,7 @@
     actual_sig = sig;
     actual_val = new_value;
     if (actual_sig == 'L') {
-        actual_val.l =
-            JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG((JNIEnv *)env,
-                actual_val.l));
+        actual_val.l = env->NewGlobalRef(actual_val.l);
     }
     if (printdump == JNI_TRUE) {
         printf(">>> FieldModification, field: 0x%p", actual_fid);
@@ -152,8 +137,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -216,8 +200,8 @@
     flds[3].val.f = 654.321F;
     flds[4].val.d = 123456.654321;
     flds[5].val.d = 654321.123456;
-    flds[6].val.l = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, obj1));
-    flds[7].val.l = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, obj2));
+    flds[6].val.l = env->NewGlobalRef(obj1);
+    flds[7].val.l = env->NewGlobalRef(obj2);
     flds[8].val.z = JNI_TRUE;
     flds[9].val.z = JNI_FALSE;
     flds[10].val.b = 123;
@@ -228,13 +212,9 @@
     flds[15].val.c = 0xdcba;
     for (i = 0; i < sizeof(flds) / sizeof(field); i++) {
         if (flds[i].stat == JNI_TRUE) {
-            flds[i].fid =
-                JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                    flds[i].name, flds[i].sig);
+            flds[i].fid = env->GetStaticFieldID(cls, flds[i].name, flds[i].sig);
         } else {
-            flds[i].fid =
-                JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls),
-                    flds[i].name, flds[i].sig);
+            flds[i].fid = env->GetFieldID(cls, flds[i].name, flds[i].sig);
         }
         if (flds[i].fid == NULL) {
             printf("Unable to set modification watch on %s fld%" PRIuPTR ", fieldID=0",
@@ -330,8 +310,7 @@
         }
         break;
     case 'L':
-        if (JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, actual_val.l),
-                flds[ind].val.l) != JNI_TRUE) {
+        if (!env->IsSameObject(actual_val.l, flds[ind].val.l)) {
             result = STATUS_FAILED;
             if (!flag_err) {
                 printf("Field %s fld%d thrown error:\n", flds[ind].descr, ind);
@@ -398,6 +377,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -120,8 +107,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -184,13 +170,9 @@
     }
     for (i = 0; i < sizeof(watches)/sizeof(watch_info); i++) {
         if (watches[i].is_static == JNI_TRUE) {
-            watches[i].fid =
-                JNI_ENV_PTR(env)->GetStaticFieldID(JNI_ENV_ARG(env, cls),
-                    watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetStaticFieldID(cls, watches[i].f_name, watches[i].f_sig);
         } else {
-            watches[i].fid =
-                JNI_ENV_PTR(env)->GetFieldID(JNI_ENV_ARG(env, cls),
-                    watches[i].f_name, watches[i].f_sig);
+            watches[i].fid = env->GetFieldID(cls, watches[i].f_name, watches[i].f_sig);
         }
         err = jvmti->SetFieldModificationWatch(cls, watches[i].fid);
         if (err == JVMTI_ERROR_NONE) {
@@ -240,6 +222,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,27 +32,8 @@
 #include "JVMTITools.h"
 #include "native_thread.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -140,16 +121,14 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get original JNI function table"));
+        env->FatalError("failed to get original JNI function table");
     }
     if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
             JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get redirected JNI function table"));
+        env->FatalError("failed to get redirected JNI function table");
     }
     if (verbose)
         printf("doRedirect: the JNI function table obtained successfully\n");
@@ -163,8 +142,7 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to set new JNI function table"));
+        env->FatalError("failed to set new JNI function table");
     }
 
     if (verbose)
@@ -181,8 +159,7 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to restore original JNI function table"));
+        env->FatalError("failed to restore original JNI function table");
     }
     if (verbose)
         printf("doRestore: the original JNI function table is restored successfully\n");
@@ -191,24 +168,22 @@
 void doExec(JNIEnv *env, int thrNum) {
     jint res;
 
-    if ((res = JNI_ENV_PTR(env)->
-            MonitorEnter(JNI_ENV_ARG(env, clsObj))) != 0) {
+    if ((res = env->MonitorEnter(clsObj)) != 0) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILURE: MonitorEnter() returns %d for thread #%d\n",
             __FILE__, __LINE__, res, thrNum);
     }
-    if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+    if (env->ExceptionOccurred()) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILURE: exception occured for thread #%d\n",
             __FILE__, __LINE__, thrNum);
-        JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env));
-        JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+        env->ExceptionDescribe();
+        env->ExceptionClear();
     }
     if (verbose)
         printf("\ndoExec: thread #%d entered the monitor\n",
             thrNum);
-    if ((res = JNI_ENV_PTR(env)->
-            MonitorExit(JNI_ENV_ARG(env, clsObj))) != 0) {
+    if ((res = env->MonitorExit(clsObj)) != 0) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILURE: MonitorExit() returns %d for thread #%d\n",
             __FILE__, __LINE__, res, thrNum);
@@ -246,9 +221,7 @@
     if (verbose)
         printf("\nwaitingThread: thread #%d started\n\tattaching the thread to the VM ...\n",
             indx);
-    if ((res =
-            JNI_ENV_PTR(vm)->AttachCurrentThread(
-                JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) {
+    if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
         printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
             __FILE__, __LINE__, res);
         return STATUS_FAILED;
@@ -258,9 +231,7 @@
 
     doExec(env, indx);
 
-    if ((res =
-            JNI_ENV_PTR(vm)->DetachCurrentThread(
-                JNI_ENV_ARG1(vm))) != 0) {
+    if ((res = vm->DetachCurrentThread()) != 0) {
         printf("(%s,%d): TEST FAILURE: waitingThread: DetachCurrentThread() returns: %d\n",
             __FILE__, __LINE__, res);
         return STATUS_FAILED;
@@ -276,22 +247,19 @@
     jfieldID fid;
     jclass _objCls;
 
-    _objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj));
+    _objCls = env->GetObjectClass(obj);
 
     if (verbose)
        printf("\ngetObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n",
            javaField, classSig);
-    if ((fid = JNI_ENV_PTR(env)->GetFieldID(
-            JNI_ENV_ARG(env, _objCls), javaField, classSig)) == 0) {
+    if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILURE: failed to get ID for the field \"%s\"\n",
             __FILE__, __LINE__, javaField);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get ID for the java field"));
+        env->FatalError("failed to get ID for the java field");
     }
 
-    return JNI_ENV_PTR(env)->GetObjectField(
-        JNI_ENV_ARG(env, obj), fid);
+    return env->GetObjectField(obj, fid);
 }
 
 void startThreads() {
@@ -358,12 +326,10 @@
         return STATUS_FAILED;
     }
 
-    if ((clsObj = JNI_ENV_PTR(env)->NewGlobalRef(
-            JNI_ENV_ARG(env, getObjectFromField(env, obj)))) == NULL) {
+    if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) {
         printf("(%s,%d): TEST FAILURE: cannot create a new global reference of class \"%s\"\n",
             __FILE__, __LINE__, classSig);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to create a new global reference"));
+        env->FatalError("failed to create a new global reference");
     }
 
     doRedirect(env);
@@ -385,18 +351,14 @@
     if (verbose)
         printf("\nb) Checking the assertion inside main thread detached and attached again ...\n\ndetaching the main thread ...\n");
 
-    if ((res =
-            JNI_ENV_PTR(vm)->DetachCurrentThread(
-                JNI_ENV_ARG1(vm))) != 0)
+    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 {
         if (verbose)
             printf("\nattaching the main thread again ...\n");
-        if ((res =
-                JNI_ENV_PTR(vm)->AttachCurrentThread(
-                    JNI_ENV_ARG(vm, (void **) &nextEnv), (void *) 0)) != 0) {
+        if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != 0) {
             printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
                 __FILE__, __LINE__, res);
             return STATUS_FAILED;
@@ -422,7 +384,7 @@
     waitThreads();
     checkCall(2, 0, "new threads");
 
-    JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG((nextEnv==NULL)? env:nextEnv, clsObj));
+    env->DeleteGlobalRef(clsObj);
 
     return result;
 }
@@ -448,8 +410,7 @@
     if (verbose)
         printf("verbose mode on\n");
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__);
         return JNI_ERR;
@@ -467,6 +428,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,27 +27,7 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -98,9 +78,7 @@
        only since JDK 1.2 */
     if (verbose)
         printf("\nb) Checking the function with the detached thread ...\n\ndetaching the main thread ...\n");
-    if ((res =
-            JNI_ENV_PTR(vm)->DetachCurrentThread(
-                JNI_ENV_ARG1(vm))) != JNI_OK)
+    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);
@@ -109,9 +87,7 @@
 
         if (verbose)
             printf("\nattaching the main thread back ...\n");
-        if ((res =
-                JNI_ENV_PTR(vm)->AttachCurrentThread(
-                    JNI_ENV_ARG(vm, (void **) &nextEnv), (void *) 0)) != JNI_OK) {
+        if ((res = vm->AttachCurrentThread((void **) &nextEnv, (void *) 0)) != JNI_OK) {
             printf("(%s,%d): TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
                 __FILE__, __LINE__, res);
             return STATUS_FAILED;
@@ -141,8 +117,7 @@
     if (verbose)
         printf("verbose mode on\n");
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__);
         return JNI_ERR;
@@ -153,6 +128,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -270,8 +257,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if ( res != JNI_OK || jvmti == NULL ) {
         printf("Wrong result of a valid call to GetEnv !\n");
         return JNI_ERR;
@@ -330,23 +316,18 @@
     if (!caps.can_access_local_variables ||
         !caps.can_generate_breakpoint_events) return;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
-    mid1 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "meth01", "()D");
-    mid2 = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "meth02", "(I)V");
-    mid3 = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "meth03", "()V");
-    mid4 = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "meth04", "(IJSDCFBZ)V");
+    mid = env->GetStaticMethodID(cls, "checkPoint", "()V");
+    mid1 = env->GetMethodID(cls, "meth01", "()D");
+    mid2 = env->GetMethodID(cls, "meth02", "(I)V");
+    mid3 = env->GetStaticMethodID(cls, "meth03", "()V");
+    mid4 = env->GetStaticMethodID(cls, "meth04", "(IJSDCFBZ)V");
     if (mid == 0 || mid1 == 0 || mid2 == 0 || mid3 == 0 || mid4 == 0) {
         printf("Cannot find Method ID for a method\n");
     }
     floatVal = f;
     doubleVal = d;
-    objVal = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, o));
-    arrVal = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, a));
+    objVal = env->NewGlobalRef(o);
+    arrVal = env->NewGlobalRef(a);
 
     err = jvmti->SetBreakpoint(mid, 0);
     if (err != JVMTI_ERROR_NONE) {
@@ -369,6 +350,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -122,8 +108,7 @@
         return result;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I");
+    mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I");
     if (mid == NULL) {
         printf("Cannot find method \"run\"\n");
         return STATUS_FAILED;
@@ -299,6 +284,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -156,8 +143,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -215,8 +201,7 @@
     if (!caps.can_access_local_variables ||
         !caps.can_generate_breakpoint_events) return;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    mid = env->GetStaticMethodID(cls, "checkPoint", "()V");
     if (mid == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         result = STATUS_FAILED;
@@ -244,6 +229,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -161,8 +148,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -220,8 +206,7 @@
     if (!caps.can_access_local_variables ||
         !caps.can_generate_breakpoint_events) return;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    mid = env->GetStaticMethodID(cls, "checkPoint", "()V");
     if (mid == 0) {
         printf("Cannot find Method ID for method checkPoint\n");
         result = STATUS_FAILED;
@@ -249,6 +234,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FOO 1
 #define WRAPPED_FOO 2
@@ -367,6 +365,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -148,6 +146,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -49,6 +47,4 @@
     return FOO;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -204,6 +202,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -104,6 +102,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -222,6 +220,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -175,6 +173,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -161,6 +159,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -259,6 +257,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -227,6 +225,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -98,6 +96,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep001/singlestep001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep001/singlestep001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -300,6 +298,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep002/singlestep002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep002/singlestep002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -137,6 +135,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep003/singlestep003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SingleStep/singlestep003/singlestep003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -308,6 +306,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -70,8 +57,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -144,6 +130,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -205,6 +203,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -155,6 +153,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -196,6 +194,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -196,6 +194,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -282,6 +280,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -327,6 +325,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend001/threadend001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend001/threadend001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -99,8 +86,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -127,7 +113,7 @@
         return;
     }
 
-    prefix = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, name), NULL);
+    prefix = env->GetStringUTFChars(name, NULL);
     if (prefix == NULL) {
         printf("Failed to copy UTF-8 string!\n");
         result = STATUS_FAILED;
@@ -170,6 +156,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend002/threadend002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend002/threadend002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -170,6 +168,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart001/threadstart001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart001/threadstart001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -99,8 +86,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -127,7 +113,7 @@
         return;
     }
 
-    prefix = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, name), NULL);
+    prefix = env->GetStringUTFChars(name, NULL);
     if (prefix == NULL) {
         printf("Failed to copy UTF-8 string!\n");
         result = STATUS_FAILED;
@@ -170,6 +156,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart002/threadstart002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart002/threadstart002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "agent_common.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -542,6 +540,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart003/threadstart003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart003/threadstart003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -113,8 +100,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -166,8 +152,7 @@
         return STATUS_FAILED;
     }
 
-    threadName = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, name),
-        NULL);
+    threadName = env->GetStringUTFChars(name, NULL);
     if (threadName == NULL) {
         printf("Failed to copy UTF-8 string!\n");
         return STATUS_FAILED;
@@ -288,6 +273,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,27 +33,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -121,6 +101,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -149,8 +136,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -197,6 +183,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMObjectAlloc/vmobjalloc001/vmobjalloc001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMObjectAlloc/vmobjalloc001/vmobjalloc001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -158,6 +156,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -371,6 +369,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -256,6 +254,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define EXP_OBJ_NUMBER 1
 
@@ -271,6 +269,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define OBJ_MAX_COUNT 100000
 
@@ -530,6 +528,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define OBJ_MAX_COUNT 100000
 
@@ -514,6 +512,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define OBJ_MAX_COUNT 100000
 
@@ -704,6 +702,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define EXP_OBJ_NUMBER 1
 
@@ -233,6 +231,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define EXP_OBJ_NUMBER 1
 
@@ -236,6 +234,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define EXP_OBJ_NUMBER 1
 
@@ -254,6 +252,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define EXP_OBJ_NUMBER 1
 
@@ -211,6 +209,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define EXP_OBJ_NUMBER 1
 
@@ -189,6 +187,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define EXP_OBJ_NUMBER 1
 
@@ -246,6 +244,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -322,6 +320,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -262,6 +260,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -169,6 +167,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* scaffold objects */
 static jvmtiEnv *jvmti = NULL;
@@ -292,6 +290,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* scaffold objects */
 static jvmtiEnv *jvmti = NULL;
@@ -306,6 +304,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -202,6 +200,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -184,6 +182,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -202,6 +200,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -184,6 +182,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* scaffold objects */
 static jlong timeout = 0;
@@ -181,6 +179,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_tag_objects
 #define CAPABILITY_STR "can_tag_objects"
@@ -663,6 +661,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_bytecodes
 #define CAPABILITY_STR "can_get_bytecodes"
@@ -658,6 +656,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_synthetic_attribute
 #define CAPABILITY_STR "can_get_synthetic_attribute"
@@ -658,6 +656,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_owned_monitor_info
 #define CAPABILITY_STR "can_get_owned_monitor_info"
@@ -656,6 +654,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_current_contended_monitor
 #define CAPABILITY_STR "can_get_current_contended_monitor"
@@ -656,6 +654,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_monitor_info
 #define CAPABILITY_STR "can_get_monitor_info"
@@ -656,6 +654,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_pop_frame
 #define CAPABILITY_STR "can_pop_frame"
@@ -676,6 +674,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_redefine_classes
 #define CAPABILITY_STR "can_redefine_classes"
@@ -700,6 +698,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_signal_thread
 #define CAPABILITY_STR "can_signal_thread"
@@ -656,6 +654,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_source_file_name
 #define CAPABILITY_STR "can_get_source_file_name"
@@ -657,6 +655,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_access_local_variables
 #define CAPABILITY_STR "can_access_local_variables"
@@ -696,6 +694,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_suspend
 #define CAPABILITY_STR "can_suspend"
@@ -658,6 +656,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_line_numbers
 #define CAPABILITY_STR "can_get_line_numbers"
@@ -657,6 +655,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_bytecodes
 #define CAPABILITY_STR "can_get_bytecodes"
@@ -722,6 +720,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_synthetic_attribute
 #define CAPABILITY_STR "can_get_synthetic_attribute"
@@ -727,6 +725,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_monitor_info
 #define CAPABILITY_STR "can_get_monitor_info"
@@ -721,6 +719,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_signal_thread
 #define CAPABILITY_STR "can_signal_thread"
@@ -726,6 +724,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_suspend
 #define CAPABILITY_STR "can_suspend"
@@ -737,6 +735,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_source_debug_extension
 #define CAPABILITY_STR "can_get_source_debug_extension"
@@ -657,6 +655,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_current_thread_cpu_time
 #define CAPABILITY_STR "can_get_current_thread_cpu_time"
@@ -658,6 +656,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CAPABILITY can_get_thread_cpu_time
 #define CAPABILITY_STR "can_get_thread_cpu_time"
@@ -658,6 +656,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* The test adds all capabilities suitable for profiling at OnLoad phase:
  *
@@ -776,6 +774,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* The test adds all capabilities suitable for debugging at OnLoad phase:
  *
@@ -963,6 +961,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -293,6 +291,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -386,6 +384,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 typedef struct {
     jthread thread;
@@ -275,6 +273,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 typedef struct {
     jthread thread;
@@ -275,6 +273,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -359,6 +357,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -364,6 +362,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -479,6 +477,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -577,6 +575,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -807,6 +805,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -555,6 +553,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -604,6 +602,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -610,6 +608,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -587,6 +585,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -530,6 +528,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -575,6 +573,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -589,6 +587,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -595,6 +593,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -571,6 +569,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -546,6 +544,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -550,6 +548,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "nsk_list.h"
 #include "nsk_mutex.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -252,6 +250,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -353,6 +351,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -421,6 +419,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -273,6 +271,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -390,6 +388,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "JVMTITools.h"
 #include "nsk_list.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -298,6 +296,4 @@
 /* ============================================================================= */
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static JNIEnv *jni = NULL;
 static jvmtiEnv* jvmti = NULL;
@@ -277,6 +275,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -207,6 +205,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -217,6 +215,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,23 +28,8 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 /* ============================================================================= */
 
@@ -201,8 +186,7 @@
     timeout = nsk_jvmti_getWaitTime() * 60 * 1000;
 
     NSK_DISPLAY0("Create first JVMTI env.\n");
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti_1), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti_1, JVMTI_VERSION_1_1);
     if (res < 0) {
         NSK_COMPLAIN0("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -254,6 +238,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -85,6 +83,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -85,6 +83,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -85,6 +83,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "jvmti_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS103/hs103t002/MyThread"
 #define SEARCH_NAME "nsk/jvmti/scenarios/hotswap/HS103/hs103t002/MyThread"
@@ -178,6 +176,4 @@
   return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "JVMTITools.h"
 
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS104/hs104t001/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS104/hs104t001/MyClass;"
@@ -108,6 +106,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "JVMTITools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define DIR_NAME "newclass"
 #define PATH_FORMAT "%s%02d/%s"
@@ -94,6 +92,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -732,6 +730,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -732,6 +730,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -353,6 +351,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -36,9 +36,7 @@
         4. Pop a currently executed frame.
 
 */
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS202/hs203t001/MyObject"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS202/hs203t001/MyObject;"
 #define METHOD_NAME "leaveMonitor"
@@ -227,6 +225,4 @@
     return retvalue;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 /*
 hs202t002:
 */
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS202/hs202t002/MyThread"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS202/hs202t002/MyThread;"
@@ -200,6 +198,4 @@
     return suspended == thread_suspend_status;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -39,9 +39,7 @@
         4. Pop a currently executed frame. Stepping should be continued
         on invoke instruction.
 */
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS203/hs203t001/MyThread"
 
@@ -234,6 +232,4 @@
     return retvalue;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -43,9 +43,7 @@
    method b().
 */
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS203/hs203t002/MyThread"
 #define SEARCH_NAME "nsk/jvmti/scenarios/hotswap/HS203/hs203t002/MyThread"
@@ -252,6 +250,4 @@
     return retvalue;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -37,9 +37,7 @@
    frame within FieldAccess/FieldModification callback.
 
 */
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define DIR_NAME "newclass"
 #define PATH_FORMAT "%s%02d/%s"
 
@@ -227,6 +225,4 @@
     return retvalue;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "JVMTITools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread;"
 #define METHOD_NAME "doTask2"
@@ -257,6 +255,4 @@
     return retvalue;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "jvmti_tools.h"
 
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 static JNIEnv* jni = NULL;
 static jvmtiEnv *jvmti = NULL;
 static jlong timeout = 0;
@@ -305,6 +303,4 @@
     }
     return NSK_TRUE;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -34,9 +34,7 @@
  *3. Upon reaching the breakpoint, redefine the class and pop
  *a currently executed frame of the static initializer.
 */
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS204/hs204t002/MyThread"
 
 #define SEARCH_NAME "nsk/jvmti/scenarios/hotswap/HS204/hs204t002/MyThread"
@@ -166,6 +164,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.h	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 
 #ifndef _Included_hs204t002
 #define _Included_hs204t002
-#ifdef __cplusplus
 extern "C" {
-#endif
 /*
  * Class:     hs204t002
  * Method:    setBreakPoint
@@ -37,7 +35,5 @@
 JNIEXPORT void JNICALL Java_hs204t002_setBreakPoint
   (JNIEnv *, jclass, jclass);
 
-#ifdef __cplusplus
 }
 #endif
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "jni_tools.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS204/hs204t003/MyThread"
 #define CLASS_NAME  "Lnsk/jvmti/scenarios/hotswap/HS204/hs204t003/MyThread;"
@@ -252,6 +250,4 @@
     }
     return retvalue;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -34,9 +34,7 @@
 3. Upon accessing the field by the initializer, redefine the class and pop a currently executed
  frame of the initializer within incoming FieldAccess callback.
 */
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define METHOD_NAME "loadClass"
 #define SIGNATURE "(Ljava/lang/String;)Ljava/lang/Class;"
@@ -200,6 +198,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 #include "jni_tools.h"
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t001/MyClass"
 #define DIR_NAME "newclass"
@@ -104,6 +102,4 @@
     return ret;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #include "jvmti_tools.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t002/MyClass"
 #define DIR_NAME "newclass"
 #define PATH_FORMAT "%s%02d/%s"
@@ -102,6 +100,4 @@
     return ret;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t003/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS301/hs301t003/MyClass;"
 
@@ -106,6 +104,4 @@
     }
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t004/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS301/hs301t004/MyClass;"
 
@@ -108,6 +106,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jvmti_tools.h"
 
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t005/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS301/hs301t005/MyClass;"
 
@@ -99,6 +97,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t001/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t001/MyClass;"
@@ -99,6 +97,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t002/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t002/MyClass;"
@@ -106,6 +104,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t003/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t003/MyClass;"
@@ -105,6 +103,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t004r/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t004r/MyClass;"
 
@@ -98,6 +96,4 @@
     }
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jvmti_tools.h"
 
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t005r/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t005r/MyClass;"
@@ -102,6 +100,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t006r/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t006r/MyClass;"
@@ -100,6 +98,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include "agent_common.h"
 #include <string.h>
 #include "jvmti_tools.h"
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t007r/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t007r/MyClass;"
 void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env,
@@ -96,6 +94,4 @@
     }
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t008r/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t008r/MyClass;"
@@ -99,6 +97,4 @@
     }
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t009r/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t009r/MyClass;"
 
@@ -100,6 +98,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t010r/MyClass"
 #define PATH_FORMAT "%s%02d/%s"
@@ -98,6 +96,4 @@
     }
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t011r/MyClass"
 #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t011r/MyClass;"
@@ -99,6 +97,4 @@
     }
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <string.h>
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t012r/MyClass"
 #define DIR_NAME "newclass"
@@ -102,6 +100,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #include "jvmti_tools.h"
 #include "nsk_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ====================================================================== */
 
@@ -455,6 +453,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,27 +30,7 @@
 
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -70,11 +50,11 @@
 
 jint JNICALL MyGetVersion(JNIEnv *env) {
     call_count++;
-    if (verbose)
+    if (verbose) {
         printf("\nMyGetVersion: the function called successfully: getVer_count=%d\n",
             call_count);
-    return
-        orig_jni_functions->GetVersion(env);
+    }
+    return orig_jni_functions->GetVersion(env);
 }
 
 void doRedirect(JNIEnv *env) {
@@ -87,8 +67,7 @@
             JVMTI_ERROR_NONE) {
         printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get original JNI function table"));
+        env->FatalError("failed to get original JNI function table");
         result = STATUS_FAILED;
     }
 
@@ -96,8 +75,7 @@
             JVMTI_ERROR_NONE) {
         printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get redirected JNI function table"));
+        env->FatalError("failed to get redirected JNI function table");
         result = STATUS_FAILED;
     }
     if (verbose)
@@ -109,8 +87,7 @@
             JVMTI_ERROR_NONE) {
         printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to set new JNI function table"));
+        env->FatalError("failed to set new JNI function table");
         result = STATUS_FAILED;
     }
 
@@ -127,8 +104,7 @@
             JVMTI_ERROR_NONE) {
         printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to restore original JNI function table"));
+        env->FatalError("failed to restore original JNI function table");
         result = STATUS_FAILED;
     }
     if (verbose)
@@ -148,7 +124,7 @@
     if (verbose)
         printf("\na) invoking the original function GetVersion() ...\n");
 
-    ver = JNI_ENV_PTR(env)->GetVersion(JNI_ENV_ARG1(env));
+    ver = env->GetVersion();
 
     if (verbose)
         printf("JNIenv version=%d\n", ver);
@@ -158,7 +134,7 @@
 
     if (verbose)
         printf("\nb) invoking the redirected function GetVersion() ...\n");
-    ver = JNI_ENV_PTR(env)->GetVersion(JNI_ENV_ARG1(env));
+    ver = env->GetVersion();
 
     if (call_count == 1) {
         if (verbose)
@@ -177,7 +153,7 @@
 
     if (verbose)
         printf("\nc) invoking the restored function GetVersion ...\n");
-    ver = JNI_ENV_PTR(env)->GetVersion(JNI_ENV_ARG1(env));
+    ver = env->GetVersion();
 
     if (call_count == 0) {
         if (verbose)
@@ -213,8 +189,7 @@
     if (verbose)
         printf("verbose mode on\n");
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__);
         return JNI_ERR;
@@ -223,6 +198,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,27 +31,7 @@
 
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -123,16 +103,14 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get original JNI function table"));
+        env->FatalError("failed to get original JNI function table");
     }
     if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
             JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get redirected JNI function table"));
+        env->FatalError("failed to get redirected JNI function table");
     }
     if (verbose)
         printf("doRedirect: the JNI function table obtained successfully\n");
@@ -142,33 +120,29 @@
             printf("\ndoRedirect: obtaining method ID for \"%s %s\"...\n",
             meth_info[i].m_name, meth_info[i].m_sign);
         if (meth_info[i].inst) { /* an instance method */
-            meth_info[i].mid = JNI_ENV_PTR(env)->GetMethodID(
-                JNI_ENV_ARG(env, cls),
-                meth_info[i].m_name, meth_info[i].m_sign);
+            meth_info[i].mid = env->GetMethodID(
+                cls, meth_info[i].m_name, meth_info[i].m_sign);
         }
         else {                   /* a static method */
-            meth_info[i].mid = JNI_ENV_PTR(env)->GetStaticMethodID(
-                JNI_ENV_ARG(env, cls),
-                meth_info[i].m_name, meth_info[i].m_sign);
+            meth_info[i].mid = env->GetStaticMethodID(
+                cls, meth_info[i].m_name, meth_info[i].m_sign);
         }
         if (meth_info[i].mid == NULL) {
            result = STATUS_FAILED;
            printf("(%s,%d): TEST FAILURE: failed to get the ID for the method \"%s %s\"\n",
                 __FILE__, __LINE__, meth_info[i].m_name, meth_info[i].m_sign);
-           JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-               "failed to get the ID for a method"));
+           env->FatalError("failed to get the ID for a method");
         }
 
         if (verbose)
             printf("\ndoRedirect: obtaining field ID for \"%s\"...\n",
                 meth_info[i].f_name);
-        if ((meth_info[i].fid = JNI_ENV_PTR(env)->GetStaticFieldID(
-                JNI_ENV_ARG(env, cls), meth_info[i].f_name, "I")) == 0) {
+        if ((meth_info[i].fid = env->GetStaticFieldID(
+                cls, meth_info[i].f_name, "I")) == 0) {
             result = STATUS_FAILED;
             printf("(%s,%d): TEST FAILED: failed to get ID for the field %s\n",
                 __FILE__, __LINE__, meth_info[i].f_name);
-            JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-                "cannot get field ID"));
+            env->FatalError("cannot get field ID");
         }
 
         switch(i) {
@@ -190,8 +164,7 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to set new JNI function table"));
+        env->FatalError("failed to set new JNI function table");
     }
 
     if (verbose)
@@ -208,16 +181,14 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to restore original JNI function table"));
+        env->FatalError("failed to restore original JNI function table");
     }
     if (verbose)
         printf("doRestore: the original JNI function table is restored successfully\n");
 }
 
 int getFieldVal(JNIEnv *env, jclass cls, jfieldID fid) {
-    return JNI_ENV_PTR(env)->GetStaticIntField(
-        JNI_ENV_ARG(env, cls), fid);
+    return env->GetStaticIntField(cls, fid);
 }
 
 void doCall(JNIEnv *env, jobject obj, jclass objCls, const char *msg) {
@@ -233,27 +204,26 @@
             dVal = env->CallStaticDoubleMethod(objCls, meth_info[i].mid, 73);
             break;
         case 1:
-            JNI_ENV_PTR(env)->CallVoidMethod(JNI_ENV_ARG(env, obj),
-                meth_info[i].mid);
+            env->CallVoidMethod(obj, meth_info[i].mid);
             break;
         }
 
-        if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+        if (env->ExceptionOccurred()) {
             result = STATUS_FAILED;
             printf("(%s,%d): TEST FAILED: exception occured during the execution of the %s method\n",
                 __FILE__, __LINE__, msg);
-            JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env));
-            JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+            env->ExceptionDescribe();
+            env->ExceptionClear();
         }
 
         meth_info[i].java_calls = getFieldVal(env, objCls, meth_info[i].fid);
 
-        if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+        if (env->ExceptionOccurred()) {
             result = STATUS_FAILED;
             printf("(%s,%d): TEST FAILED: exception occured during getting value of the %s fieldn",
                 __FILE__, __LINE__, meth_info[i].f_name);
-            JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env));
-            JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+            env->ExceptionDescribe();
+            env->ExceptionClear();
         }
 
     }
@@ -306,7 +276,7 @@
         return STATUS_FAILED;
     }
 
-    objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj));
+    objCls = env->GetObjectClass(obj);
 
     /* 1: check the JNI function table interception */
     if (verbose)
@@ -345,8 +315,7 @@
     if (verbose)
         printf("verbose mode on\n");
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__);
         return JNI_ERR;
@@ -355,6 +324,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,27 +31,7 @@
 
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -128,16 +108,14 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get original JNI function table"));
+        env->FatalError("failed to get original JNI function table");
     }
     if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
             JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get redirected JNI function table"));
+        env->FatalError("failed to get redirected JNI function table");
     }
     if (verbose)
         printf("doRedirect: the JNI function table obtained successfully\n");
@@ -153,8 +131,7 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to set new JNI function table"));
+        env->FatalError("failed to set new JNI function table");
     }
 
     if (verbose)
@@ -171,8 +148,7 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to restore original JNI function table"));
+        env->FatalError("failed to restore original JNI function table");
     }
     if (verbose)
         printf("doRestore: the original JNI function table is restored successfully\n");
@@ -181,19 +157,18 @@
 void doExc(JNIEnv *env, jthrowable thrw, jclass thrCls, const char *msg) {
     jint res;
 
-    if ((res = JNI_ENV_PTR(env)->ThrowNew(JNI_ENV_ARG(env, thrCls), msg)) != 0) {
+    if ((res = env->ThrowNew(thrCls, msg)) != 0) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to throw new exception\n",
             __FILE__, __LINE__);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to failed to throw new exception"));
+        env->FatalError("failed to failed to throw new exception");
     }
 
-    if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+    if (env->ExceptionOccurred()) {
         if (verbose)
             printf("\nCHECK PASSED: exception %s thrown by ThrowNew()\n\tis detected by ExceptionOccurred() successfully\n",
                 msg);
-        JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+        env->ExceptionClear();
     }
     else {
         result = STATUS_FAILED;
@@ -201,19 +176,18 @@
             __FILE__, __LINE__, msg);
     }
 
-    if ((res = JNI_ENV_PTR(env)->Throw(JNI_ENV_ARG(env, thrw))) != 0) {
+    if ((res = env->Throw(thrw)) != 0) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to throw exception\n",
             __FILE__, __LINE__);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to failed to throw new exception"));
+        env->FatalError("failed to failed to throw new exception");
     }
 
-    if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+    if (env->ExceptionOccurred()) {
         if (verbose)
             printf("(%s,%d): CHECK PASSED: exception %s thrown by Throw()\n\tis detected by ExceptionOccurred() successfully\n",
                 __FILE__, __LINE__, msg);
-        JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+        env->ExceptionClear();
     }
     else {
         result = STATUS_FAILED;
@@ -285,13 +259,12 @@
         return STATUS_FAILED;
     }
 
-    objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj));
+    objCls = env->GetObjectClass(obj);
 
     if (verbose)
        printf("\ncheck: obtaining field ID for \"name=%s signature=%s\"...\n",
            javaField, excClassSig);
-    if ((fid = JNI_ENV_PTR(env)->GetFieldID(
-            JNI_ENV_ARG(env, objCls), javaField, excClassSig)) == 0) {
+    if ((fid = env->GetFieldID(objCls, javaField, excClassSig)) == 0) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get ID for the field \"%s\"\n",
             __FILE__, __LINE__, javaField);
@@ -301,13 +274,12 @@
     if (verbose)
        printf("check: obtaining the value of the field \"%s\"...\n",
            javaField);
-    thrwObj = (jthrowable) JNI_ENV_PTR(env)->GetObjectField(
-        JNI_ENV_ARG(env, obj), fid);
+    thrwObj = (jthrowable) env->GetObjectField(obj, fid);
 
     if (verbose)
        printf("check: obtaining the class of the object for \"%s\"...\n",
            javaField);
-    thrw = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, thrwObj));
+    thrw = env->GetObjectClass(thrwObj);
 
     /* 1: check the JNI function table interception */
     if (verbose)
@@ -323,8 +295,8 @@
     doExc(env, thrwObj, thrw, "restored");
     checkCall(2, 0, 0, 0);
 
-    JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, thrw));
-    JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, thrwObj));
+    env->DeleteLocalRef(thrw);
+    env->DeleteLocalRef(thrwObj);
 
     return result;
 }
@@ -349,8 +321,7 @@
     if (verbose)
         printf("verbose mode on\n");
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__);
         return JNI_ERR;
@@ -359,6 +330,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,27 +31,7 @@
 
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -98,21 +78,17 @@
 
     if (verbose)
         printf("\ndoRedirect: obtaining the JNI function table ...\n");
-    if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) !=
-            JVMTI_ERROR_NONE) {
+    if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions)) != JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get original JNI function table"));
+        env->FatalError("failed to get original JNI function table");
     }
-    if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
-            JVMTI_ERROR_NONE) {
+    if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) != JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to get redirected JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get redirected JNI function table"));
+        env->FatalError("failed to get redirected JNI function table");
     }
     if (verbose)
         printf("doRedirect: the JNI function table obtained successfully\n");
@@ -127,8 +103,7 @@
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to set new JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to set new JNI function table"));
+        env->FatalError("failed to set new JNI function table");
     }
 
     if (verbose)
@@ -140,13 +115,11 @@
 
     if (verbose)
         printf("\ndoRestore: restoring the original JNI function table ...\n");
-    if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) !=
-            JVMTI_ERROR_NONE) {
+    if ((err = jvmti->SetJNIFunctionTable(orig_jni_functions)) != JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to restore original JNI function table: %s\n",
             __FILE__, __LINE__, TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to restore original JNI function table"));
+        env->FatalError("failed to restore original JNI function table");
     }
     if (verbose)
         printf("doRestore: the original JNI function table is restored successfully\n");
@@ -157,42 +130,40 @@
     jobject newObj;
     va_list args;
     va_start(args, msg);
-    if ((allObj = JNI_ENV_PTR(env)->AllocObject(JNI_ENV_ARG(env, allCls)))
+    if ((allObj = env->AllocObject(allCls))
             == NULL) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to call %s AllocObject()\n",
             __FILE__, __LINE__, msg);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to failed to call AllocObject()"));
+        env->FatalError("failed to failed to call AllocObject()");
     }
 
-    if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+    if (env->ExceptionOccurred()) {
             result = STATUS_FAILED;
             printf("(%s,%d): TEST FAILED: exception occured during the call of %s AllocObject()\n",
                 __FILE__, __LINE__, msg);
-            JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env));
-            JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+            env->ExceptionDescribe();
+            env->ExceptionClear();
     }
 
-    newObj = JNI_ENV_PTR(env)->NewObjectV(JNI_ENV_ARG(env, allCls), ctorId, args);
+    newObj = env->NewObjectV(allCls, ctorId, args);
     if (newObj == NULL) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: failed to call %s NewObjectV()\n",
             __FILE__, __LINE__, msg);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to failed to call NewObjectV()"));
+        env->FatalError("failed to failed to call NewObjectV()");
     }
 
-    if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+    if (env->ExceptionOccurred()) {
         result = STATUS_FAILED;
         printf("(%s,%d): TEST FAILED: exception occured during the call of %s AllocObject()\n",
             __FILE__, __LINE__, msg);
-        JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env));
-        JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+        env->ExceptionDescribe();
+        env->ExceptionClear();
     }
     va_end(args);
-    JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, allObj));
-    JNI_ENV_PTR(env)->DeleteLocalRef(JNI_ENV_ARG(env, newObj));
+    env->DeleteLocalRef(allObj);
+    env->DeleteLocalRef(newObj);
 }
 
 void checkCall(int step, int exAllObjCalls, int exNewObjCalls) {
@@ -240,15 +211,13 @@
         return STATUS_FAILED;
     }
 
-    if ((objCls = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, classSig)))
-            == NULL) {
+    if ((objCls = env->FindClass(classSig)) == NULL) {
         printf("(%s,%d): TEST FAILED: failed to call FindClass() for \"%s\"\n",
             __FILE__, __LINE__, classSig);
         return STATUS_FAILED;
     }
 
-    if ((ctorId = JNI_ENV_PTR(env)->GetMethodID(
-                JNI_ENV_ARG(env, objCls), "<init>", "()V"))
+    if ((ctorId = env->GetMethodID(objCls, "<init>", "()V"))
             == NULL) {
         printf("(%s,%d): TEST FAILED: failed to call GetMethodID() for a constructor\n",
             __FILE__, __LINE__);
@@ -292,8 +261,7 @@
     if (verbose)
         printf("verbose mode on\n");
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__);
         return JNI_ERR;
@@ -302,6 +270,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -34,27 +34,7 @@
 #include "jvmti_tools.h"
 #include "native_thread.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -119,21 +99,17 @@
 
     NSK_DISPLAY1("\n%s JVMTI env: doRedirect: obtaining the JNI function table ...\n",
         (indx==0)?"first":"second");
-    if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx])) !=
-            JVMTI_ERROR_NONE) {
+    if ((err = jvmti->GetJNIFunctionTable(&orig_jni_functions[indx])) != JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get original JNI function table: %s\n",
             (indx==0)?"first":"second", TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get original JNI function table"));
+        env->FatalError("failed to get original JNI function table");
     }
-    if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx])) !=
-            JVMTI_ERROR_NONE) {
+    if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions[indx])) != JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to get redirected JNI function table: %s\n",
             (indx==0)?"first":"second", TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get redirected JNI function table"));
+        env->FatalError("failed to get redirected JNI function table");
     }
 
     NSK_DISPLAY1("%s JVMTI env: doRedirect: the JNI function table obtained successfully\n\
@@ -142,13 +118,11 @@
     redir_jni_functions[indx]->GetVersion =
         (indx==0)?MyGetVersionA:MyGetVersionB;
 
-    if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx])) !=
-            JVMTI_ERROR_NONE) {
+    if ((err = jvmti->SetJNIFunctionTable(redir_jni_functions[indx])) != JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         NSK_COMPLAIN2("TEST FAILED: %s JVMTI env: failed to set new JNI function table: %s\n",
             (indx==0)?"first":"second", TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to set new JNI function table"));
+        env->FatalError("failed to set new JNI function table");
     }
 
     NSK_DISPLAY1("%s JVMTI env: doRedirect: the functions are overwritten successfully\n",
@@ -158,8 +132,7 @@
 static void provokeIntercept(JNIEnv *env, const char *name) {
     jint res;
 
-    res = JNI_ENV_PTR(env)->
-        GetVersion(JNI_ENV_ARG1(env));
+    res = env->GetVersion();
     NSK_DISPLAY2("\nGetVersion() called by the agent %s returns %d\n",
         name, res);
 }
@@ -198,10 +171,8 @@
 
     thrstarted[indx] = redir[indx] = redir_calls[indx] = 0;
 
-    NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n",
-        (indx==0)?"A":"B");
-    res = JNI_ENV_PTR(vm)->
-        GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti[indx]), JVMTI_VERSION_1_1);
+    NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n", (indx==0)?"A":"B");
+    res = vm->GetEnv((void **) &jvmti[indx], JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti[indx] == NULL) {
         NSK_COMPLAIN1("TEST FAILURE: failed to call GetEnv for the agent %s\n",
             (indx==0)?"A":"B");
@@ -230,8 +201,7 @@
 
     NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n",
         (indx==0)?"A":"B");
-    if ((err = jvmti[indx]->SetEventNotificationMode(
-            JVMTI_ENABLE,
+    if ((err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE,
             JVMTI_EVENT_VM_INIT, NULL)) != JVMTI_ERROR_NONE) { /* enable event globally */
         NSK_COMPLAIN2("TEST FAILURE: failed to enable JVMTI_EVENT_VM_INIT event for the agent %s: %s\n",
             (indx==0)?"A":"B", TranslateError(err));
@@ -282,11 +252,8 @@
     int exitCode = PASSED;
 
     NSK_DISPLAY0("\nthe agent A started\n\tattaching the thread to the VM ...\n");
-    if ((res =
-            JNI_ENV_PTR(vm)->AttachCurrentThread(
-                JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) {
-        NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n",
-            res);
+    if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
+        NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n", res);
         exit(STATUS_FAILED);
     }
 
@@ -333,7 +300,7 @@
 
     NSK_DISPLAY1("\nagent A: detaching and returning exit code %d\n",
         exitCode);
-    if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) {
+    if ((res = vm->DetachCurrentThread()) != 0) {
         NSK_COMPLAIN1("TEST WARNING: agent A: DetachCurrentThread() returns: %d\n", res);
     }
     return exitCode;
@@ -347,9 +314,7 @@
     int exitCode = PASSED;
 
     NSK_DISPLAY0("\nthe agent B started\n\tattaching the thread to the VM ...\n");
-    if ((res =
-            JNI_ENV_PTR(vm)->AttachCurrentThread(
-                JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) {
+    if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
         NSK_COMPLAIN1("TEST FAILURE: AttachCurrentThread() returns: %d\n",
             res);
         exit(STATUS_FAILED);
@@ -396,7 +361,7 @@
 
     NSK_DISPLAY1("\nagent B: detaching and returning exit code %d\n",
         exitCode);
-    if ((res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm))) != 0) {
+    if ((res = vm->DetachCurrentThread()) != 0) {
         NSK_COMPLAIN1("TEST WARNING: agent B: DetachCurrentThread() returns: %d\n", res);
     }
     return exitCode;
@@ -470,6 +435,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -34,27 +34,7 @@
 #include "jvmti_tools.h"
 #include "native_thread.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG(x, y) y
-    #define JNI_ENV_PTR(x) x
-  #else
-    #define JNI_ENV_ARG(x, y) x, y
-    #define JNI_ENV_PTR(x) (*x)
-  #endif
-#endif
-
-#ifndef JNI_ENV_ARG1
-  #ifdef __cplusplus
-    #define JNI_ENV_ARG1(x)
-  #else
-    #define JNI_ENV_ARG1(x) x
-  #endif
-#endif
 
 #define PASSED  0
 #define STATUS_FAILED  2
@@ -65,7 +45,7 @@
 // Helper for thread detach and terminate
 #define THREAD_return(status) \
   do { \
-      int res = JNI_ENV_PTR(vm)->DetachCurrentThread(JNI_ENV_ARG1(vm)); \
+      int res = vm->DetachCurrentThread(); \
       if (res != 0) \
           NSK_COMPLAIN1("TEST WARNING: DetachCurrentThread() returns: %d\n", res); \
       else \
@@ -128,17 +108,16 @@
 static jint enterMonitor(JNIEnv *env, const char *thr) {
     jint result;
 
-    if ((result = JNI_ENV_PTR(env)->
-            MonitorEnter(JNI_ENV_ARG(env, clsObj))) != 0) {
+    if ((result = env->MonitorEnter(clsObj)) != 0) {
         NSK_COMPLAIN2("TEST FAILURE: %s: MonitorEnter() returns: %d\n",
             thr, result);
         return STATUS_FAILED;
     }
-    if (JNI_ENV_PTR(env)->ExceptionOccurred(JNI_ENV_ARG1(env))) {
+    if (env->ExceptionOccurred()) {
         NSK_COMPLAIN1("TEST FAILURE: %s: exception occured\n",
             thr);
-        JNI_ENV_PTR(env)->ExceptionDescribe(JNI_ENV_ARG1(env));
-        JNI_ENV_PTR(env)->ExceptionClear(JNI_ENV_ARG1(env));
+        env->ExceptionDescribe();
+        env->ExceptionClear();
         return STATUS_FAILED;
     }
 
@@ -148,8 +127,7 @@
 static jint exitMonitor(JNIEnv *env, const char *thr) {
     jint result;
 
-    if ((result = JNI_ENV_PTR(env)->
-            MonitorExit(JNI_ENV_ARG(env, clsObj))) != 0) {
+    if ((result = env->MonitorExit(clsObj)) != 0) {
         NSK_COMPLAIN2("TEST FAILURE: %s: MonitorExit() returns: %d\n",
             thr, result);
         return STATUS_FAILED;
@@ -167,16 +145,14 @@
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: failed to get original JNI function table: %s\n",
             TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get original JNI function table"));
+        env->FatalError("failed to get original JNI function table");
     }
     if ((err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) !=
             JVMTI_ERROR_NONE) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: failed to get redirected JNI function table: %s\n",
             TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get redirected JNI function table"));
+        env->FatalError("failed to get redirected JNI function table");
     }
 
     NSK_DISPLAY0("doRedirect: the JNI function table obtained successfully\n\
@@ -189,8 +165,7 @@
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILED: failed to set new JNI function table: %s\n",
             TranslateError(err));
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to set new JNI function table"));
+        env->FatalError("failed to set new JNI function table");
     }
 
     NSK_DISPLAY0("doRedirect: the functions are overwritten successfully\n");
@@ -222,9 +197,7 @@
     NSK_DISPLAY1("waitingThread: thread #%d started\n\
 \tattaching the thread to the VM ...\n",
         indx);
-    if ((res =
-            JNI_ENV_PTR(vm)->AttachCurrentThread(
-                JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) {
+    if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
         NSK_COMPLAIN1("TEST FAILURE: waitingThread: AttachCurrentThread() returns: %d\n",
             res);
         return STATUS_FAILED;
@@ -255,9 +228,7 @@
     int tries = 0;
 
     NSK_DISPLAY0("ownerThread: thread started\n\tattaching the thread to the VM ...\n");
-    if ((res =
-            JNI_ENV_PTR(vm)->AttachCurrentThread(
-                JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) {
+    if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
         NSK_COMPLAIN1("TEST FAILURE: ownerThread: AttachCurrentThread() returns: %d\n",
             res);
         return STATUS_FAILED;
@@ -277,8 +248,7 @@
         if (tries > TRIES) {
             NSK_COMPLAIN1("TEST FAILED: ownerThread: time exceed after %d attempts\n",
                 TRIES);
-            JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-                "ownerThread: time exceed"));
+            env->FatalError("ownerThread: time exceed");
         }
     } while(releaseMon != 1);
 
@@ -298,9 +268,7 @@
     int tries = 0;
 
     NSK_DISPLAY0("redirectorThread: thread started\n\tattaching the thread to the VM ...\n");
-    if ((res =
-            JNI_ENV_PTR(vm)->AttachCurrentThread(
-                JNI_ENV_ARG(vm, (void **) &env), (void *) 0)) != 0) {
+    if ((res = vm->AttachCurrentThread((void **) &env, (void *) 0)) != 0) {
         NSK_COMPLAIN1("TEST FAILURE: redirectorThread: AttachCurrentThread() returns: %d\n",
             res);
         return STATUS_FAILED;
@@ -320,21 +288,18 @@
     jfieldID fid;
     jclass _objCls;
 
-    _objCls = JNI_ENV_PTR(env)->GetObjectClass(JNI_ENV_ARG(env, obj));
+    _objCls = env->GetObjectClass(obj);
 
     NSK_DISPLAY2("getObjectFromField: obtaining field ID for name=\"%s\" signature=\"%s\"...\n",
         javaField, classSig);
-    if ((fid = JNI_ENV_PTR(env)->GetFieldID(
-            JNI_ENV_ARG(env, _objCls), javaField, classSig)) == 0) {
+    if ((fid = env->GetFieldID(_objCls, javaField, classSig)) == 0) {
         result = STATUS_FAILED;
         NSK_COMPLAIN1("TEST FAILURE: failed to get ID for the field \"%s\"\n",
             javaField);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to get ID for the java field"));
+        env->FatalError("failed to get ID for the java field");
     }
 
-    return JNI_ENV_PTR(env)->GetObjectField(
-        JNI_ENV_ARG(env, obj), fid);
+    return env->GetObjectField(obj, fid);
 }
 
 JNIEXPORT jint JNICALL
@@ -355,12 +320,10 @@
     }
 
 /* prepare the testing */
-    if ((clsObj = JNI_ENV_PTR(env)->NewGlobalRef(
-            JNI_ENV_ARG(env, getObjectFromField(env, obj)))) == NULL) {
+    if ((clsObj = env->NewGlobalRef(getObjectFromField(env, obj))) == NULL) {
         NSK_COMPLAIN1("TEST FAILURE: cannot create a new global reference of class \"%s\"\n",
             classSig);
-        JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-            "failed to create a new global reference"));
+        env->FatalError("failed to create a new global reference");
     }
 
     NSK_DISPLAY0("starting monitor owner thread ...\n");
@@ -377,8 +340,7 @@
         if (tries > TRIES) {
             NSK_COMPLAIN1("TEST FAILURE: the monitor is still not entered by the owner thread after %d attempts\n",
                 TRIES);
-            JNI_ENV_PTR(env)->FatalError(JNI_ENV_ARG(env,
-                " the monitor is still not entered by the owner thread"));
+            env->FatalError(" the monitor is still not entered by the owner thread");
         }
     } while(monEntered != 1);
 
@@ -483,7 +445,7 @@
         free(waitThr[i]);
     }
 
-    JNI_ENV_PTR(env)->DeleteGlobalRef(JNI_ENV_ARG(env, clsObj));
+    env->DeleteGlobalRef(clsObj);
     NSK_DISPLAY0("<<<\n\n");
 
     NSK_DISPLAY0(">>> TEST CASE c) Checking number of the intercepted calls ...\n");
@@ -523,6 +485,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -114,6 +112,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -114,6 +112,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -151,6 +149,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -151,6 +149,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -162,6 +160,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -151,6 +149,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #define STATUS_FAILED 2
 #define SAMPLE_TAG ((jlong) 111111)
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -240,6 +238,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #define STATUS_FAILED 2
 #define SAMPLE_TAG ((jlong) 222222)
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -240,6 +238,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #define STATUS_FAILED 2
 #define SAMPLE_TAG ((jlong) 111111)
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -348,6 +346,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #define STATUS_FAILED 2
 #define SAMPLE_TAG ((jlong) 222222)
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -348,6 +346,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #define STATUS_FAILED 2
 #define SAMPLE_TAG ((jlong) 111111)
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -197,6 +195,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,9 +31,7 @@
 #define STATUS_FAILED 2
 #define SAMPLE_TAG ((jlong) 222222)
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -197,6 +195,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -287,6 +285,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -307,6 +305,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -245,6 +243,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -245,6 +243,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -185,6 +183,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -186,6 +184,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -214,6 +212,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -261,6 +259,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -195,6 +193,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -173,6 +171,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -201,6 +199,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -138,6 +136,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -202,6 +200,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -139,6 +137,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -207,6 +205,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -144,6 +142,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -135,6 +133,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -131,6 +129,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -172,6 +170,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -162,6 +160,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -139,6 +137,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -132,6 +130,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -222,6 +220,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #define PASSED 0
 #define STATUS_FAILED 2
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -208,6 +206,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 
 /* ============================================================================= */
@@ -277,6 +275,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -465,6 +463,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -478,6 +476,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -388,6 +386,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -452,6 +450,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -469,6 +467,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -481,6 +479,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -484,6 +482,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -481,6 +479,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -481,6 +479,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -420,6 +418,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -532,6 +530,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -518,6 +516,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -547,6 +545,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -564,6 +562,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define MAX_DEPTH 1024
 
@@ -370,6 +368,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "agent_common.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define MAX_DEPTH 1024
 
@@ -336,6 +334,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -880,6 +878,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -773,6 +771,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -1108,6 +1106,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "jvmti_FollowRefObjects.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -265,6 +263,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jvmti_tools.h"
 #include "jvmti_FollowRefObjects.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jlong g_timeout = 0;
 
@@ -165,6 +163,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "jvmti_FollowRefObjects.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -270,6 +268,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -174,8 +161,7 @@
     printf(">>>>>>>> Invoke ForceEarlyReturn()\n");
 
     printf("Before call to GetMethodID(%s, %s)\n", name_exp, sig_exp);
-    midActiveMethod = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, targCls),
-                                                    name_exp, sig_exp);
+    midActiveMethod = env->GetMethodID(targCls, name_exp, sig_exp);
     if (midActiveMethod == NULL) {
         printf("Cannot find Method ID for method %s\n", name_exp);
         RETURN_FAILED;
@@ -211,8 +197,7 @@
     jint res;
     jvmtiError err;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong error code from a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -288,6 +273,4 @@
     return errCode;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -326,8 +313,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong error code from a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -396,29 +382,25 @@
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         RETURN_FAILED;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
     }
 
-    midCountDownFloat = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownFloat", "(I)F");
+    midCountDownFloat = env->GetMethodID(cls, "countDownFloat", "(I)F");
     if (midCountDownFloat == NULL) {
         printf("Cannot find Method ID for method countDownFloat\n");
         RETURN_FAILED;
     }
 
-    midCountDownDouble = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownDouble", "(I)D");
+    midCountDownDouble = env->GetMethodID(cls, "countDownDouble", "(I)D");
     if (midCountDownDouble == NULL) {
         printf("Cannot find Method ID for method countDownDouble\n");
         RETURN_FAILED;
@@ -473,6 +455,4 @@
     return errCode;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -332,8 +319,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong error code from a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -401,50 +387,43 @@
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         RETURN_FAILED;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
     }
 
-    midCountDownInt = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownInt", "(I)I");
+    midCountDownInt = env->GetMethodID(cls, "countDownInt", "(I)I");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method countDownInt\n");
         RETURN_FAILED;
     }
 
-    midCountDownShort = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownShort", "(I)S");
+    midCountDownShort = env->GetMethodID(cls, "countDownShort", "(I)S");
     if (midCountDownShort == NULL) {
         printf("Cannot find Method ID for method countDownShort\n");
         RETURN_FAILED;
     }
 
-    midCountDownChar = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownChar", "(I)C");
+    midCountDownChar = env->GetMethodID(cls, "countDownChar", "(I)C");
     if (midCountDownChar == NULL) {
         printf("Cannot find Method ID for method countDownChar\n");
         RETURN_FAILED;
     }
 
-    midCountDownByte = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownByte", "(I)B");
+    midCountDownByte = env->GetMethodID(cls, "countDownByte", "(I)B");
     if (midCountDownByte == NULL) {
         printf("Cannot find Method ID for method countDownByte\n");
         RETURN_FAILED;
     }
 
-    midCountDownBoolean = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownBoolean", "(I)Z");
+    midCountDownBoolean = env->GetMethodID(cls, "countDownBoolean", "(I)Z");
     if (midCountDownBoolean == NULL) {
         printf("Cannot find Method ID for method countDownBoolean\n");
         RETURN_FAILED;
@@ -488,6 +467,4 @@
     return errCode;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -313,8 +300,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong error code from a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -383,22 +369,19 @@
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         RETURN_FAILED;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
     }
 
-    midCountDownLong = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownLong", "(I)J");
+    midCountDownLong = env->GetMethodID(cls, "countDownLong", "(I)J");
     if (midCountDownLong == NULL) {
         printf("Cannot find Method ID for method countDownLong\n");
         RETURN_FAILED;
@@ -444,6 +427,4 @@
     return errCode;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,21 +28,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -277,7 +264,7 @@
         return;
     }
     if (method == midCountDownObject) {
-        if (!JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, ret_val), val_exp)) {
+        if (!env->IsSameObject(ret_val, val_exp)) {
             printf("Wrong ForceEarlyReturnObject return value: 0x%p\n", ret_val);
             printf("expected: 0x%p\n", val_exp);
             errCode = STATUS_FAILED;
@@ -311,8 +298,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong error code from a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -380,22 +366,19 @@
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         RETURN_FAILED;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
     }
 
-    midCountDownObject = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownObject", sig_exp);
+    midCountDownObject = env->GetMethodID(cls, "countDownObject", sig_exp);
     if (midCountDownObject == NULL) {
         printf("Cannot find Method ID for method countDownObject\n");
         RETURN_FAILED;
@@ -415,7 +398,7 @@
                TranslateError(err), err);
         RETURN_FAILED;
     } else {
-        val_exp = JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, ret_obj));
+        val_exp = env->NewGlobalRef(ret_obj);
         framesExpected = depth;
     }
 }
@@ -440,6 +423,4 @@
     return;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -277,8 +264,8 @@
         return;
     }
     if (method == midCountDownString) {
-      ret_str = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, ret_val), 0);
-      exp_str = JNI_ENV_PTR(env)->GetStringUTFChars(JNI_ENV_ARG(env, str_exp), 0);
+      ret_str = env->GetStringUTFChars(ret_val, 0);
+      exp_str = env->GetStringUTFChars(str_exp, 0);
       printf("Expected string: \"%s\"\n", exp_str);
       printf("Returned string: \"%s\"\n", ret_str);
       if (was_popped_by_exception) {
@@ -310,8 +297,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong error code of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -379,22 +365,19 @@
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         RETURN_FAILED;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
     }
 
-    midCountDownString = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "countDownString", sig_exp);
+    midCountDownString = env->GetMethodID(cls, "countDownString", sig_exp);
     if (midCountDownString == NULL) {
         printf("Cannot find Method ID for method countDownString\n");
         RETURN_FAILED;
@@ -414,7 +397,7 @@
                TranslateError(err), err);
         RETURN_FAILED;
     } else {
-        str_exp = (jstring) JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, expected_str));
+        str_exp = (jstring) env->NewGlobalRef(expected_str);
         framesExpected = depth;
     }
 }
@@ -430,6 +413,4 @@
     return errCode;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -260,8 +247,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong error code from a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -325,15 +311,13 @@
         return;
     }
 
-    midRun = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "run", "()V");
+    midRun = env->GetMethodID(cls, "run", "()V");
     if (midRun == NULL) {
         printf("Cannot find Method ID for method run\n");
         RETURN_FAILED;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
@@ -369,6 +353,4 @@
     return errCode;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,39 +27,19 @@
 #include "jni_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG  JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR  JNI_ENV_PTR
 
 #define STATUS_FAILED 2
 #define PASSED 0
 
 #define JVMTI_ERROR_CHECK(str,res)   \
-    if ( res != JVMTI_ERROR_NONE) {  \
+    if (res != JVMTI_ERROR_NONE) {  \
         printf("%s %d\n" ,str, res); \
         return res;                  \
     }
 
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) \
-    if ( res != err) {                                \
+    if (res != err) {                                \
         printf("%s unexpected error %d\n", str, res); \
         return res;                                   \
     }
@@ -105,18 +85,17 @@
 jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) {
     jint res;
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
     }
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
     return JNI_OK;
@@ -139,8 +118,7 @@
     char sz[128];
 
     sprintf(sz, "Raw-monitor");
-    ret = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti, sz),
-                                                 &jraw_monitor);
+    ret = jvmti->CreateRawMonitor(sz, &jraw_monitor);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Raw monitor create %d \n", ret);
@@ -154,7 +132,7 @@
 {
     jvmtiError ret;
 
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, jraw_monitor));
+    ret = jvmti->RawMonitorEnter(jraw_monitor);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Raw monitor enter %d \n", ret);
@@ -168,7 +146,7 @@
 {
     jvmtiError ret;
 
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti, jraw_monitor));
+    ret = jvmti->RawMonitorExit(jraw_monitor);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorExit %d \n", ret);
@@ -273,16 +251,14 @@
     jvmtiError ret;
     int ti;
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetAllStackTraces(JVMTI_ENV_ARG(jvmti, MAX_FRAMES_CNT),
-                                                  &stack_buf1,
-                                                  &threads_count);
+    ret = jvmti->GetAllStackTraces(MAX_FRAMES_CNT, &stack_buf1, &threads_count);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetAllStackTraces %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->Allocate(JVMTI_ENV_ARG(jvmti, sizeof(jthread) * threads_count),
-                                         (unsigned char**)&thread_list);
+    ret = jvmti->Allocate(sizeof(jthread) * threads_count,
+                          (unsigned char**) &thread_list);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Allocate failed with  %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
@@ -290,8 +266,7 @@
 
     for (ti = 0; ti < threads_count; ti++) {
         thread_list[ti] =
-          (jthread)JNI_ENV_PTR(env)->NewGlobalRef(
-                     JNI_ENV_ARG(env, stack_buf1[ti].thread));
+          (jthread)env->NewGlobalRef(stack_buf1[ti].thread);
     }
 }
 
@@ -302,16 +277,15 @@
     jvmtiError ret;
     int ti;
 
-    ret = JVMTI_ENV_PTR(jvmti)->Allocate(JVMTI_ENV_ARG(jvmti, sizeof(jvmtiThreadInfo) * threads_count),
-                                         (unsigned char**)&thread_info);
+    ret = jvmti->Allocate(sizeof(jvmtiThreadInfo) * threads_count,
+                          (unsigned char**)&thread_info);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Allocate failed with  %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
     }
 
     for (ti = 0; ti < threads_count; ti++) {
-        ret = JVMTI_ENV_PTR(jvmti)->GetThreadInfo(JVMTI_ENV_ARG(jvmti, thread_list[ti]),
-                                                  &thread_info[ti]);
+        ret = jvmti->GetThreadInfo(thread_list[ti], &thread_info[ti]);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetThreadInfo %d \n", ret);
             iGlobalStatus = STATUS_FAILED;
@@ -327,11 +301,8 @@
 {
     jvmtiError ret;
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetThreadListStackTraces(
-                                                  JVMTI_ENV_ARG(jvmti, threads_count),
-                                                  thread_list,
-                                                  MAX_FRAMES_CNT,
-                                                  &stack_buf2);
+    ret = jvmti->GetThreadListStackTraces(
+        threads_count, thread_list, MAX_FRAMES_CNT, &stack_buf2);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetThreadListStackTraces %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
@@ -344,7 +315,7 @@
      JNIEnv * env, jclass cls)
 {
     jvmtiError ret;
-    ret = JVMTI_ENV_PTR(jvmti)->ForceGarbageCollection(JVMTI_ENV_ARG1(jvmti));
+    ret = jvmti->ForceGarbageCollection();
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: ForceGarbageCollection %d \n", ret);
@@ -365,30 +336,28 @@
 {
     jvmtiError ret;
 
-    ret = JVMTI_ENV_PTR(jvmti)->Deallocate(JVMTI_ENV_ARG(jvmti, (unsigned char *)stack_buf1));
+    ret = jvmti->Deallocate((unsigned char *) stack_buf1);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Deallocate stack_buf1 failed with  %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->Deallocate(JVMTI_ENV_ARG(jvmti, (unsigned char *)stack_buf2));
+    ret = jvmti->Deallocate((unsigned char *) stack_buf2);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Deallocate stack_buf2 failed with  %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->Deallocate(JVMTI_ENV_ARG(jvmti, (unsigned char *)thread_info));
+    ret = jvmti->Deallocate((unsigned char *) thread_info);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Deallocate thread_info failed with  %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
     }
-    ret = JVMTI_ENV_PTR(jvmti)->Deallocate(JVMTI_ENV_ARG(jvmti, (unsigned char *)thread_list));
+    ret = jvmti->Deallocate((unsigned char *) thread_list);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Deallocate thread_list failed with  %d \n", ret);
         iGlobalStatus = STATUS_FAILED;
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -114,8 +101,7 @@
     jvmtiError err;
     jint res;
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -176,8 +162,7 @@
         return;
     }
 
-    midCheckPoint = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-         "checkPoint", "()V");
+    midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V");
     if (midCheckPoint == NULL) {
         printf("Cannot find Method ID for method checkPoint\n");
         RETURN_FAILED;
@@ -190,8 +175,7 @@
         RETURN_FAILED;
     }
 
-    err = jvmti->SetEventNotificationMode(JVMTI_ENABLE,
-        JVMTI_EVENT_BREAKPOINT, NULL);
+    err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL);
     if (err != JVMTI_ERROR_NONE) {
         printf("Failed to enable BREAKPOINT event: %s (%d)\n",
                TranslateError(err), err);
@@ -205,6 +189,4 @@
     return errCode;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,21 +30,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -73,8 +60,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -158,15 +144,13 @@
     if (printdump == JNI_TRUE) {
         printf("\n Check methods of interface:\n");
     }
-    interf = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env,
-        "nsk/jvmti/unit/GetLineNumberTable/Interface004"));
+    interf = env->FindClass("nsk/jvmti/unit/GetLineNumberTable/Interface004");
     if (interf == NULL) {
         printf("Cannot get Interface class!\n");
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth0", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth0", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -174,8 +158,7 @@
     checkGetLineNumberTable(mid, "instanceMeth0", 1,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth1", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth1", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -186,14 +169,13 @@
     if (printdump == JNI_TRUE) {
         printf("\n Check methods of abstract class:\n");
     }
-    abstr = JNI_ENV_PTR(env)->GetSuperclass(JNI_ENV_ARG(env, cls));
+    abstr = env->GetSuperclass(cls);
     if (abstr == NULL) {
         printf("Cannot get super class!\n");
         return STATUS_FAILED;
     }
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, abstr),
-        "instanceMeth0", "()I");
+    mid = env->GetMethodID(abstr, "instanceMeth0", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -201,8 +183,7 @@
     checkGetLineNumberTable(mid, "instanceMeth0", 1,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, abstr),
-        "instanceMeth1", "()I");
+    mid = env->GetMethodID(abstr, "instanceMeth1", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -213,8 +194,7 @@
     if (printdump == JNI_TRUE) {
         printf("\n Check methods of regular class:\n");
     }
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth0", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth0", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -222,8 +202,7 @@
     checkGetLineNumberTable(mid, "instanceMeth0", 0,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth1", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth1", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -231,8 +210,7 @@
     checkGetLineNumberTable(mid, "instanceMeth1", 0,
         JVMTI_ERROR_ABSENT_INFORMATION);
 
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceMeth2", "()I");
+    mid = env->GetMethodID(cls, "instanceMeth2", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -243,8 +221,7 @@
     if (printdump == JNI_TRUE) {
         printf("\n Check native methods of regular class:\n");
     }
-    mid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, cls),
-        "instanceNativeMeth", "()I");
+    mid = env->GetMethodID(cls, "instanceNativeMeth", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -252,8 +229,7 @@
     checkGetLineNumberTable(mid, "instanceNativeMeth", 1,
         JVMTI_ERROR_NATIVE_METHOD);
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-        "staticNativeMeth", "()I");
+    mid = env->GetStaticMethodID(cls, "staticNativeMeth", "()I");
     if (mid == NULL) {
         printf("Cannot get method ID!\n");
         return STATUS_FAILED;
@@ -268,6 +244,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,21 +31,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -151,8 +138,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -209,8 +195,7 @@
     if (!caps.can_access_local_variables ||
         !caps.can_generate_method_exit_events) return;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-                                              "staticMeth", "(I)I");
+    mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I");
     if (mid == NULL) {
         printf("Cannot find Method ID for staticMeth\n");
         result = STATUS_FAILED;
@@ -250,8 +235,7 @@
         return;
     }
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-                                              "staticMeth", "(I)I");
+    mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I");
     if (mid == NULL) {
         printf("Cannot find Method ID for staticMeth\n");
         result = STATUS_FAILED;
@@ -324,6 +308,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -31,21 +31,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -82,8 +69,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -128,8 +114,7 @@
     if (!caps.can_access_local_variables ||
         !caps.can_generate_method_exit_events) return;
 
-    mid = JNI_ENV_PTR(env)->GetStaticMethodID(JNI_ENV_ARG(env, cls),
-                                              "staticMeth", "(I)I");
+    mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I");
     if (mid == NULL) {
         printf("Cannot find Method ID for staticMeth\n");
         result = STATUS_FAILED;
@@ -243,6 +228,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -71,8 +58,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -294,6 +280,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,27 +26,8 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -161,8 +142,7 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -170,24 +150,24 @@
 
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("AddCapabilities returned error", res);
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_DEATH,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_NATIVE_METHOD_BIND,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for native method bind event returned error", res);
 
     return JNI_OK;
@@ -207,7 +187,7 @@
 
     sprintf(sz, "Rawmonitor-%d",i);
     debug_printf("jvmti create raw monitor \n");
-    ret = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti, sz), &jraw_monitor[i]);
+    ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: ForceGarbageCollection %d \n", ret);
@@ -220,7 +200,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti Raw monitor enter \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorEnter(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Raw monitor enter %d \n", ret);
@@ -233,7 +213,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti raw monitor exit \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorExit(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorExit %d \n", ret);
@@ -246,7 +226,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti RawMonitorWait \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorWait(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]), -1);
+    ret = jvmti->RawMonitorWait(jraw_monitor[i], -1);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorWait %d \n", ret);
@@ -259,7 +239,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti RawMonitorNotify \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorNotifyAll(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorNotifyAll(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorNotify %d \n", ret);
@@ -273,7 +253,7 @@
     jint count;
 
     debug_printf("jvmti GetFrameCount \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetFrameCount(JVMTI_ENV_ARG(jvmti, (jthread)thr),  &count);
+    ret = jvmti->GetFrameCount((jthread) thr,  &count);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetFrameCount returned  %d \n", ret);
         iGlobalStatus = 2;
@@ -288,21 +268,21 @@
     char *mname;
     char *signature;
     char *clname = (char*) "unknown";
-    ret = JVMTI_ENV_PTR(jvmti)->GetMethodDeclaringClass(JVMTI_ENV_ARG(jvmti, mid), &klass);
+    ret = jvmti->GetMethodDeclaringClass(mid, &klass);
     if (ret != JVMTI_ERROR_NONE) {
       printf("Error: GetMethodDeclaringClass %d  \n", ret);
       iGlobalStatus = 2;
       return;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetClassSignature(JVMTI_ENV_ARG(jvmti, klass), &clname, NULL);
+    ret = jvmti->GetClassSignature(klass, &clname, NULL);
     if (ret != JVMTI_ERROR_NONE) {
       printf("Error: GetClassSignature %d  \n", ret);
       iGlobalStatus = 2;
       return;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetMethodName(JVMTI_ENV_ARG(jvmti, mid), &mname, &signature, NULL);
+    ret = jvmti->GetMethodName(mid, &mname, &signature, NULL);
     if (ret != JVMTI_ERROR_NONE) {
       printf("Error: GetMethodName %d  \n", ret);
       iGlobalStatus = 2;
@@ -321,19 +301,20 @@
     jint count;
 
 
-    ret = JVMTI_ENV_PTR(jvmti)->Allocate(JVMTI_ENV_ARG(jvmti, sizeof(jvmtiFrameInfo) * max_count), (unsigned char**)&stack_buffer);
+    ret = jvmti->Allocate(sizeof(jvmtiFrameInfo) * max_count,
+                          (unsigned char**) &stack_buffer);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Allocate failed with  %d \n", ret);
         iGlobalStatus = 2;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetStackTrace(JVMTI_ENV_ARG(jvmti, thr), 0, max_count , stack_buffer, &count);
+    ret = jvmti->GetStackTrace(thr, 0, max_count, stack_buffer, &count);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetStackTrace %d \n", ret);
         iGlobalStatus = 2;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->Deallocate(JVMTI_ENV_ARG(jvmti, (unsigned char *)stack_buffer));
+    ret = jvmti->Deallocate((unsigned char *) stack_buffer);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Deallocate failed with  %d \n", ret);
         iGlobalStatus = 2;
@@ -347,6 +328,4 @@
 
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,23 +26,8 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 
 jvmtiEnv *jvmti;
@@ -61,8 +46,7 @@
 jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) {
     jint res;
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -83,6 +67,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,27 +30,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -107,8 +87,7 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -116,10 +95,10 @@
 
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
     return JNI_OK;
@@ -139,7 +118,7 @@
 
     sprintf(sz, "Rawmonitor-%d",i);
     debug_printf("jvmti create raw monitor \n");
-    ret = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti, sz), &jraw_monitor[i]);
+    ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: ForceGarbageCollection %d \n", ret);
@@ -152,7 +131,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti Raw monitor enter \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorEnter(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Raw monitor enter %d \n", ret);
@@ -165,7 +144,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti raw monitor exit \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorExit(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorExit %d \n", ret);
@@ -178,7 +157,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti RawMonitorWait \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorWait(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]), -1);
+    ret = jvmti->RawMonitorWait(jraw_monitor[i], -1);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorWait %d \n", ret);
@@ -191,7 +170,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti RawMonitorNotify \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorNotifyAll(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorNotifyAll(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorNotify %d \n", ret);
@@ -205,7 +184,7 @@
     jint count;
 
     debug_printf("jvmti GetFrameCount \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetFrameCount(JVMTI_ENV_ARG(jvmti, (jthread)thr),  &count);
+    ret = jvmti->GetFrameCount((jthread) thr,  &count);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetFrameCount returned  %d \n", ret);
         iGlobalStatus = 2;
@@ -230,26 +209,26 @@
 
     debug_printf("jvmti GetStackTrace \n");
 
-    ret = JVMTI_ENV_PTR(jvmti)->Allocate(JVMTI_ENV_ARG(jvmti, sizeof(jvmtiFrameInfo) * max_count), (unsigned char**)&stack_buffer);
+    ret = jvmti->Allocate(sizeof(jvmtiFrameInfo) * max_count, (unsigned char**)&stack_buffer);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Allocate failed with  %d \n", ret);
         iGlobalStatus = 2;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->Allocate(JVMTI_ENV_ARG(jvmti, sizeof(jvmtiFrameInfo) * max_count), (unsigned char**)&compare_buffer);
+    ret = jvmti->Allocate(sizeof(jvmtiFrameInfo) * max_count, (unsigned char**)&compare_buffer);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Allocate failed with  %d \n", ret);
         iGlobalStatus = 2;
     }
 
 
-    ret = JVMTI_ENV_PTR(jvmti)->SuspendThread(JVMTI_ENV_ARG(jvmti, thr));
+    ret = jvmti->SuspendThread(thr);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: SuspendThread failed with  %d \n", ret);
         iGlobalStatus = 2;
     }
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetStackTrace(JVMTI_ENV_ARG(jvmti, thr), 0, max_count , stack_buffer, &count);
+    ret = jvmti->GetStackTrace(thr, 0, max_count, stack_buffer, &count);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetStackTrace %d \n", ret);
         iGlobalStatus = 2;
@@ -257,7 +236,7 @@
 
     for (i = 1; i < count; ++i) {
       jint res_count = 48343;
-      ret = JVMTI_ENV_PTR(jvmti)->GetStackTrace(JVMTI_ENV_ARG(jvmti, thr), i, max_count , compare_buffer, &res_count);
+      ret = jvmti->GetStackTrace(thr, i, max_count, compare_buffer, &res_count);
       if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetStackTrace2 %d \n", ret);
         iGlobalStatus = 2;
@@ -276,7 +255,7 @@
 
     for (i = 1; i < count; ++i) {
       jint res_count = 48343;
-      ret = JVMTI_ENV_PTR(jvmti)->GetStackTrace(JVMTI_ENV_ARG(jvmti, thr), -i, max_count , compare_buffer, &res_count);
+      ret = jvmti->GetStackTrace(thr, -i, max_count, compare_buffer, &res_count);
       if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetStackTrace2 %d \n", ret);
         iGlobalStatus = 2;
@@ -296,7 +275,7 @@
     debug_printf("Count = %d\n", count);
 
 
-    ret = JVMTI_ENV_PTR(jvmti)->ResumeThread(JVMTI_ENV_ARG(jvmti, thr));
+    ret = jvmti->ResumeThread(thr);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: ResumeThread failed with  %d \n", ret);
         iGlobalStatus = 2;
@@ -305,21 +284,21 @@
     debug_printf(" Java Stack trace ---\n");
 
     for (i = 0; i < count; i++) {
-        ret = JVMTI_ENV_PTR(jvmti)->GetMethodDeclaringClass(JVMTI_ENV_ARG(jvmti, stack_buffer[i].method), &klass);
+        ret = jvmti->GetMethodDeclaringClass(stack_buffer[i].method, &klass);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetMethodDeclaringClass %d  \n", ret);
             iGlobalStatus = 2;
             return;
         }
 
-        ret = JVMTI_ENV_PTR(jvmti)->GetClassSignature(JVMTI_ENV_ARG(jvmti, klass), &clname, NULL);
+        ret = jvmti->GetClassSignature(klass, &clname, NULL);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetClassSignature %d  \n", ret);
             iGlobalStatus = 2;
             return;
         }
 
-        ret = JVMTI_ENV_PTR(jvmti)->GetMethodName(JVMTI_ENV_ARG(jvmti, stack_buffer[i].method), &mname, &signature, NULL);
+        ret = jvmti->GetMethodName(stack_buffer[i].method, &mname, &signature, NULL);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetMethodName %d  \n", ret);
             iGlobalStatus = 2;
@@ -332,7 +311,7 @@
     }
 
 
-    ret = JVMTI_ENV_PTR(jvmti)->Deallocate(JVMTI_ENV_ARG(jvmti, (unsigned char *)stack_buffer));
+    ret = jvmti->Deallocate((unsigned char *) stack_buffer);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Deallocate failed with  %d \n", ret);
         iGlobalStatus = 2;
@@ -346,6 +325,4 @@
 
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -60,9 +47,9 @@
     jmethodID cid;
     jthread res;
 
-    thrClass = JNI_ENV_PTR(env)->FindClass(JNI_ENV_ARG(env, "java/lang/Thread"));
-    cid = JNI_ENV_PTR(env)->GetMethodID(JNI_ENV_ARG(env, thrClass), "<init>", "()V");
-    res = JNI_ENV_PTR(env)->NewObject(JNI_ENV_ARG(env, thrClass), cid);
+    thrClass = env->FindClass("java/lang/Thread");
+    cid = env->GetMethodID(thrClass, "<init>", "()V");
+    res = env->NewObject(thrClass, cid);
     return res;
 }
 
@@ -74,8 +61,7 @@
         result = STATUS_FAILED;
     }
 
-    JNI_ENV_PTR(jvm_ins)->GetEnv(JNI_ENV_ARG(jvm_ins, (void **) &env),
-        JNI_VERSION_1_2);
+    jvm_ins->GetEnv((void **) &env, JNI_VERSION_1_2);
     if (jni_env != env) {
         printf("(agent_start) JNI envs don't match\n");
         result = STATUS_FAILED;
@@ -140,8 +126,7 @@
     }
 
     jvm_ins = jvm;
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -179,6 +164,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -68,8 +55,7 @@
         printdump = JNI_TRUE;
     }
 
-    res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-        JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res != JNI_OK || jvmti == NULL) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -188,6 +174,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,21 +27,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define STATUS_FAILED 2
 #define PASSED 0
@@ -123,8 +110,7 @@
         printdump = JNI_TRUE;
     }
 
-    if ((res = JNI_ENV_PTR(vm)->GetEnv(JNI_ENV_ARG(vm, (void **) &jvmti),
-            JVMTI_VERSION_1_1)) != JNI_OK) {
+    if ((res = vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1)) != JNI_OK) {
         printf("%s: Failed to call GetEnv: error=%d\n", __FILE__, res);
         return JNI_ERR;
     }
@@ -197,11 +183,8 @@
 
 /* filling the structure jvmtiClassDefinition */
     classDef.klass = redefCls;
-    classDef.class_byte_count =
-        JNI_ENV_PTR(env)->GetArrayLength(JNI_ENV_ARG(env, classBytes));
-    classDef.class_bytes = (unsigned char *)
-        JNI_ENV_PTR(env)->GetByteArrayElements(JNI_ENV_ARG(env, classBytes),
-            NULL);
+    classDef.class_byte_count = env->GetArrayLength(classBytes);
+    classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL);
 
     if (fl == 2) {
         printf(">>>>>>>> Invoke RedefineClasses():\n");
@@ -226,6 +209,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -227,6 +225,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,27 +27,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -92,7 +72,7 @@
 
    debug_printf("VMStart event done\n");
 
-   res = JVMTI_ENV_PTR(jvmti)->AddToBootstrapClassLoaderSearch(JVMTI_ENV_ARG(jvmti, segment));
+   res = jvmti->AddToBootstrapClassLoaderSearch(segment);
    JVMTI_ERROR_CHECK_EXPECTED_ERROR_VOID("VMStart: AddToBootstrapClassLoaderSearch returned error ",
       res, JVMTI_ERROR_WRONG_PHASE);
 }
@@ -106,7 +86,7 @@
 
    debug_printf("VMDeath event done\n");
 
-   res = JVMTI_ENV_PTR(jvmti)->AddToBootstrapClassLoaderSearch(JVMTI_ENV_ARG(jvmti, segment));
+   res = jvmti->AddToBootstrapClassLoaderSearch(segment);
    /* In the live phase, anything other than an existing JAR file is an invalid path.
       So, check that JVMTI_ERROR_ILLEGAL_ARGUMENT error is thrown.
    */
@@ -122,7 +102,7 @@
 
     debug_printf("VMInit event  done\n");
 
-    res = JVMTI_ENV_PTR(jvmti)->AddToBootstrapClassLoaderSearch(JVMTI_ENV_ARG(jvmti, segment));
+    res = jvmti->AddToBootstrapClassLoaderSearch(segment);
     /* In the live phase, anything other than an existing JAR file is an invalid path.
        So, check that JVMTI_ERROR_ILLEGAL_ARGUMENT error is thrown.
     */
@@ -140,13 +120,13 @@
    jvmtiPhase phase;
    jvmtiError res;
 
-   res = JVMTI_ENV_PTR(jvmti)->GetPhase(JVMTI_ENV_ARG(jvmti, &phase));
+   res = jvmti->GetPhase(&phase);
    JVMTI_ERROR_CHECK_VOID("GetPhase returned error", res);
 
    if (phase == JVMTI_PHASE_PRIMORDIAL) {
       debug_printf("Primordial phase\n");
 
-      res = JVMTI_ENV_PTR(jvmti)->AddToBootstrapClassLoaderSearch(JVMTI_ENV_ARG(jvmti, segment));
+      res = jvmti->AddToBootstrapClassLoaderSearch(segment);
       JVMTI_ERROR_CHECK_EXPECTED_ERROR_VOID("Primordial: AddToBootstrapClassLoaderSearch returned error ",
          res, JVMTI_ERROR_WRONG_PHASE);
    }
@@ -215,44 +195,43 @@
         if (idx != NULL) *idx = 0;
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
     }
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetAddCapabilities returned error", res);
 
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_START,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_START returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_NATIVE_METHOD_BIND,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for NATIVE_METHOD_BIND returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_DEATH,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_DEATH returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode CLASS_FILE_LOAD_HOOK returned error", res);
 
     strcat(segment, "/newclass");
     debug_printf("segment=%s\n", segment);
-    res = JVMTI_ENV_PTR(jvmti)->AddToBootstrapClassLoaderSearch(JVMTI_ENV_ARG(jvmti, segment));
+    res = jvmti->AddToBootstrapClassLoaderSearch(segment);
     JVMTI_ERROR_CHECK("AddToBootStrapClassLoaderSearch returned error", res);
 
     return JNI_OK;
@@ -269,6 +248,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,27 +26,8 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf(" %d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -80,7 +61,7 @@
 void JNICALL vmInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) {
     jvmtiError res;
     debug_printf("VMInit event received\n");
-    res = JVMTI_ENV_PTR(jvmti_env)->DisposeEnvironment(JVMTI_ENV_ARG1(jvmti_env));
+    res = jvmti_env->DisposeEnvironment();
     JVMTI_ERROR_CHECK_VOID("DisposeEnvironment returned error", res);
 }
 
@@ -115,8 +96,7 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -124,34 +104,33 @@
 
     /* Enable event call backs. */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetAddCapabilities returned error", res);
 
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->GetSystemProperties(JVMTI_ENV_ARG(jvmti, &count), &properties);
+    res = jvmti->GetSystemProperties(&count, &properties);
 
     JVMTI_ERROR_CHECK("GetSystemProperties returned error", res);
 
     for (i=0; i< count; i++) {
         char *value;
 
-        res = JVMTI_ENV_PTR(jvmti)->GetSystemProperty(JVMTI_ENV_ARG(jvmti, (const char *)properties[i]), &value);
+        res = jvmti->GetSystemProperty((const char *) properties[i], &value);
         JVMTI_ERROR_CHECK("GetSystemProperty returned error", res);
         debug_printf(" %s    %s \n", properties[i], value);
 
-        res = JVMTI_ENV_PTR(jvmti)->SetSystemProperty(JVMTI_ENV_ARG(jvmti, (const char *)properties[i]), value);
+        res = jvmti->SetSystemProperty((const char *) properties[i], value);
         debug_printf("SetSystemProperty returned error %d\n", res);
-
      }
 
     return JNI_OK;
@@ -164,6 +143,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,27 +26,8 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_VOID(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); iGlobalStatus = 2; }
@@ -130,40 +111,39 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         debug_printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
     }
 
     /* Create data access lock */
-    res = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti,"_access_lock"),&access_lock);
+    res = jvmti->CreateRawMonitor("_access_lock", &access_lock);
     JVMTI_ERROR_CHECK("RawMonitorEnter in monitor_contended_entered failed with error code ", res);
 
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_DEATH,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_GARBAGE_COLLECTION_START,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for gc start returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_GARBAGE_COLLECTION_FINISH,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for gc finish returned error", res);
 
     return JNI_OK;
@@ -199,7 +179,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti Force gc requested \n");
-    ret = JVMTI_ENV_PTR(jvmti)->ForceGarbageCollection(JVMTI_ENV_ARG1(jvmti));
+    ret = jvmti->ForceGarbageCollection();
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: ForceGarbageCollection %d \n", ret);
@@ -207,6 +187,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,27 +26,8 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -99,8 +80,7 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         debug_printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -108,26 +88,26 @@
 
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetAddCapabilities returned error", res);
 
 
-    res = JVMTI_ENV_PTR(jvmti)->GetSystemProperties(JVMTI_ENV_ARG(jvmti, &count), &properties);
+    res = jvmti->GetSystemProperties(&count, &properties);
 
     JVMTI_ERROR_CHECK("GetSystemProperties returned error", res);
 
     for (i=0; i< count; i++) {
         char *value;
 
-        res = JVMTI_ENV_PTR(jvmti)->GetSystemProperty(JVMTI_ENV_ARG(jvmti, (const char *)properties[i]), &value);
+        res = jvmti->GetSystemProperty((const char *) properties[i], &value);
         JVMTI_ERROR_CHECK("GetSystemProperty returned error", res);
         debug_printf(" %s    %s \n", properties[i], value);
 
         /* Only writeable properties returns JVMTI_ERROR_NONE. */
-        res = JVMTI_ENV_PTR(jvmti)->SetSystemProperty(JVMTI_ENV_ARG(jvmti, (const char *)properties[i]), value);
+        res = jvmti->SetSystemProperty((const char *) properties[i], value);
         debug_printf("SetSystemProperty returned error %d\n", res);
 
      }
@@ -142,6 +122,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,27 +26,8 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -134,8 +115,7 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         debug_printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -143,21 +123,21 @@
 
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_DEATH,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res);
 
     return JNI_OK;
@@ -179,7 +159,7 @@
   debug_printf(" jvmti GetMonitorInfo \n");
 
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetOwnedMonitorInfo(JVMTI_ENV_ARG(jvmti, thr), &count , &owned_monitor);
+    ret = jvmti->GetOwnedMonitorInfo(thr, &count, &owned_monitor);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetMonitorInfo %d \n", ret);
         iGlobalStatus = 2;
@@ -190,9 +170,9 @@
         iGlobalStatus = 2;
     }
 
-    if (expected_count !=0 ) {
+    if (expected_count !=0) {
 
-        ret = JVMTI_ENV_PTR(jvmti)->GetCurrentContendedMonitor(JVMTI_ENV_ARG(jvmti, thr), owned_monitor);
+        ret = jvmti->GetCurrentContendedMonitor(thr, owned_monitor);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetContendedMonitorInfo %d \n", ret);
             iGlobalStatus = 2;
@@ -201,6 +181,4 @@
 
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,27 +26,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -134,8 +114,7 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         debug_printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -143,21 +122,21 @@
 
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_DEATH,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res);
 
     return JNI_OK;
@@ -177,7 +156,7 @@
 
     sprintf(sz, "Rawmonitor-%d",i);
     debug_printf("jvmti create raw monitor \n");
-    ret = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti, sz), &jraw_monitor[i]);
+    ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: ForceGarbageCollection %d \n", ret);
@@ -190,7 +169,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti Raw monitor enter \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorEnter(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Raw monitor enter %d \n", ret);
@@ -203,7 +182,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti raw monitor exit \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorExit(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorExit %d \n", ret);
@@ -216,7 +195,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti RawMonitorWait \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorWait(JVMTI_ENV_ARG(jvmti,jraw_monitor[i]),-1);
+    ret = jvmti->RawMonitorWait(jraw_monitor[i], -1);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorWait %d \n", ret);
@@ -229,7 +208,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti RawMonitorNotify \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorNotifyAll(JVMTI_ENV_ARG(jvmti,jraw_monitor[i]));
+    ret = jvmti->RawMonitorNotifyAll(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorNotify %d \n", ret);
@@ -243,7 +222,7 @@
     jint count;
 
     debug_printf("jvmti GetFrameCount \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetFrameCount(JVMTI_ENV_ARG(jvmti, (jthread)thr),  &count);
+    ret = jvmti->GetFrameCount((jthread) thr,  &count);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetFrameCount returned  %d \n", ret);
         iGlobalStatus = 2;
@@ -266,14 +245,14 @@
 
     debug_printf("jvmti GetStackTrace \n");
 
-    ret = JVMTI_ENV_PTR(jvmti)->Allocate(JVMTI_ENV_ARG(jvmti, sizeof(jvmtiFrameInfo) * count), (unsigned char**)&stack_buffer);
+    ret = jvmti->Allocate(sizeof(jvmtiFrameInfo) * count, (unsigned char**)&stack_buffer);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Allocate failed with  %d \n", ret);
         iGlobalStatus = 2;
     }
 
 
-    ret = JVMTI_ENV_PTR(jvmti)->GetStackTrace(JVMTI_ENV_ARG(jvmti, thr), 0, count , stack_buffer, &count);
+    ret = jvmti->GetStackTrace(thr, 0, count, stack_buffer, &count);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: GetStackTrace %d \n", ret);
@@ -283,21 +262,21 @@
     debug_printf(" Java Stack trace ---\n");
 
     for (i = 0; i < count; i++) {
-        ret = JVMTI_ENV_PTR(jvmti)->GetMethodDeclaringClass(JVMTI_ENV_ARG(jvmti, stack_buffer[i].method), &klass);
+        ret = jvmti->GetMethodDeclaringClass(stack_buffer[i].method, &klass);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetMethodDeclaringClass %d  \n", ret);
             iGlobalStatus = 2;
             return;
         }
 
-        ret = JVMTI_ENV_PTR(jvmti)->GetClassSignature(JVMTI_ENV_ARG(jvmti, klass), &clname, &generic);
+        ret = jvmti->GetClassSignature(klass, &clname, &generic);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetMethodDeclaringClass %d  \n", ret);
             iGlobalStatus = 2;
             return;
         }
 
-        ret = JVMTI_ENV_PTR(jvmti)->GetMethodName(JVMTI_ENV_ARG(jvmti, stack_buffer[i].method), &mname, &signature, &generic);
+        ret = jvmti->GetMethodName(stack_buffer[i].method, &mname, &signature, &generic);
         if (ret != JVMTI_ERROR_NONE) {
             printf("Error: GetMethodDeclaringClass %d  \n", ret);
             iGlobalStatus = 2;
@@ -310,7 +289,7 @@
     }
 
 
-    ret = JVMTI_ENV_PTR(jvmti)->Deallocate(JVMTI_ENV_ARG(jvmti, (unsigned char *)stack_buffer));
+    ret = jvmti->Deallocate((unsigned char *) stack_buffer);
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: Deallocate failed with  %d \n", ret);
         iGlobalStatus = 2;
@@ -324,6 +303,4 @@
 
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -48,27 +48,8 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf(" %d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf(" unexpected error %d\n",res); return res;}
@@ -108,9 +89,9 @@
 
 void JNICALL vmStart(jvmtiEnv *jvmti_env, JNIEnv *env) {
     jvmtiError res;
-    res = JVMTI_ENV_PTR(jvmti)->GetCurrentThread(JVMTI_ENV_ARG(jvmti_env, &main_thread));
+    res = jvmti_env->GetCurrentThread(&main_thread);
     JVMTI_ERROR_CHECK_VOID(" JVMTI GetCurrentThread returned error", res);
-    main_thread = (jthread)JNI_ENV_PTR(env)->NewGlobalRef(JNI_ENV_ARG(env, main_thread));
+    main_thread = (jthread)env->NewGlobalRef(main_thread);
 }
 
 void JNICALL vmInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) {
@@ -118,9 +99,9 @@
     jvmtiError res;
 
     debug_printf("VMInit event  done\n");
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti_env, access_lock));
+    res = jvmti_env->RawMonitorExit(access_lock);
     JVMTI_ERROR_CHECK_VOID(" Raw monitor exit returned error", res);
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti_env, access_lock));
+    res = jvmti_env->RawMonitorExit(access_lock);
     JVMTI_ERROR_CHECK_VOID(" Raw monitor exit returned error", res);
 }
 
@@ -140,17 +121,15 @@
     jvmtiError res;
     jvmtiPhase phase;
     jthread    thread;
-    jboolean   is_main;
 
-    res = JVMTI_ENV_PTR(jvmti)->GetPhase(JVMTI_ENV_ARG(jvmti_env, &phase));
+    res = jvmti_env->GetPhase(&phase);
     JVMTI_ERROR_CHECK_VOID(" JVMTI GetPhase returned error", res);
     if (phase != JVMTI_PHASE_START) {
         return; /* only the start phase is tested */
     }
-    res = JVMTI_ENV_PTR(jvmti)->GetCurrentThread(JVMTI_ENV_ARG(jvmti_env, &thread));
+    res = jvmti_env->GetCurrentThread(&thread);
     JVMTI_ERROR_CHECK_VOID(" JVMTI GetCurrentThread returned error", res);
-    is_main = JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, thread), main_thread);
-    if (is_main == JNI_FALSE) {
+    if (!env->IsSameObject(thread, main_thread)) {
         return; /* only the main thread is tested */
     }
 
@@ -163,21 +142,21 @@
         process_once = 0;
 
             /* test not entered raw monitor */
-        res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti_env, access_lock_not_entered));
+        res = jvmti_env->RawMonitorExit(access_lock_not_entered);
         JVMTI_ERROR_CHECK_EXPECTED_ERROR_VOID("Raw monitor exit returned error", res,JVMTI_ERROR_NOT_MONITOR_OWNER);
 
             /* release lock in start phase */
-        res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti_env, access_lock));
+        res = jvmti_env->RawMonitorExit(access_lock);
         JVMTI_ERROR_CHECK_VOID("Raw monitor exit returned error", res);
 
             /* release lock in start phase */
-        res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti_env, access_lock));
+        res = jvmti_env->RawMonitorExit(access_lock);
         JVMTI_ERROR_CHECK_VOID("Raw monitor exit returned error", res);
 
-        res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+        res = jvmti_env->RawMonitorEnter(access_lock);
         JVMTI_ERROR_CHECK_VOID("Raw monitor enter returned error", res);
 
-        res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+        res = jvmti_env->RawMonitorEnter(access_lock);
         JVMTI_ERROR_CHECK_VOID("Raw monitor enter returned error", res);
     }
 
@@ -214,88 +193,87 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         debug_printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
     }
 
     /* Onload phase Create data access lock */
-    res = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti,"_access_lock"),&access_lock);
+    res = jvmti->CreateRawMonitor("_access_lock", &access_lock);
     JVMTI_ERROR_CHECK("CreateRawMonitor failed with error code ", res);
-    res = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti,"_access_lock_not_entered"),&access_lock_not_entered);
+    res = jvmti->CreateRawMonitor("_access_lock_not_entered", &access_lock_not_entered);
     JVMTI_ERROR_CHECK("CreateRawMonitor failed with error code ", res);
     /* Create this raw monitor in onload and it is used in live phase */
-    res = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti,"RawMonitor-0"),&jraw_monitor[0]);
+    res = jvmti->CreateRawMonitor("RawMonitor-0", &jraw_monitor[0]);
     JVMTI_ERROR_CHECK("CreateRawMonitor failed with error code ", res);
 
 
     /* Add capabilities */
-    res = JVMTI_ENV_PTR(jvmti)->GetPotentialCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->GetPotentialCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->AddCapabilities(JVMTI_ENV_ARG(jvmti, &jvmti_caps));
+    res = jvmti->AddCapabilities(&jvmti_caps);
     JVMTI_ERROR_CHECK("GetPotentialCapabilities returned error", res);
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_VM_DEATH,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti,JVMTI_ENABLE),JVMTI_EVENT_CLASS_FILE_LOAD_HOOK,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode CLASS_FILE_LOAD_HOOK returned error", res);
 
      /* acquire lock in onload */
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->RawMonitorEnter(access_lock);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
 
     /* release lock in onload */
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->RawMonitorExit(access_lock);
     JVMTI_ERROR_CHECK("Raw monitor exit returned error", res);
 
     /* test not entered raw monitor */
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti ,access_lock_not_entered));
+    res = jvmti->RawMonitorExit(access_lock_not_entered);
     JVMTI_ERROR_CHECK_EXPECTED_ERROR("Raw monitor exit returned error", res,JVMTI_ERROR_NOT_MONITOR_OWNER);
 
     /* acquire lock in onload */
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->RawMonitorEnter(access_lock);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->RawMonitorEnter(access_lock);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->RawMonitorEnter(access_lock);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
 
     /* test Destroy raw monitor in onload phase */
-    res = JVMTI_ENV_PTR(jvmti)->DestroyRawMonitor(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->DestroyRawMonitor(access_lock);
     JVMTI_ERROR_CHECK("Destroy Raw monitor returned error", res);
 
     /* Create data access lock  in onload and enter in onload phase */
-    res = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti,"_access_lock"),&access_lock);
+    res = jvmti->CreateRawMonitor("_access_lock", &access_lock);
     JVMTI_ERROR_CHECK("CreateRawMonitor failed with error code ", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->RawMonitorEnter(access_lock);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, access_lock));
+    res = jvmti->RawMonitorEnter(access_lock);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
 
 
     /* This monitor is entered here and it is released in live phase by a call from java code
      */
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, jraw_monitor[0]));
+    res = jvmti->RawMonitorEnter(jraw_monitor[0]);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, jraw_monitor[0]));
+    res = jvmti->RawMonitorEnter(jraw_monitor[0]);
     JVMTI_ERROR_CHECK("Raw monitor enter returned error", res);
-    res = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti, jraw_monitor[0]));
+    res = jvmti->RawMonitorExit(jraw_monitor[0]);
     JVMTI_ERROR_CHECK("Raw monitor exit returned error", res);
 
     return JNI_OK;
@@ -315,7 +293,7 @@
 
     sprintf(sz, "Rawmonitor-%d",i);
     debug_printf("jvmti create raw monitor \n");
-    ret = JVMTI_ENV_PTR(jvmti)->CreateRawMonitor(JVMTI_ENV_ARG(jvmti, sz), &jraw_monitor[i]);
+    ret = jvmti->CreateRawMonitor(sz, &jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: CreateRawMonitor %d \n", ret);
@@ -328,7 +306,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti Raw monitor enter \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorEnter(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorEnter(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorEnter %d \n", ret);
@@ -341,7 +319,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti raw monitor exit \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorExit(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]));
+    ret = jvmti->RawMonitorExit(jraw_monitor[i]);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorExit %d \n", ret);
@@ -354,7 +332,7 @@
     jvmtiError ret;
 
     debug_printf("jvmti RawMonitorWait \n");
-    ret = JVMTI_ENV_PTR(jvmti)->RawMonitorWait(JVMTI_ENV_ARG(jvmti, jraw_monitor[i]), -1);
+    ret = jvmti->RawMonitorWait(jraw_monitor[i], -1);
 
     if (ret != JVMTI_ERROR_NONE) {
         printf("Error: RawMonitorWait %d \n", ret);
@@ -362,6 +340,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,21 +29,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -275,8 +262,7 @@
     printdump = JNI_TRUE;
   }
 
-  res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-                                 JVMTI_VERSION_1_1);
+  res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
   if (res != JNI_OK || jvmti == NULL) {
     printf("Wrong result of a valid call to GetEnv!\n");
     return JNI_ERR;
@@ -487,6 +473,4 @@
   return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,21 +29,8 @@
 #include "agent_common.h"
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
 
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
 
 #define PASSED 0
 #define STATUS_FAILED 2
@@ -273,8 +260,7 @@
     printdump = JNI_TRUE;
   }
 
-  res = JNI_ENV_PTR(jvm)->GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti),
-                                 JVMTI_VERSION_1_1);
+  res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
   if (res != JNI_OK || jvmti == NULL) {
     printf("Wrong result of a valid call to GetEnv!\n");
     return JNI_ERR;
@@ -485,6 +471,4 @@
   return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -36,27 +36,7 @@
 #include "jni_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_ARG(x, y) y
-#define JNI_ENV_ARG1(x)
-#define JNI_ENV_PTR(x) x
-#else
-#define JNI_ENV_ARG(x,y) x, y
-#define JNI_ENV_ARG1(x) x
-#define JNI_ENV_PTR(x) (*x)
-#endif
-
-#endif
-
-#define JVMTI_ENV_ARG JNI_ENV_ARG
-#define JVMTI_ENV_ARG1 JNI_ENV_ARG1
-#define JVMTI_ENV_PTR JNI_ENV_PTR
 
 #define JVMTI_ERROR_CHECK(str,res) if ( res != JVMTI_ERROR_NONE) { printf(str); printf("%d\n",res); return res;}
 #define JVMTI_ERROR_CHECK_EXPECTED_ERROR(str,res,err) if ( res != err) { printf(str); printf("unexpected error %d\n",res); return res;}
@@ -86,7 +66,7 @@
 intptr_t get_env_local() {
   jvmtiError res;
   void *val;
-  res = JVMTI_ENV_PTR(jvmti)->GetEnvironmentLocalStorage(JVMTI_ENV_ARG(jvmti, &val));
+  res = jvmti->GetEnvironmentLocalStorage(&val);
   JVMTI_ERROR_CHECK("GetEnvironmentLocalStorage returned error", res);
   return (intptr_t)val;
 }
@@ -94,14 +74,14 @@
 void set_env_local(intptr_t x) {
   jvmtiError res;
   void *val = (void*)x;
-  res = JVMTI_ENV_PTR(jvmti)->SetEnvironmentLocalStorage(JVMTI_ENV_ARG(jvmti, val));
+  res = jvmti->SetEnvironmentLocalStorage(val);
   JVMTI_ERROR_CHECK_VOID("SetEnvironmentLocalStorage returned error", res);
 }
 
 intptr_t get_thread_local(jthread thread) {
   jvmtiError res;
   void *val;
-  res = JVMTI_ENV_PTR(jvmti)->GetThreadLocalStorage(JVMTI_ENV_ARG(jvmti, thread), &val);
+  res = jvmti->GetThreadLocalStorage(thread, &val);
   JVMTI_ERROR_CHECK("GetThreadLocalStorage returned error", res);
   return (intptr_t)val;
 }
@@ -109,7 +89,7 @@
 void set_thread_local(jthread thread, intptr_t x) {
   jvmtiError res;
   void *val = (void*)x;
-  res = JVMTI_ENV_PTR(jvmti)->SetThreadLocalStorage(JVMTI_ENV_ARG(jvmti, thread), val);
+  res = jvmti->SetThreadLocalStorage(thread, val);
   JVMTI_ERROR_CHECK_VOID("SetThreadLocalStorage returned error", res);
 }
 
@@ -164,8 +144,7 @@
         }
     }
 
-    res = JNI_ENV_PTR(jvm)->
-        GetEnv(JNI_ENV_ARG(jvm, (void **) &jvmti), JVMTI_VERSION_1_1);
+    res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1);
     if (res < 0) {
         printf("Wrong result of a valid call to GetEnv!\n");
         return JNI_ERR;
@@ -179,10 +158,10 @@
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti, JVMTI_ENABLE), JVMTI_EVENT_VM_INIT,NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT,NULL);
     JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res);
 
     return JNI_OK;
@@ -201,6 +180,4 @@
   return iGlobalStatus;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -39,24 +39,7 @@
 
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
-
-#ifndef JNI_ENV_ARG
-
-#ifdef __cplusplus
-#define JNI_ENV_PTR(x) x
-#define JNI_ENV_ARG(x, y) y
-#else
-#define JNI_ENV_PTR(x) (*x)
-#define JNI_ENV_ARG(x, y) x, y
-#endif
-
-#endif
-
-#define JVMTI_ENV_PTR JNI_ENV_PTR
-#define JVMTI_ENV_ARG JNI_ENV_ARG
 
 #define JVMTI_ERROR_CHECK_DURING_ONLOAD(str,res) if ( res != JVMTI_ERROR_NONE) { printf("Fatal error: %s - %d\n", str, res); return JNI_ERR; }
 
@@ -102,7 +85,7 @@
     debug_printf("VMInit event\n");
 
     debug_printf("jvmti GetTime \n");
-    err = JVMTI_ENV_PTR(jvmti_env)->GetTime(JVMTI_ENV_ARG(jvmti_env, &initial_time));
+    err = jvmti_env->GetTime(&initial_time);
     JVMTI_ERROR_CHECK("GetTime", err);
     debug_printf("  Initial time: %s ns\n",
         jlong_to_string(initial_time, buffer));
@@ -157,13 +140,13 @@
 
     /* Enable events */
     init_callbacks();
-    res = JVMTI_ENV_PTR(jvmti)->SetEventCallbacks(JVMTI_ENV_ARG(jvmti_env, &callbacks), sizeof(callbacks));
+    res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks));
     JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventCallbacks returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti_env, JVMTI_ENABLE), JVMTI_EVENT_VM_INIT, NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL);
     JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventNotificationMode for VM_INIT returned error", res);
 
-    res = JVMTI_ENV_PTR(jvmti)->SetEventNotificationMode(JVMTI_ENV_ARG(jvmti_env, JVMTI_ENABLE), JVMTI_EVENT_VM_DEATH, NULL);
+    res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL);
     JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventNotificationMode for vm death event returned error", res);
 
     return JNI_OK;
@@ -184,12 +167,12 @@
     jlong curr;
 
     debug_printf("jvmti GetCurrentThreadCpuTime \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetCurrentThreadCpuTime(JVMTI_ENV_ARG(jvmti_env, &curr));
+    ret = jvmti->GetCurrentThreadCpuTime(&curr);
     JVMTI_ERROR_CHECK_RETURN("GetCurrentThreadCpuTime", ret);
 
     thread_info[threadNumber].iterationCount = iterationCount;
     thread_info[threadNumber].currThreadTime = curr;
-    thread_info[threadNumber].ref = JNI_ENV_PTR(env)->NewWeakGlobalRef(JNI_ENV_ARG(env, thread));
+    thread_info[threadNumber].ref = env->NewWeakGlobalRef(thread);
 }
 
 static void print_timerinfo(jvmtiTimerInfo* timerInfo) {
@@ -237,34 +220,34 @@
     char buffer[32];
 
     debug_printf("jvmti GetTime \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetTime(JVMTI_ENV_ARG(jvmti_env, &now));
+    ret = jvmti->GetTime(&now);
     JVMTI_ERROR_CHECK_RETURN("GetTime", ret);
     etime = now - initial_time;
     debug_printf("  Elapsed time: %s ms\n",
         jlong_to_string(milli(etime), buffer));
 
     debug_printf("jvmti GetCurrentThreadCpuTimerInfo \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetCurrentThreadCpuTimerInfo(JVMTI_ENV_ARG(jvmti_env, &timerInfoCurr));
+    ret = jvmti->GetCurrentThreadCpuTimerInfo(&timerInfoCurr);
     JVMTI_ERROR_CHECK_RETURN("GetCurrentThreadCpuTimerInfo", ret);
     print_timerinfo(&timerInfoCurr);
 
     debug_printf("jvmti GetThreadCpuTimerInfo \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetThreadCpuTimerInfo(JVMTI_ENV_ARG(jvmti_env, &timerInfoOther));
+    ret = jvmti->GetThreadCpuTimerInfo(&timerInfoOther);
     JVMTI_ERROR_CHECK_RETURN("GetThreadCpuTimerInfo", ret);
     print_timerinfo(&timerInfoOther);
 
     debug_printf("jvmti GetTimerInfo \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetTimerInfo(JVMTI_ENV_ARG(jvmti_env, &timerInfoTime));
+    ret = jvmti->GetTimerInfo(&timerInfoTime);
     JVMTI_ERROR_CHECK_RETURN("GetTimerInfo", ret);
     print_timerinfo(&timerInfoTime);
 
     debug_printf("jvmti GetAvailableProcessors \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetAvailableProcessors(JVMTI_ENV_ARG(jvmti_env, &processor_count));
+    ret = jvmti->GetAvailableProcessors(&processor_count);
     JVMTI_ERROR_CHECK_RETURN("GetAvailableProcessors", ret);
     debug_printf("  processor_count = %d\n", processor_count);
 
     debug_printf("jvmti GetAllThreads \n");
-    ret = JVMTI_ENV_PTR(jvmti)->GetAllThreads(JVMTI_ENV_ARG(jvmti_env, &thrCnt), &thrArray);
+    ret = jvmti->GetAllThreads(&thrCnt, &thrArray);
     JVMTI_ERROR_CHECK_RETURN("GetAllThreads", ret);
 
     for (k = 0; k < thrCnt; ++k) {
@@ -272,13 +255,13 @@
       jthread thread;
 
       thread = thrArray[k];
-      ret = JVMTI_ENV_PTR(jvmti)->GetThreadCpuTime(JVMTI_ENV_ARG(jvmti_env, thread), &oth);
+      ret = jvmti->GetThreadCpuTime(thread, &oth);
       JVMTI_ERROR_CHECK_RETURN("GetThreadCpuTime", ret);
 
       for (i = 1; i < THREADS_LIMIT; ++i) {
         jweak tref = thread_info[i].ref;
         if (tref != 0) {
-          if (JNI_ENV_PTR(env)->IsSameObject(JNI_ENV_ARG(env, thread), tref)) {
+          if (env->IsSameObject(thread, tref)) {
             thread_info[i].threadTime = oth;
             break;
           }
@@ -287,7 +270,7 @@
       if (i == THREADS_LIMIT) {
         jvmtiThreadInfo info;
         info.name = (char*) "*retrieval error*";
-        ret = JVMTI_ENV_PTR(jvmti)->GetThreadInfo(JVMTI_ENV_ARG(jvmti_env, thread), &info);
+        ret = jvmti->GetThreadInfo(thread, &info);
         JVMTI_ERROR_CHECK("GetThreadInfo %d \n", ret);
 
         debug_printf("non-test thread: %s - %s ms\n", info.name,
@@ -380,6 +363,4 @@
 }
 
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <stdio.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define GET_OBJECT_CLASS(_class, _obj)\
     if (!NSK_JNI_VERIFY(env, (_class = \
@@ -93,6 +91,4 @@
     return 0;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include <stdio.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FIND_CLASS(_class, _className)\
     if (!NSK_JNI_VERIFY(env, (_class = \
@@ -526,6 +524,4 @@
         return threadState;
     }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -23,9 +23,7 @@
 #include <jni.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FIND_CLASS(_class, _className)\
         if (!NSK_JNI_VERIFY(env, (_class = \
@@ -107,6 +105,4 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -23,9 +23,7 @@
 #include <jni.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FIND_CLASS(_class, _className)\
         if (!NSK_JNI_VERIFY(env, (_class = \
@@ -85,6 +83,4 @@
                 env->ThrowNew(testBugClass, "MonitorEnter(lock4) call failed");
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <stdio.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define FIND_CLASS(_class, _className)\
     if (!NSK_JNI_VERIFY(env, (_class = \
@@ -176,7 +174,5 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libNativeBlockedThread.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/libNativeBlockedThread.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -23,9 +23,7 @@
 
 #include <jni.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Class:     nsk_monitoring_share_thread_NativeBlockedThread
@@ -40,6 +38,4 @@
         env->MonitorExit(lock);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMDITools.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMDITools.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include "jvmdi.h"
 #include "JVMDITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 char const *TranslateEvent(jint kind) {
     switch (kind) {
@@ -168,6 +166,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMDITools.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMDITools.h	Tue Sep 18 16:41:24 2018 -0700
@@ -21,13 +21,9 @@
  * questions.
  */
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 char const *TranslateEvent(jint kind);
 char const *TranslateError(jvmdiError err);
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -39,9 +39,7 @@
 #include "JVMTITools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jvmtiEnv *jvmti = NULL; /* JVMTI env */
 static jvmtiEventCallbacks callbacks;
@@ -1271,6 +1269,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include <nsk_tools.h>
 #include <aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static volatile int internalError = 0;
 
@@ -283,6 +281,4 @@
     return jni;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include <jni_tools.h>
 #include <nsk_tools.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * This function can be used to inform AOD framework that some non-critical for test logic
@@ -76,8 +74,6 @@
 
 JNIEnv* nsk_aod_createJNIEnv(JavaVM* vm);
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif /* END OF NSK_SHARE_AOD_H */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java	Tue Sep 18 16:41:24 2018 -0700
@@ -119,8 +119,6 @@
                         return bytecode;
                 } catch (UnsupportedEncodingException e) {
                         throw new TestBug(e);
-                } catch (IOException e) {
-                        throw new TestBug(e);
                 }
         }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -82,6 +80,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -83,6 +81,4 @@
         return hash;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -73,6 +71,4 @@
         env->SetObjectField(o, objFieldId, obj);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -73,6 +71,4 @@
         env->SetObjectField(o, objFieldId, obj);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -77,6 +75,4 @@
         env->SetObjectField(o, objFieldId, obj);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <time.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jfieldID objFieldId = NULL;
 
@@ -73,6 +71,4 @@
         env->SetObjectField(o, objFieldId, obj);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <stdlib.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jvmtiEnv *jvmti = NULL;
 static jvmtiCapabilities caps;
@@ -67,6 +65,4 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/malloc/MallocLocker.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/malloc/MallocLocker.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <stdlib.h>
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Class:     nsk_share_gc_lock_malloc_MallocLocker
@@ -50,6 +48,4 @@
         }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -45,9 +45,7 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*************************************************************/
 
@@ -199,6 +197,4 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h	Tue Sep 18 16:41:24 2018 -0700
@@ -94,9 +94,7 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*************************************************************/
 
@@ -165,9 +163,7 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 }
-#endif
 
 /*************************************************************/
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -243,6 +241,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jvmti_tools.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -243,6 +241,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -105,9 +105,7 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
     static u1 get_u1() {
         return *inputPos++;
@@ -1202,6 +1200,4 @@
 
     /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.h	Tue Sep 18 16:41:24 2018 -0700
@@ -279,9 +279,7 @@
     BCI_MODE_ALLOC  = 2
 };
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /**
  * Class file transformer. Transforms a classfile image from old_bytes
@@ -305,8 +303,6 @@
 int Inject(const u1* old_bytes, const jint old_length,
     u1** new_bytes, jint* new_length, int bci_mode);
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif /* _NSK_SHARE_JVMTI_INJECTOR_H_ */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <string.h>
 #include "JVMTITools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 const char* TranslateState(jint flags) {
     static char str[15 * 20];
@@ -326,6 +324,4 @@
     }
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 
 #include "jvmti.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /**
  * Return string representation of given JVMTI event constant.
@@ -60,8 +58,6 @@
  */
 const char* TranslateObjectRefKind(jvmtiObjectReferenceKind ref);
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif /* _NSK_SHARE_JVMTI_JVMTITOOLS_H_ */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -23,9 +23,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
         return Agent_Initialize(jvm, options, reserved);
@@ -35,6 +33,4 @@
         return Agent_Initialize(jvm, options, reserved);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include "jvmti.h"
 #include "../jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved);
 
@@ -36,8 +34,6 @@
 
 jint Agent_Initialize(JavaVM *vm, char *options, void *reserved);
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include "jni_tools.h"
 #include "jvmti_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -810,6 +808,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdlib.h>
 #include <jvmti_aod.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 void nsk_jvmti_aod_disableEventAndFinish(const char* agentName, jvmtiEvent event, int success, jvmtiEnv *jvmti, JNIEnv* jni) {
     if (!nsk_jvmti_aod_disableEvent(jvmti, event))
@@ -347,6 +345,4 @@
     #undef printCap
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.h	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include <jvmti.h>
 #include <jvmti_tools.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define MAX_STRING_LENGTH 1024
 
@@ -90,8 +88,6 @@
 
 void printCapabilities(jvmtiCapabilities caps);
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif /* END OF NSK_SHARE_JVMTI_AOD_H */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 
 #define PASSED 0
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ========================================================================== */
 
@@ -500,6 +498,4 @@
 
 /* ========================================================================== */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jvmti_tools.h"
 #include "jvmti_FollowRefObjects.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -392,6 +390,4 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.h	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 
 #include <jvmti.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /* ============================================================================= */
 
@@ -101,8 +99,6 @@
 
 /* ============================================================================= */
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -40,9 +40,7 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*************************************************************/
 
@@ -679,6 +677,4 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h	Tue Sep 18 16:41:24 2018 -0700
@@ -35,9 +35,7 @@
 #include "JVMTITools.h"
 
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 
 /******************** Diagnostics errors *********************/
@@ -393,8 +391,6 @@
 #endif
 
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -29,9 +29,7 @@
 #include "jvmti.h"
 #include "agent_common.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jvmtiEnv *jvmti;
 static jint dummy_user_data;
@@ -470,6 +468,4 @@
     return 0;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -52,9 +52,7 @@
 
 /***************************************************************/
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /**
  * A mirror to control a thread.
@@ -206,6 +204,4 @@
 
 /***************************************************************/
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.h	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #ifndef NSK_SHARE_NATIVE_NATIVE_THREAD_H
 #define NSK_SHARE_NATIVE_NATIVE_THREAD_H
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /**
  * A thread procedure with a void* argument and returning
@@ -75,8 +73,6 @@
  */
 void THREAD_sleep(int seconds);
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_utils.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_utils.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -34,14 +34,10 @@
 #include <sys/types.h>
 #include <jni.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT jlong
 JNICALL Java_nsk_share_NativeUtils_getCurrentPID(JNIEnv * jni, jobject  jobj) {
         return (jlong) getpid();
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "nsk_list.h"
 #include "nsk_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define NSK_LIST_INIT_COUNT 20
 
@@ -136,8 +134,6 @@
     return NULL;
 }
 
-#ifdef __cplusplus
 }
-#endif
 
 /* ============================================================================= */
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.h	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #ifndef NSK_LIST
 #define NSK_LIST
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /**
  * Prepares array of pointers which has fixed INITIAL_SIZE.
@@ -68,8 +66,6 @@
  */
 int nsk_list_remove(const void *plist, int i);
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdlib.h>
 #include "nsk_mutex.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #ifndef _WIN32
 
@@ -92,6 +90,4 @@
 
 #endif // _WIN32
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.h	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #ifndef NSK_MUTEX_H
 #define NSK_MUTEX_H
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /**
  * Structure to hold mutex data (the content is platform-specific)
@@ -54,8 +52,6 @@
 void MUTEX_destroy(MUTEX* mutex);
 
 
-#ifdef __cplusplus
 }
-#endif
 
 #endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -35,9 +35,7 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*************************************************************/
 
@@ -305,6 +303,4 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h	Tue Sep 18 16:41:24 2018 -0700
@@ -47,27 +47,6 @@
  *
  */
 
-#define NSK_CPP_STUB1(Func,env)  (*env)->Func(env)
-#define NSK_CPP_STUB2(Func,env,a)  (*env)->Func(env,a)
-#define NSK_CPP_STUB3(Func,env,a,b)  (*env)->Func(env,a,b)
-#define NSK_CPP_STUB4(Func,env,a,b,c)  (*env)->Func(env,a,b,c)
-#define NSK_CPP_STUB5(Func,env,a,b,c,d)  (*env)->Func(env,a,b,c,d)
-#define NSK_CPP_STUB6(Func,env,a,b,c,d,e)  (*env)->Func(env,a,b,c,d,e)
-#define NSK_CPP_STUB7(Func,env,a,b,c,d,e,f)  (*env)->Func(env,a,b,c,d,e,f)
-#define NSK_CPP_STUB8(Func,env,a,b,c,d,e,f,g)  (*env)->Func(env,a,b,c,d,e,f,g)
-#define NSK_CPP_STUB9(Func,env,a,b,c,d,e,f,g,h)  (*env)->Func(env,a,b,c,d,e,f,g,h)
-
-#ifdef __cplusplus
-#ifndef NSK_CPP_STUBS_ENFORCE_C
-#undef NSK_CPP_STUB1
-#undef NSK_CPP_STUB2
-#undef NSK_CPP_STUB3
-#undef NSK_CPP_STUB4
-#undef NSK_CPP_STUB5
-#undef NSK_CPP_STUB6
-#undef NSK_CPP_STUB7
-#undef NSK_CPP_STUB8
-#undef NSK_CPP_STUB9
 #define NSK_CPP_STUB1(Func,env)  env->Func()
 #define NSK_CPP_STUB2(Func,env,a)  env->Func(a)
 #define NSK_CPP_STUB3(Func,env,a,b)  env->Func(a,b)
@@ -77,8 +56,6 @@
 #define NSK_CPP_STUB7(Func,env,a,b,c,d,e,f)  env->Func(a,b,c,d,e,f)
 #define NSK_CPP_STUB8(Func,env,a,b,c,d,e,f,g)  env->Func(a,b,c,d,e,f,g)
 #define NSK_CPP_STUB9(Func,env,a,b,c,d,e,f,g,h)  env->Func(a,b,c,d,e,f,g,h)
-#endif
-#endif
 
 /*************************************************************/
 
@@ -123,9 +100,7 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define NSK_TRUE  1
 #define NSK_FALSE 0
@@ -210,9 +185,7 @@
 
 /*************************************************************/
 
-#ifdef __cplusplus
 }
-#endif
 
 /*************************************************************/
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutHandler.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-/*
- * 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
- * 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 nsk.share.test.timeoutwatchdog;
-
-/**
- * TimeoutHandler - interface to define reaction on timeout.
- * @see TimeoutWatchdoc
- */
-public interface TimeoutHandler {
-
-        /**
-         * Invoked when watchdog detects timeout. Subclasses must implement this method to define how timeout should be handled.
-         */
-        void handleTimeout();
-
-}
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/test/timeoutwatchdog/TimeoutWatchdog.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/*
- * 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
- * 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 nsk.share.test.timeoutwatchdog;
-
-import nsk.share.test.ExecutionController;
-
-/**
- * This class watches for ExecutionControler and notifies TimeoutHander in case of timeout.
- */
-public class TimeoutWatchdog implements Runnable {
-
-        private ExecutionController executionController;
-
-        private TimeoutHandler handler;
-
-        private static long CHECK_PERIOD = 1000; // In milliseconds
-
-        private TimeoutWatchdog(ExecutionController executionController, TimeoutHandler handler) {
-                this.executionController = executionController;
-                this.handler = handler;
-        }
-
-        /**
-         * Start watching for timeout.
-         * This method runs a new daemon thread that checks periodically if the observable test is still running.
-         * If timeout is detected <code>handler.handleTimeout()</code> will be called. If the test finishes normally the daemon
-         * thread will silently die.
-         * @param executionController - executionController used to monitor time left
-         * @param handler - handler on which handleTimeout() will be called
-         */
-        public static void watch(ExecutionController executionController, TimeoutHandler handler) {
-                Thread thread = new Thread(new TimeoutWatchdog(executionController, handler));
-                thread.setName("TimeoutWatchdog_thread");
-                thread.setDaemon(true);
-                thread.start();
-        }
-
-        @Override
-        public void run() {
-                try {
-                        while (true) {
-                                Thread.sleep(CHECK_PERIOD);
-                                if (!executionController.continueExecution()) {
-                                        System.out.println("Time expired. TimeoutWatchdog is calling TimeoutHandler.handleTimeout.");
-                                        handler.handleTimeout();
-                                }
-                        }
-                } catch (InterruptedException e) {
-                        throw new RuntimeException("Somebody dared to interrupt TimeoutWatchdog thread.");
-                }
-        }
-
-}
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdlib.h>
 #include "jnihelper.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 // compare most java primitive value types
 #define COMP(type) \
@@ -203,6 +201,4 @@
     BODY(jdouble)
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -28,9 +28,7 @@
 #include <stdlib.h>
 #include "jnihelper.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define DIGESTLENGTH 16
 
@@ -242,6 +240,4 @@
     return(env->NewString(javachars->str[index-1],javachars->size[index-1]));
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress002.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress002.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <stdio.h>
 #include "jnihelper.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 jobject NewObjectWrapper(JNIEnv *env, jclass clazz, jmethodID methodID, ...) {
   va_list ap;
@@ -105,6 +103,4 @@
   return obj;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <stdlib.h>
 #include "jnihelper.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define BOOL  0
 #define BYTE  1
@@ -263,6 +261,4 @@
     return JNI_TRUE;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include <string.h>
 #include "jnihelper.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define DIGESTLENGTH 16
 
@@ -171,6 +169,4 @@
     return ret;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define CHECK_EXCEPTION     { if (env->ExceptionOccurred()) { fprintf(stderr, "Unexpected exception:\n"); env->ExceptionDescribe(); env->ExceptionClear(); exit(97); } }
 
@@ -114,6 +112,4 @@
 /*     printf("JNI: count %d\n", Exceptcalls); */
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 #include <stdlib.h>
 #include "jnihelper.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT jboolean JNICALL
 Java_nsk_stress_jni_JNIter006_refs (JNIEnv *env, jobject jobj, jobject tobj, jint LIMIT) {
@@ -86,6 +84,4 @@
     return res;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress007.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress007.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include <stdio.h>
 #include "jnihelper.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL
 Java_nsk_stress_jni_JNIter007_incCount (JNIEnv *env, jobject jobj, jstring name) {
@@ -47,6 +45,4 @@
     printf("in %s Count after %u\n", str, value);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace003";
 static const char *Slongparam="(J)V";
@@ -89,6 +87,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace004";
 static const char *Slongparam="(J)V";
@@ -89,6 +87,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
 #include "nsk_strace.h"
 #include "nsk_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace005";
 static jclass stackOverflowErrorClass;
@@ -102,6 +100,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace006";
 
@@ -103,6 +101,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace008.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace008.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace008";
 
@@ -87,6 +85,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace009.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace009.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace009";
 
@@ -59,6 +57,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace011.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace011.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace011";
 static const char *SthreadName_mn="getName";
@@ -112,6 +110,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace012.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace012.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL
 Java_nsk_stress_strace_strace012Thread_recursiveMethod2(JNIEnv *env, jobject obj)
@@ -39,6 +37,4 @@
     CALL_VOID_NOPARAM(obj, threadClass, "recursiveMethod1");
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace014.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace014.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static const char *Stest_cn="nsk/stress/strace/strace014";
 static const char *SthreadName_mn="getName";
@@ -93,6 +91,4 @@
     SET_INT_FIELD(obj, threadClass, "currentDepth", currDepth);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace015.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace015.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -24,9 +24,7 @@
 #include <stdio.h>
 #include "nsk_strace.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL
 Java_nsk_stress_strace_strace015Thread_recursiveMethod2(JNIEnv *env, jobject obj)
@@ -39,6 +37,4 @@
     CALL_VOID_NOPARAM(obj, threadClass, "recursiveMethod1");
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/jit/LongTransitions/libLTTest.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/jit/LongTransitions/libLTTest.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -23,9 +23,7 @@
 #include <jni.h>
 #include <stdio.h>
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 JNIEXPORT void JNICALL Java_vm_jit_LongTransitions_LTTest_nativeFnc1(JNIEnv *e, jclass c
 ,jfloat p0,jfloat p1,jfloat p2,jfloat p3,jfloat p4,jfloat p5,jfloat p6,jfloat p7
@@ -3464,6 +3462,4 @@
     fclose(file);
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "jvmti_tools.h"
 #include "mlvmJvmtiUtils.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jvmtiEnv* gJvmtiEnv = NULL;
 
@@ -221,6 +219,4 @@
     return JNI_OK;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "jvmti_tools.h"
 #include "mlvmJvmtiUtils.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 static jvmtiEnv* gJvmtiEnv = NULL;
 
@@ -205,6 +203,4 @@
 
     return JNI_OK;
 }
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -27,9 +27,7 @@
 #include "jni.h"
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 #define ARGS_COUNT 6
 
@@ -74,6 +72,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -30,9 +30,7 @@
 #include "jvmti_tools.h"
 #include "mlvmJvmtiUtils.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 void copyFromJString(JNIEnv * pEnv, jstring src, char ** dst) {
     const char * pStr;
@@ -125,6 +123,4 @@
     return tls;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.h	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.h	Tue Sep 18 16:41:24 2018 -0700
@@ -26,9 +26,7 @@
 
 #include "jvmti.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 void copyFromJString(JNIEnv * pEnv, jstring src, char ** dst);
 
@@ -42,8 +40,6 @@
 char * locationToString(jvmtiEnv * pJvmtiEnv, jmethodID method, jlocation location);
 
 void * getTLS(jvmtiEnv * pJvmtiEnv, jthread thread, jsize sizeToAllocate);
-#ifdef __cplusplus
 }
-#endif
 
 #endif /* MLVMJVMTIUTILS_H_ */
--- a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp	Tue Sep 18 16:41:24 2018 -0700
@@ -33,9 +33,7 @@
 #endif /* _WIN32 */
 #include "jni_tools.h"
 
-#ifdef __cplusplus
 extern "C" {
-#endif
 
 /*
  * Class:     vm_share_ProcessUtils
@@ -261,6 +259,4 @@
 #endif /* _WIN32 */
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingHeap.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-/*
- * 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
- * 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 vm.share.gc;
-
-import java.lang.management.ManagementFactory;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Random;
-
-import nsk.share.TestFailure;
-import nsk.share.test.ExecutionController;
-
-public class TriggerUnloadingByFillingHeap implements TriggerUnloadingHelper {
-
-    public void triggerUnloading(ExecutionController stresser) {
-        List<String> jvmArgs = ManagementFactory.getRuntimeMXBean().getInputArguments();
-        if (jvmArgs.contains("-XX:+ExplicitGCInvokesConcurrent")) {
-                throw new TestFailure("Test bug! Found -XX:+ExplicitGCInvokesConcurrent in jvm args. TriggerUnloadingByFillingHeap.triggerUnloading will not work!.");
-        }
-
-        System.out.println("collections invoked: " + provokeGC(stresser));
-        System.out.println("collections invoked: " + provokeGC(stresser));
-        System.out.println("collections invoked: " + provokeGC(stresser));
-    }
-
-    private static long getGCCounter() {
-        return ManagementFactory.getGarbageCollectorMXBeans().get(1).getCollectionCount();
-    }
-
-    private static Random random = new Random();
-
-    public static byte[] garbage; //make it reference public to avoid compiler optimizations
-
-    private static long provokeGC(ExecutionController stresser) {
-        long initCounter = getGCCounter();
-        ArrayList<byte[]> list = new ArrayList<byte[]>();
-        while (getGCCounter() == initCounter && stresser.continueExecution()) {
-            list.add(new byte[1024]);
-
-            garbage = new byte[1024];
-            if (random.nextInt(10) % 10 < 3 && !list.isEmpty()) {
-                list.remove(0);
-            }
-            System.gc();
-        }
-        return getGCCounter() - initCounter;
-    }
-
-}
--- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java	Tue Sep 18 16:41:24 2018 -0700
@@ -22,76 +22,38 @@
  */
 package vm.share.gc;
 
-import java.util.ArrayList;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
+import nsk.share.test.ExecutionController;
 import metaspace.stressHierarchy.common.exceptions.GotWrongOOMEException;
 import nsk.share.gc.gp.classload.GeneratedClassProducer;
-import nsk.share.test.ExecutionController;
 
 public class TriggerUnloadingByFillingMetaspace implements
         TriggerUnloadingHelper {
 
-    private static final int NUMBER_OF_THREADS = 30;
-
-    private static class FillMetaspace {
-        private volatile boolean gotOOME = false;
-        private ExecutionController stresser;
-        private final ThreadLocal<GeneratedClassProducer> generatedClassProducer =
-            new ThreadLocal<GeneratedClassProducer>() {
-              @Override
-              protected GeneratedClassProducer initialValue() {
-                return new GeneratedClassProducer("metaspace.stressHierarchy.common.HumongousClass");
-              }
-            };
-
-        public FillMetaspace(ExecutionController stresser) { this.stresser = stresser; }
+    private volatile boolean gotOOME = false;
+    private ExecutionController stresser;
+    private final ThreadLocal<GeneratedClassProducer> generatedClassProducer =
+        new ThreadLocal<GeneratedClassProducer>() {
+          @Override
+          protected GeneratedClassProducer initialValue() {
+            return new GeneratedClassProducer("metaspace.stressHierarchy.common.HumongousClass");
+          }
+        };
 
-        private class FillMetaspaceTask implements Callable<Object> {
-            @Override
-            public Object call() throws Exception {
-                while (stresser.continueExecution() && ! gotOOME) {
-                    try {
-                        generatedClassProducer.get().create(-100500); //argument is not used.
-                    } catch (OutOfMemoryError oome) {
-                        if (!isInMetaspace(oome)) {
-                            throw new GotWrongOOMEException("Got OOME in heap while gaining OOME in metaspace. Test result can't be valid.");
-                        }
-                        gotOOME = true;
-                    }
-                }
-                return null;
-            }
-        }
-    }
-
-    private static boolean isInMetaspace(OutOfMemoryError error) {
-        return error.getMessage().trim().toLowerCase().contains("metadata");
+    private static boolean isInMetaspace(Throwable error) {
+        return (error.getMessage().trim().toLowerCase().contains("metaspace"));
     }
 
     @Override
     public void triggerUnloading(ExecutionController stresser) {
-        try {
-            FillMetaspace fillMetaspace = new FillMetaspace(stresser);
-            ArrayList<Callable<Object>> tasks = new ArrayList<Callable<Object>>(NUMBER_OF_THREADS);
-            for (int i = 0; i < NUMBER_OF_THREADS; i++) {
-                tasks.add(fillMetaspace.new FillMetaspaceTask());
-            }
-            ExecutorService executorService = Executors.newCachedThreadPool();
+        while (stresser.continueExecution() && !gotOOME) {
             try {
-                executorService.invokeAll(tasks);
-            } catch (InterruptedException e) {
-                System.out.println("Process of gaining OOME in metaspace was interrupted.");
-                e.printStackTrace();
+                generatedClassProducer.get().create(-100500); //argument is not used.
+            } catch (Throwable oome) {
+                if (!isInMetaspace(oome)) {
+                    throw new GotWrongOOMEException("Got OOME in heap while triggering OOME in metaspace. Test result can't be valid.");
+                }
+                gotOOME = true;
             }
-        } catch (OutOfMemoryError e) {
-            if (!isInMetaspace(e)) {
-                throw new GotWrongOOMEException("Got OOME in heap while gaining OOME in metaspace. Test result can't be valid.");
-            }
-            return;
         }
     }
-
 }
--- a/test/hotspot/jtreg/vmTestbase/vm/share/vmstresser/CompileAndDeoptimize.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * 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
- * 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 vm.share.vmstresser;
-
-public class CompileAndDeoptimize implements Runnable {
-
-    public static int v = 0;
-
-    private abstract static class A {
-        public abstract void incv();
-    }
-
-    private static class B extends A {
-        public void incv() {
-            v++;
-        }
-    }
-
-    public static class C extends A {
-        public void incv() {
-            v += (new int[1][1][1][1][1][1][1][1]).length;
-        }
-    }
-
-    private volatile boolean done = false;
-    public volatile A a = new B();
-
-    private void incv() {
-        a.incv();
-    }
-
-    private void inc() {
-        while ( ! done ) {
-            incv();
-        }
-        //while ( ! done ) {
-        //      incv();
-        //}
-        //while ( ! done ) {
-        //      incv();
-        //}
-    }
-
-    public void run() {
-        try {
-            Thread t = new Thread(new Runnable() { @Override public void run() { inc(); } });
-            t.start();
-            Thread.sleep(100);
-            a = (A) CompileAndDeoptimize.class.getClassLoader().loadClass(B.class.getName().replaceAll("B$", "C")).getConstructors()[0].newInstance(new Object[0]);
-            //Thread.sleep(1000);
-            //done = true;
-            //t.join();
-
-        } catch ( Throwable t ) {
-            t.printStackTrace();
-        }
-    }
-
-}
--- a/test/hotspot/jtreg/vmTestbase/vm/share/vmstresser/MetaspaceStresser.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-/*
- * 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
- * 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 vm.share.vmstresser;
-
-import java.util.*;
-import java.util.concurrent.locks.*;
-
-import nsk.share.*;
-import nsk.share.classload.*;
-import nsk.share.test.*;
-
-/**
- * Stresser that load classes until OOME, then unload some of them and continue loading.
- */
-public class MetaspaceStresser extends Thread {
-
-    /**
-     * Capacity of class containers.
-     * This amount of classes will be unloaded on reset call.
-     */
-    public static final int DEFAULT_BUCKET_SIZE = 4000;
-
-    public static final int DEFAULT_PAUSE_TIME = 0;
-
-    /*
-     * Loaded classes stored in ClassContainer instances.
-     * Such instances organized in array-based stack as it is
-     * one of the simplest way to minimize possibility
-     * to get OOME and guarntee that after replacing
-     * reference to class container by null there will be
-     * no cached refereces and container will be reclaimed by
-     * GC and classes will become unloadable.
-     */
-    // Maximum available amount of arrays with class containers.
-    private static final int CONTAINERS_ARRAY_LENGTH = 1000;
-    // Maximum length array with class containers.
-    private static final int CONTAINER_ARRAYS_COUNT = 100;
-
-    private ClassContainersStack containersStack = new ClassContainersStack(CONTAINER_ARRAYS_COUNT * CONTAINERS_ARRAY_LENGTH,
-            CONTAINERS_ARRAY_LENGTH);
-    private ClassContainer newContainer = null;
-
-    private ExecutionController controller = null;
-    private int bucketSize = DEFAULT_BUCKET_SIZE;
-    private int pauseTime = DEFAULT_PAUSE_TIME;
-
-    private ReentrantLock lock = new ReentrantLock();
-
-    /**
-     * Construct MetaspaceStrresser with default bucket size
-     * and pause time.
-     * @param c controller to control execution time.
-     */
-    public MetaspaceStresser(ExecutionController c) {
-        controller = c;
-    }
-
-    /**
-     * Construct MetaspaceStrresser with custom bucket size
-     * and pause time.
-     * @param c controller to control execution time.
-     * @param bucketSize classes to be unloaded on reset.
-     * @param pauseTime pause after reset.
-     */
-    public MetaspaceStresser(ExecutionController c, int bucketSize, int pauseTime) {
-        this(c);
-        this.bucketSize = bucketSize;
-        this.pauseTime = pauseTime;
-    }
-
-    /**
-     *  Fill Metaspace with classes.
-     *  Classes will be loaded until OOME, then some of them will be unloaded.
-     */
-    public synchronized void prepare() {
-        while (controller.continueExecution()) {
-            try {
-                fillContainerStack();
-            } catch (OutOfMemoryError oome) {
-                unloadLastClassBucket();
-                return;
-            } catch (ClassNotFoundException cnfe) {
-                throw new TestBug("Unexpected exception in stresser.", cnfe);
-            }
-        }
-    }
-
-    /**
-     * Load new class to container, fill containerStack.
-     * Classes will be loaded until OOME
-     * @throws ClassNotFoundException
-     */
-    private void fillContainerStack() throws ClassNotFoundException {
-        newContainer = new ClassContainer();
-        while (newContainer.size() < bucketSize && controller.continueExecution()) {
-            newContainer.loadClass();
-        }
-        containersStack.push(newContainer);
-        newContainer = null;
-    }
-
-    /**
-     * Run stresser.
-     * Stresser will load classes until OOME, then bucketSize classes
-     * will be unloaded and stresser will wait pauseTime millisiconds
-     * before continuing class loading.
-     */
-    public void run() {
-        try {
-            while (controller.continueExecution()) {
-                try {
-                    fillContainerStack();
-                } catch (OutOfMemoryError oome) {
-                    unloadLastClassBucket();
-                    try {
-                        Thread.sleep(pauseTime);
-                    } catch (InterruptedException ie) {
-                    }
-                }
-            }
-        } catch (Throwable e) {
-            throw new TestBug("Unexpected exception in stresser.", e);
-        } finally {
-            containersStack.free();
-        }
-    }
-
-    /**
-     * Unload most recently loaded bucket of classes.
-     */
-    public void unloadLastClassBucket() {
-        while (controller.continueExecution()) {
-            try {
-                containersStack.pop();
-                System.gc();
-                break;
-            } catch (OutOfMemoryError oome) {
-                oome.printStackTrace();
-                continue;
-            }
-        }
-    }
-
-    /**
-     * Array-based stack for ClassContainer's.
-     */
-    private class ClassContainersStack {
-
-        private int arrayLength = 0;
-        private int arraysCount = 0;
-        private int arrayIndex = 0;
-        private int elemIndex = 0;
-
-        private ClassContainer data[][];
-
-        /**
-         * Create ClassContainersStack that will be able
-         * to store size classes in arrays of segmentSize length.
-         */
-        public ClassContainersStack(int size, int segementSize) {
-            arrayLength = segementSize;
-            arraysCount = size / arrayLength;
-            data = new ClassContainer[arraysCount][];
-            data[0] = new ClassContainer[arrayLength];
-        }
-
-        /**
-         * Push ClassContainer c into stack.
-         */
-        public synchronized void push(ClassContainer c) {
-            data[arrayIndex][elemIndex] = c;
-            elemIndex++;
-            if (elemIndex == arrayLength) {
-                if (arrayIndex == arraysCount) {
-                    throw new TestBug("ClassContainersStack ran out of available slots");
-                }
-                data[arrayIndex + 1] = new ClassContainer[arrayLength];
-                arrayIndex++;
-                elemIndex = 0;
-            }
-        }
-
-        /**
-         * Remove reference to top ClassContainer.
-         */
-        public synchronized void pop() {
-            data[arrayIndex][elemIndex] = null;
-            if (elemIndex > 0) {
-                elemIndex--;
-            } else if (arrayIndex > 0) {
-                data[arrayIndex] = null;
-                arrayIndex--;
-                elemIndex = arrayLength - 1;
-            }
-        }
-
-        /**
-         * Remove all stored ClassContainers.
-         */
-        public synchronized void free() {
-            data = null;
-            System.gc();
-            data = new ClassContainer[arraysCount][];
-            data[0] = new ClassContainer[arrayLength];
-            arrayIndex = 0;
-            elemIndex = 0;
-        }
-
-    }
-
-    /// Variable used to create uniqe name for generated classes.
-    private static long lastClass = 0;
-
-    /**
-     * Class container consists of classes and their ClassLoader, so
-     * if there will be no references to container and classes inside it then
-     * it could be easely collected by GC.
-     */
-    private class ClassContainer {
-
-        private List<Class> classes = new LinkedList<Class>();
-        private GeneratingClassLoader loader = new GeneratingClassLoader();
-        private String prefix = loader.getPrefix();
-        private int length = loader.getNameLength();
-
-        public void loadClass() throws ClassNotFoundException {
-            String newName = prefix + "c" + lastClass;
-            lastClass++;
-            while (newName.length() < length) {
-                newName = newName + "c";
-            }
-            classes.add(loader.loadClass(newName));
-        }
-
-        public int size() {
-            return classes.size();
-        }
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/JDK8209615.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,171 @@
+/*
+ * 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 stream.XMLEventReaderTest;
+
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import javax.xml.stream.*;
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.nio.charset.StandardCharsets;
+import java.util.Iterator;
+
+/*
+ * @test
+ * @bug 8209615
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm -DrunSecMngr=true stream.XMLEventReaderTest.JDK8209615
+ * @run testng/othervm stream.XMLEventReaderTest.JDK8209615
+ * @summary Verifies that the parser continues parsing the character data
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class JDK8209615 {
+
+    /**
+     * Verifies that the parser parses the xml successfully. Before the patch,
+     * the parser failed with the following error message:
+     * The element type "Data" must be terminated by the matching end-tag "</Data>".
+     *
+     * @throws Exception if the parser fails to parse the xml
+     */
+    @Test
+    public void testParseCData() throws Exception {
+
+        String xml = "<Export generator=\"Cache\" version=\"25\">\r\n"
+            + "<Class name=\"DSVRDemo.ConditionalBannerLIDR\">\r\n" + "<Description>\r\n" + "</Description>\r\n"
+            + "<Parameter name=\"XSLTMODE\">\r\n" + "</Parameter>\r\n" + "<Parameter name=\"DSSHOME\">\r\n"
+            + "</Parameter>\r\n" + "<Parameter name=\"DSSCLASS\">\r\n" + "</Parameter>\r\n"
+            + "<XData name=\"ReportModel\">\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n"
+            + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n"
+            + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"box\",gc:\r\n"
+            + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n"
+            + "{t:\"txt\",gc:\r\n" + "{t:\"box\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n"
+            + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n"
+            + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n"
+            + "{t:\"txt\",gc:\r\n" + "{t:\"txt\",gc:\r\n" + "<Data><![CDATA[\r\n" + "<pageheader>\r\n"
+            + "<![CDATA[\r\n" + "</svg:text>\r\n"
+            + "<svg:text x=\"0\" y=\"30.333333333333336\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "Run by:\r\n" + "</svg:text>\r\n" + "<xsl:value-of select=\"@Genre\"/>\r\n" + "</svg:text>\r\n"
+            + "<svg:text x=\"0\" y=\"19.333333333333336\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "Genre:\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"70\" y=\"0\" width=\"86\" height=\"11\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"70\" y=\"8.333333333333334\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:rect x=\"0\" y=\"0\" width=\"70\" height=\"11\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"0\" y=\"8.333333333333334\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "Run time:\r\n" + "</svg:text>\r\n"
+            + "<svg:line x1=\"0\" y1=\"34\" x2=\"466\" y2=\"34\" style=\"stroke:#000000;stroke-width:2;stroke-opacity:1\" />\r\n"
+            + "</svg:svg>\r\n" + "</fo:instream-foreign-object>\r\n" + "</fo:block>\r\n" + "]]]]><![CDATA[>\r\n"
+            + "<!-- end of PAGE HEADER -->\r\n" + "<pagefooter>\r\n" + "<!-- PAGE FOOTER -->\r\n" + "<write>\r\n"
+            + "<![CDATA[\r\n" + "<fo:block font-size=\"0pt\" >\r\n" + "<fo:instream-foreign-object>\r\n"
+            + "<svg:svg width=\"468pt\" height=\"37pt\" viewBox=\"0 0 468 37\" >\r\n"
+            + "<svg:line x1=\"0\" y1=\"1\" x2=\"466\" y2=\"1\" style=\"stroke:#000000;stroke-width:2;stroke-opacity:1\" />\r\n"
+            + "<svg:rect x=\"70\" y=\"2\" width=\"86\" height=\"11\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<xsl:value-of select=\"@runBy\"/>\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"0\" y=\"2\" width=\"70\" height=\"11\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"0\" y=\"10.333333333333334\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:rect x=\"70\" y=\"13\" width=\"86\" height=\"11\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:text x=\"0\" y=\"21.333333333333336\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:rect x=\"70\" y=\"24\" width=\"86\" height=\"11\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"70\" y=\"32.333333333333336\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:rect x=\"0\" y=\"24\" width=\"70\" height=\"11\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"0\" y=\"32.333333333333336\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "Run time:\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"312\" y=\"23\" width=\"156\" height=\"12\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"468\" y=\"31.333333333333336\" style=\"font-size:10;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;text-anchor:end;\" >\r\n"
+            + "Annotated Box Office\r\n" + "</svg:text>\r\n" + "</fo:instream-foreign-object>\r\n"
+            + "</fo:block>\r\n" + "<!-- end of PAGE FOOTER -->\r\n" + "</pagefooter>\r\n" + "<body>\r\n"
+            + "<write>\r\n" + "<![CDATA[\r\n" + "<fo:block font-size=\"0pt\" >\r\n"
+            + "<svg:svg width=\"468pt\" height=\"205pt\" viewBox=\"0 0 468 205\" >\r\n"
+            + "<svg:rect x=\"1\" y=\"73\" width=\"466\" height=\"126\" style=\"fill-opacity:1;fill:#ffffff;stroke:#000000;stroke-width:2;stroke-opacity:1\" />\r\n"
+            + "<svg:rect x=\"0\" y=\"74\" width=\"468\" height=\"44\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "Annotated Box Office\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"246\" y=\"118\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"246\" y=\"129.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:rect x=\"0\" y=\"118\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"222\" y=\"129.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;text-anchor:end;\" >\r\n"
+            + "Run by:\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"246\" y=\"134\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:text x=\"222\" y=\"145.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;text-anchor:end;\" >\r\n"
+            + "Genre:\r\n"
+            + "<svg:rect x=\"246\" y=\"150\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"246\" y=\"161.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "<xsl:value-of select=\"@runTime\"/>\r\n"
+            + "<svg:rect x=\"0\" y=\"150\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "Run time:\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"246\" y=\"166\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"246\" y=\"177.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "<xsl:value-of select=\"TotalTicketsSold\"/>\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"0\" y=\"166\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"222\" y=\"177.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;text-anchor:end;\" >\r\n"
+            + "Total tickets sold:\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"246\" y=\"182\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"246\" y=\"193.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "<xsl:value-of select=\"TotalFilms\"/>\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"0\" y=\"182\" width=\"222\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"222\" y=\"193.66666666666666\" style=\"font-size:14;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;text-anchor:end;\" >\r\n"
+            + "Total films:\r\n" + "</svg:text>\r\n" + "</svg:svg>\r\n" + "]]]]><![CDATA[>\r\n" + "</write>\r\n"
+            + "<pagebreak/>\r\n" + "<!-- end of REPORT HEADER -->\r\n" + "<group name='FilmsByGenre' >\r\n"
+            + "<!-- GROUP HEADER (FilmsByGenre) -->\r\n" + "<write>\r\n" + "<![CDATA[\r\n"
+            + "<fo:block font-size=\"0pt\" >\r\n" + "<fo:instream-foreign-object>\r\n"
+            + "<svg:svg width=\"468pt\" height=\"74pt\" viewBox=\"0 0 468 74\" >\r\n"
+            + "<svg:text x=\"78\" y=\"55\" style=\"font-size:12;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "<xsl:value-of select=\"TitleCount\"/>\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"0\" y=\"45\" width=\"78\" height=\"14\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"0\" y=\"55\" style=\"font-size:12;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "Title count:\r\n" + "</svg:text>\r\n"
+            + "<svg:rect x=\"156\" y=\"24\" width=\"156\" height=\"21\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<xsl:value-of select=\"@CategoryName\"/>\r\n" + "</svg:text>\r\n"
+            + "<svg:text x=\"468\" y=\"55\" style=\"font-size:12;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;text-anchor:end;\" >\r\n"
+            + "<svg:rect x=\"312\" y=\"45\" width=\"78\" height=\"14\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"390\" y=\"55\" style=\"font-size:12;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;text-anchor:end;\" >\r\n"
+            + "</svg:text>\r\n"
+            + "<svg:line x1=\"0\" y1=\"60\" x2=\"466\" y2=\"60\" style=\"stroke:#000000;stroke-width:2;stroke-opacity:1\" />\r\n"
+            + "</svg:svg>\r\n" + "</fo:instream-foreign-object>\r\n" + "</fo:block>\r\n" + "]]]]><![CDATA[>\r\n"
+            + "</write>\r\n" + "<group name='FilmDetail' >\r\n" + "<!-- REPORT BODY (FilmDetail) -->\r\n"
+            + "<write>\r\n" + "<![CDATA[\r\n" + "<fo:block font-size=\"0pt\">\r\n"
+            + "<fo:instream-foreign-object>\r\n"
+            + "<svg:svg width=\"468pt\" height=\"71pt\" viewBox=\"0 0 468 71\" >\r\n"
+            + "<svg:rect x=\"3\" y=\"4\" width=\"257\" height=\"16\" style=\"fill:#ffffff;fill-opacity:0;stroke-width:0;\" />\r\n"
+            + "<svg:text x=\"3\" y=\"14\" style=\"font-size:12;font-family:sans-serif;fill:#000000;fill-opacity:1;font-weight:bold;\" >\r\n"
+            + "</svg:text>\r\n" + "</report>]]></Data>\r\n" + "</XData>\r\n" + "</Class>\r\n" + "</Export>\r\n";
+        try (ByteArrayInputStream inputStream = new ByteArrayInputStream(xml.getBytes(StandardCharsets.UTF_8))) {
+            stax(inputStream);
+        }
+
+    }
+
+    private static void stax(InputStream input) throws XMLStreamException, FactoryConfigurationError {
+        XMLEventReader eventReader = XMLInputFactory.newInstance()
+            .createXMLEventReader(input);
+        ((Iterator<?>) eventReader).forEachRemaining(ignored -> {
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jaxp/javax/xml/jaxp/unittest/transform/JDK8207760.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,175 @@
+/*
+ * 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 transform;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.nio.charset.StandardCharsets;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+import java.util.Random;
+import javax.xml.transform.OutputKeys;
+import org.testng.annotations.DataProvider;
+
+/*
+ * @test
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng/othervm transform.JDK8207760
+ * @summary Verifies that a surrogate pair at the edge of a buffer is properly handled
+ * @bug 8207760
+ */
+@Listeners({jaxp.library.FilePolicy.class})
+public class JDK8207760 {
+    final String xsl8207760 =
+        "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" +
+        "    <xsl:output omit-xml-declaration=\"yes\" indent=\"no\" />\n" +
+        "\n" +
+        "    <xsl:template match=\"node()|@*\">\n" +
+        "        <xsl:copy>\n" +
+        "            <xsl:apply-templates select=\"node()|@*\" />\n" +
+        "        </xsl:copy>\n" +
+        "    </xsl:template>\n" +
+        "</xsl:stylesheet>\n";
+
+    final String xsl8207760_2 = "<xsl:stylesheet \n" +
+        "  version=\"1.0\" \n" +
+        "  xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" +
+        "\n" +
+        "  <xsl:output method=\"xml\" indent=\"no\" cdata-section-elements=\"source\"/>\n" +
+        "\n" +
+        "  <xsl:template match=\"source\">\n" +
+                "        <xsl:copy>\n" +
+                "            <xsl:apply-templates select=\"node()\" />\n" +
+                "        </xsl:copy>\n" +
+        "  </xsl:template>\n" +
+        "\n" +
+        "</xsl:stylesheet>";
+
+    final String xsl8207760_3 = "<xsl:stylesheet \n" +
+        "  version=\"1.0\" \n" +
+        "  xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">\n" +
+        "\n" +
+        "  <xsl:output method=\"xml\" indent=\"no\" cdata-section-elements=\"source\"/>\n" +
+        "\n" +
+        "  <xsl:template match=\"source\">\n" +
+        "    <xsl:copy>\n" +
+        "      <!-- Copy the attributes -->\n" +
+        "      <xsl:apply-templates select=\"@*\"/>\n" +
+        "      <!-- Convert the contained nodes (elements and text) into text -->\n" +
+        "      <xsl:variable name=\"subElementsText\">\n" +
+        "        <xsl:apply-templates select=\"node()\"/>\n" +
+        "      </xsl:variable>\n" +
+        "      <!-- Output the XML directive and the converted nodes -->\n" +
+        "      <xsl:value-of select=\"$subElementsText\"/>\n" +
+        "    </xsl:copy>\n" +
+        "  </xsl:template>\n" +
+        "\n" +
+        "</xsl:stylesheet>";
+
+    @DataProvider(name = "xsls")
+    public Object[][] getDataBug8207760_cdata() {
+        return new Object[][]{
+            {xsl8207760_2},
+            {xsl8207760_3},
+        };
+    }
+
+    /*
+     * @bug 8207760
+     * Verifies that a surrogate pair at the edge of a buffer is properly handled
+     * when serializing into a Character section.
+     */
+    @Test
+    public final void testBug8207760() throws Exception {
+        String[] xmls = prepareXML(false);
+        Transformer t = createTransformerFromInputstream(
+                new ByteArrayInputStream(xsl8207760.getBytes(StandardCharsets.UTF_8)));
+        t.setOutputProperty(OutputKeys.ENCODING, StandardCharsets.UTF_8.name());
+        StringWriter sw = new StringWriter();
+        t.transform(new StreamSource(new StringReader(xmls[0])), new StreamResult(sw));
+        Assert.assertEquals(sw.toString().replaceAll(System.lineSeparator(), "\n"), xmls[1]);
+    }
+
+    /*
+     * @bug 8207760
+     * Verifies that a surrogate pair at the edge of a buffer is properly handled
+     * when serializing into a CDATA section.
+     */
+    @Test(dataProvider = "xsls")
+    public final void testBug8207760_cdata(String xsl) throws Exception {
+        String[] xmls = prepareXML(true);
+        Transformer t = createTransformerFromInputstream(
+                new ByteArrayInputStream(xsl.getBytes(StandardCharsets.UTF_8)));
+        t.setOutputProperty(OutputKeys.ENCODING, StandardCharsets.UTF_8.name());
+        StringWriter sw = new StringWriter();
+        t.transform(new StreamSource(new StringReader(xmls[0])), new StreamResult(sw));
+        Assert.assertEquals(sw.toString().replaceAll(System.lineSeparator(), "\n"), xmls[1]);
+    }
+
+    private String[] prepareXML(boolean cdata) {
+        String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><source>";
+        if (cdata) {
+            xml += "<![CDATA[";
+        }
+        String tail = "abc 123 </source>";
+        if (cdata) {
+            tail = "abc 123 ]]></source>";
+        }
+        String temp = generateString(1023);
+        xml = xml + temp + '\uD83C' + '\uDF42' + tail;
+        //xml = xml + temp + tail;
+        String expected = (!cdata) ? "<source>" + temp + "&#127810;" + tail
+                : xml;
+
+        return new String[]{xml, expected};
+    }
+
+    static final char[] CHARS = "abcdefghijklmnopqrstuvwxyz \n".toCharArray();
+    StringBuilder sb = new StringBuilder(1024 << 4);
+    Random random = new Random();
+
+    private String generateString(int size) {
+        sb.setLength(0);
+        for (int i = 0; i < size; i++) {
+            char c = CHARS[random.nextInt(CHARS.length)];
+            sb.append(c);
+        }
+
+        return sb.toString();
+    }
+
+    private Transformer createTransformerFromInputstream(InputStream xslStream)
+            throws TransformerException {
+        return TransformerFactory.newInstance().newTransformer(new StreamSource(xslStream));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/ProblemList-Xcomp.txt	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,31 @@
+#
+# 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.
+#
+
+#############################################################################
+#
+# List of quarantined tests for testing in Xcomp mode.
+#
+#############################################################################
+
+java/lang/invoke/MethodHandles/CatchExceptionTest.java 8146623 generic-all
+java/lang/Class/forName/modules/TestDriver.java 8208212 solaris-all
--- a/test/jdk/build/releaseFile/CheckSource.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/build/releaseFile/CheckSource.java	Tue Sep 18 16:41:24 2018 -0700
@@ -34,9 +34,13 @@
 import java.io.FileReader;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 public class CheckSource {
 
+    public static final String SRC_HASH_REGEXP = ":((hg)|(git)):[a-z0-9]*\\+?";
+
     CheckSource(String dataFile, boolean isOpenJDK) {
         // Read data files
         readFile(dataFile, isOpenJDK);
@@ -44,6 +48,7 @@
 
     private void readFile(String fileName, boolean isOpenJDK) {
         String fishForSOURCE = null;
+        String implementor = null;
 
         File file = new File(fileName);
 
@@ -65,7 +70,13 @@
                 // grab SOURCE line
                 if (readIn.startsWith("SOURCE=")) {
                     fishForSOURCE = readIn;
-                    break;
+                    continue;
+                }
+
+                // grab IMPLEMENTOR line
+                if (readIn.startsWith("IMPLEMENTOR=")) {
+                    implementor = readIn;
+                    continue;
                 }
             }
         } catch (FileNotFoundException fileExcept) {
@@ -79,27 +90,46 @@
         // was SOURCE even found?
         if (fishForSOURCE == null) {
             throw new RuntimeException("SOURCE line was not found!");
-        } else {
-            // OK it was found, did it have correct sources?
-            System.out.println("The source string found: " + fishForSOURCE);
+        }
+        System.out.println("The source string found: " + fishForSOURCE);
 
-            // First it MUST have .: regardless of closed or openJDK
-            if (!fishForSOURCE.contains(".:")) {
-                throw new RuntimeException("The test failed, .: not found!");
-            }
-            // take out the .: source path
-            fishForSOURCE = fishForSOURCE.replace(".:", "");
+        // Extract the value of SOURCE=
+        Pattern valuePattern = Pattern.compile("SOURCE=\"(.*)\"");
+        Matcher valueMatcher = valuePattern.matcher(fishForSOURCE);
+        if (!valueMatcher.matches()) {
+            throw new RuntimeException("SOURCE string has bad format, should be SOURCE=\"<value>\"");
+        }
+        String valueString = valueMatcher.group(1);
+
+        // Check if implementor is Oracle
+        boolean isOracle = (implementor != null) && implementor.contains("Oracle Corporation");
+
+        String[] values = valueString.split(" ");
 
-            // if its closedJDK it MUST have open:
-            if (!isOpenJDK && !fishForSOURCE.contains("open:")) {
-                throw new RuntimeException("The test failed, open: not found!");
-            }
-            // take out the open: source path
-            fishForSOURCE = fishForSOURCE.replace("open:", "");
+        // First value MUST start with ".:" regardless of Oracle or OpenJDK
+        String rootRegexp = "\\." + SRC_HASH_REGEXP;
+        if (!values[0].matches(rootRegexp)) {
+            throw new RuntimeException("The test failed, first element did not match regexp: " + rootRegexp);
+        }
 
-            // if any other source exists, that's an error
-            if (fishForSOURCE.contains(":")) {
-                throw new RuntimeException("The test failed, additional sources found!");
+        // If it's an Oracle build, it can be either OpenJDK or OracleJDK. Other
+        // builds may have any number of additional elements in any format.
+        if (isOracle) {
+            if (isOpenJDK) {
+                if (values.length != 1) {
+                    throw new RuntimeException("The test failed, wrong number of elements in SOURCE list." +
+                            " Should be 1 for Oracle built OpenJDK.");
+                }
+            } else {
+                if (values.length != 2) {
+                    throw new RuntimeException("The test failed, wrong number of elements in SOURCE list." +
+                            " Should be 2 for OracleJDK.");
+                }
+                // Second value MUST start with "open:" for OracleJDK
+                String openRegexp = "open" + SRC_HASH_REGEXP;
+                if (!values[1].matches(openRegexp)) {
+                    throw new RuntimeException("The test failed, second element did not match regexp: " + openRegexp);
+                }
             }
         }
 
@@ -114,7 +144,6 @@
         System.out.println("JDK Path : " + jdkPath);
         System.out.println("Runtime Name : " + runtime);
 
-        new CheckSource(jdkPath + "/release",
-                              runtime.contains("OpenJDK"));
+        new CheckSource(jdkPath + "/release", runtime.contains("OpenJDK"));
     }
 }
--- a/test/jdk/com/sun/jdi/BadHandshakeTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/jdi/BadHandshakeTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -36,18 +36,17 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import jdk.test.lib.process.ProcessTools;
 
 /* @test
  * @bug 6306165 6432567
  * @summary Check that a bad handshake doesn't cause a debuggee to abort
- * @library /lib/testlibrary
  * @library /test/lib
  *
  * @modules java.management
  *          jdk.jdi
- * @build jdk.testlibrary.* VMConnection BadHandshakeTest Exit0
+ * @build VMConnection BadHandshakeTest Exit0
  * @run driver BadHandshakeTest
  */
 public class BadHandshakeTest {
--- a/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -24,7 +24,6 @@
 /*
  * @test
  * @summary Smoke test for JDWP hardening
- * @library /lib/testlibrary
  * @library /test/lib
  * @run driver BasicJDWPConnectionTest
  */
@@ -37,7 +36,7 @@
 import java.net.SocketException;
 
 import jdk.test.lib.apps.LingeredApp;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 import java.util.ArrayList;
 import java.util.List;
--- a/test/jdk/com/sun/jdi/DebuggerThreadTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/jdi/DebuggerThreadTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -66,6 +66,7 @@
      * Move to top ThreadGroup and dump all threads.
      */
     public void dumpThreads() {
+        int finishedThreads = 0;
         ThreadGroup tg = Thread.currentThread().getThreadGroup();
         ThreadGroup parent = tg.getParent();
         while (parent != null) {
@@ -77,7 +78,14 @@
         int gotThreads = tg.enumerate(list, true);
         for (int i = 0; i < Math.min(gotThreads, list.length); i++){
             Thread t = list[i];
-            String groupName = t.getThreadGroup().getName();
+            ThreadGroup tga = t.getThreadGroup();
+            String groupName;
+            if (tga == null) {
+                groupName = "<completed>";
+                finishedThreads++ ;
+            } else {
+                groupName = tga.getName();
+            }
 
             System.out.println("Thread [" + i + "] group = '" +
                                groupName +
@@ -89,7 +97,10 @@
                 failure("FAIL: non-daemon thread '" + t.getName() +
                         "' found in ThreadGroup '" + groupName + "'");
             }
-
+        }
+        if (finishedThreads > 0 ) {
+            failure("FAIL: " + finishedThreads +
+                    " threads completed while VM suspended.");
         }
     }
 
--- a/test/jdk/com/sun/jdi/DoubleAgentTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/jdi/DoubleAgentTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,16 +23,14 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /* @test
  * @bug 6354345
  * @summary Check that multiple -agentlib statements in command line fails
  *
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
- * @build jdk.testlibrary.*
  * @build DoubleAgentTest Exit0
  * @run driver DoubleAgentTest
  */
--- a/test/jdk/com/sun/jdi/ExclusiveBind.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/jdi/ExclusiveBind.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,12 +25,11 @@
  * @bug 4531526
  * @summary Test that more than one debuggee cannot bind to same port
  *          at the same time.
- * @library /lib/testlibrary
  * @library /test/lib
  *
  * @modules java.management
  *          jdk.jdi
- * @build jdk.testlibrary.* VMConnection ExclusiveBind HelloWorld
+ * @build VMConnection ExclusiveBind HelloWorld
  * @run driver ExclusiveBind
  */
 import java.net.ServerSocket;
@@ -46,7 +45,7 @@
 import java.util.concurrent.TimeUnit;
 
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class ExclusiveBind {
     /*
--- a/test/jdk/com/sun/jdi/Redefine-g.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +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 4777868
-#  @summary Compile with java -g, do a RedefineClasses, and you don't get local vars
-#  @author Jim Holmlund
-#
-#  @run shell Redefine-g.sh
-#pkg=untitled7
-
-# Compile the first version without -g and the 2nd version with -g.
-compileOptions=
-compileOptions2=-g
-#java=java_g
-
-# Uncomment this to see the JDI trace
-# jdbOptions=-dbgtrace
-
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-
-public class $1 {
-  public $1() {
-  }
-  public static void main(String[] args) {
-    int gus = 22;
-    $1 kk = new $1();
-    kk.m1("ab");
-  }
-
-  void m1(String p1) {
-    int m1l1 = 1;
-    System.out.println("m1(String) called");
-    m1(p1, "2nd");
-    // @1 uncomment System.out.println("Hello Milpitas!");
-  }
-
-  void m1(String p1, String p2) {
-    int m1l2 = 2;
-    System.out.println("m2" + p1 + p2);  // @1 breakpoint
-  }
-
-}
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    runToBkpt @1
-    cmd where
-    cmd locals
-
-    redefineClass @1
-    cmd where
-    cmd locals
-
-    cmd pop
-    cmd where
-    cmd locals
-
-    cmd pop
-    cmd where
-    cmd locals
-
-    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 'p1 = "ab"'
-jdbFailIfNotPresent 'p2 = "2nd"'
-jdbFailIfNotPresent 'm1l2 = 2'
-jdbFailIfPresent    'm1l1'
-
-jdbFailIfNotPresent 'args = instance of java.lang.String'
-jdbFailIfNotPresent 'gus = 22'
-jdbFailIfNotPresent 'kk = instance of shtest'
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineAbstractClass.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,139 @@
+/*
+ * 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
+ * @bug 6805864
+ * @summary Redefine an abstract class that is called via a concrete
+ * class and via two interface objects and verify that the right
+ * methods are called.
+ * @comment converted from test/jdk/com/sun/jdi/RedefineAbstractClass.sh
+ *
+ * @library /test/lib
+ * @compile -g RedefineAbstractClass.java
+ * @run main/othervm RedefineAbstractClass
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.ClassTransformer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+class RedefineAbstractClassTarg {
+    public static void main(String[] args) {
+        System.out.println("This is RedefineAbstractClass");
+
+        MyConcreteClass foo = new MyConcreteClass();
+        // do the work once before redefine
+        foo.doWork();
+
+        System.out.println("stop here for redefine");  // @1 breakpoint
+
+        // do the work again after redefine
+        foo.doWork();
+
+        System.out.println("stop here to check results");  // @2 breakpoint
+    }
+}
+
+interface MyInterface1 {
+    public boolean checkFunc();
+    public boolean isMyInterface1();
+}
+
+interface MyInterface2 {
+    public boolean checkFunc();
+    public boolean isMyInterface2();
+}
+
+abstract class MyAbstractClass implements MyInterface1, MyInterface2 {
+    static int counter = 0;
+    public boolean checkFunc() {
+        counter++;
+        System.out.println("MyAbstractClass.checkFunc() called.");
+        // @1 uncomment System.out.println("This is call " + counter + " to checkFunc");
+        return true;
+    }
+    public boolean isMyInterface1() {
+        System.out.println("MyAbstractClass.isMyInterface1() called.");
+        return true;
+    }
+    public boolean isMyInterface2() {
+        System.out.println("MyAbstractClass.isMyInterface2() called.");
+        return true;
+    }
+}
+
+class MyConcreteClass extends MyAbstractClass {
+    public void doWork() {
+        // checkFunc() is called via invokevirtual here; MyConcreteClass
+        // inherits via MyAbstractClass
+        System.out.println("In doWork() calling checkFunc(): " + checkFunc());
+
+        MyInterface1 if1 = (MyInterface1) this;
+        // checkFunc() is called via invokeinterface here; this call will
+        // use the first itable entry
+        System.out.println("In doWork() calling if1.checkFunc(): " + if1.checkFunc());
+
+        MyInterface2 if2 = (MyInterface2) this;
+        // checkFunc() is called via invokeinterface here; this call will
+        // use the second itable entry
+        System.out.println("In doWork() calling if2.checkFunc(): " + if2.checkFunc());
+    }
+}
+
+
+public class RedefineAbstractClass extends JdbTest {
+    public static void main(String argv[]) {
+        new RedefineAbstractClass().run();
+    }
+
+    private RedefineAbstractClass() {
+        super(DEBUGGEE_CLASS, SOURCE_FILE);
+    }
+
+    private static final String DEBUGGEE_CLASS = RedefineAbstractClassTarg.class.getName();
+    private static final String SOURCE_FILE = "RedefineAbstractClass.java";
+    private static final String ABSTRACT_CLASS = "MyAbstractClass";
+
+    @Override
+    protected void runCases() {
+        setBreakpoints(1);
+        setBreakpoints(2);
+        jdb.command(JdbCommand.run());
+
+        // modified version of redefineClass function
+        String transformedClassFile = ClassTransformer.fromTestSource(SOURCE_FILE)
+                .transform(1, ABSTRACT_CLASS, "-g");
+        jdb.command(JdbCommand.redefine(ABSTRACT_CLASS, transformedClassFile));
+        // end modified version of redefineClass function
+
+        // this will continue to the second breakpoint
+        jdb.command(JdbCommand.cont());
+
+        new OutputAnalyzer(getDebuggeeOutput())
+                .shouldContain("This is call 4 to checkFunc")
+                .shouldContain("This is call 5 to checkFunc")
+                .shouldContain("This is call 6 to checkFunc");
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineAbstractClass.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,154 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please 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 6805864
-# @summary Redefine an abstract class that is called via a concrete
-#   class and via two interface objects and verify that the right
-#   methods are called.
-# @author Daniel D. Daugherty
-#
-# @key intermittent
-# @run shell RedefineAbstractClass.sh
-
-compileOptions=-g
-
-# Uncomment this to see the JDI trace
-#jdbOptions=-dbgtrace
-
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-
-public class $1 {
-  public static void main(String[] args) {
-    System.out.println("This is RedefineAbstractClass");
-
-    MyConcreteClass foo = new MyConcreteClass();
-    // do the work once before redefine
-    foo.doWork();
-
-    System.out.println("stop here for redefine");  // @1 breakpoint
-
-    // do the work again after redefine
-    foo.doWork();
-
-    System.out.println("stop here to check results");  // @2 breakpoint
-  }
-}
-
-interface MyInterface1 {
-  public boolean checkFunc();
-  public boolean isMyInterface1();
-}
-
-interface MyInterface2 {
-  public boolean checkFunc();
-  public boolean isMyInterface2();
-}
-
-abstract class MyAbstractClass implements MyInterface1, MyInterface2 {
-  static int counter = 0;
-  public boolean checkFunc() {
-    counter++;
-    System.out.println("MyAbstractClass.checkFunc() called.");
-    // @1 uncomment System.out.println("This is call " + counter + " to checkFunc");
-    return true;
-  }
-  public boolean isMyInterface1() {
-    System.out.println("MyAbstractClass.isMyInterface1() called.");
-    return true;
-  }
-  public boolean isMyInterface2() {
-    System.out.println("MyAbstractClass.isMyInterface2() called.");
-    return true;
-  }
-}
-
-class MyConcreteClass extends MyAbstractClass {
-  public void doWork() {
-    // checkFunc() is called via invokevirtual here; MyConcreteClass
-    // inherits via MyAbstractClass
-    System.out.println("In doWork() calling checkFunc(): " + checkFunc());
-
-    MyInterface1 if1 = (MyInterface1) this;
-    // checkFunc() is called via invokeinterface here; this call will
-    // use the first itable entry
-    System.out.println("In doWork() calling if1.checkFunc(): " + if1.checkFunc());
-
-    MyInterface2 if2 = (MyInterface2) this;
-    // checkFunc() is called via invokeinterface here; this call will
-    // use the second itable entry
-    System.out.println("In doWork() calling if2.checkFunc(): " + if2.checkFunc());
-  }
-}
-
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    setBkpts @2
-    runToBkpt @1
-    # modified version of redefineClass function
-    vers=2
-    abs_class=MyAbstractClass
-    cmd redefine $pkgDot$abs_class $tmpFileDir/vers$vers/$abs_class.class
-    cp $tmpFileDir/$classname.java.$vers \
-        $tmpFileDir/$classname.java
-    # end modified version of redefineClass function
-
-    # this will continue to the second breakpoint
-    cmd 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
-
-debuggeeFailIfNotPresent 'This is call 4 to checkFunc'
-debuggeeFailIfNotPresent 'This is call 5 to checkFunc'
-debuggeeFailIfNotPresent 'This is call 6 to checkFunc'
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineAddPrivateMethod.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,78 @@
+/*
+ * 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
+ * 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 8149743
+ * @summary crash when adding a breakpoint after redefining to add a private static method
+ * @comment converted from test/jdk/com/sun/jdi/RedefineAddPrivateMethod.sh
+ *
+ * @library /test/lib
+ * @compile -g RedefineAddPrivateMethod.java
+ * @run main/othervm RedefineAddPrivateMethod
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+class RedefineAddPrivateMethodTarg {
+    static public void main(String[] args) {
+        System.out.println("@1 breakpoint");
+        System.out.println("@2 breakpoint");
+    }
+
+    // @1 uncomment private static void test() {}
+}
+
+public class RedefineAddPrivateMethod extends JdbTest {
+    public static void main(String argv[]) {
+        new RedefineAddPrivateMethod().run();
+    }
+
+    private RedefineAddPrivateMethod() {
+        super(DEBUGGEE_CLASS, SOURCE_FILE);
+    }
+
+    private static final String DEBUGGEE_CLASS = RedefineAddPrivateMethodTarg.class.getName();
+    private static final String SOURCE_FILE = "RedefineAddPrivateMethod.java";
+
+    @Override
+    protected void runCases() {
+        setBreakpoints(1);
+        jdb.command(JdbCommand.run());
+
+        redefineClass(1, "-g");
+        // ensure "test()" method has been added successfully
+        execCommand(JdbCommand.eval(DEBUGGEE_CLASS + ".test()"))
+                .shouldNotContain("ParseException");
+
+        setBreakpoints(2);
+        jdb.command(JdbCommand.run());
+
+        jdb.quit();
+
+        new OutputAnalyzer(getDebuggeeOutput())
+                .shouldNotContain("Internal exception:");
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineAddPrivateMethod.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-#  @test
-#  @bug 8149743
-#  @summary crash when adding a breakpoint after redefining to add a private static method
-#  @run shell RedefineAddPrivateMethod.sh
-
-compileOptions=-g
-
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-public class $1 {
-    static public void main(String[] args) {
-        System.out.println("@1 breakpoint");
-        System.out.println("@2 breakpoint");
-    }
-
-    // @1 uncomment private static void test() {}
-}
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    runToBkpt @1
-    redefineClass @1
-    setBkpts @2
-    runToBkpt @2
-    cmd exitJdb
-}
-
-
-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
-debuggeeFailIfPresent "Internal exception:"
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineAnnotation.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,231 @@
+/*
+ * 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
+ * @bug 5002251 6407335 6412391
+ * @summary Redefine a class that has an annotation and verify that the
+ * new annotation is returned.
+ * @comment converted from test/jdk/com/sun/jdi/RedefineAnnotation.sh
+ *
+ * @library /test/lib
+ * @compile -g RedefineAnnotation.java
+ * @run main/othervm RedefineAnnotation
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+import java.lang.annotation.*;
+import java.lang.reflect.*;
+
+@Foo(Constants.class_annotation)  // @1 commentout
+// @1 uncomment @Foo(Constants.new_class_annotation)
+class RedefineAnnotationTarg {
+    @Foo(Constants.field_annotation)  // @1 commentout
+    // @1 uncomment @Foo(Constants.new_field_annotation)
+    public int dummy_field;
+
+    public static void main(String[] args) {
+        MySubClass sub = new MySubClass();
+        MySubSubClass subsub = new MySubSubClass();
+        new RedefineAnnotationTarg().hi(false);
+        new RedefineAnnotationTarg().hi(true);  // @1 breakpoint
+        sub.hi(true);
+        subsub.hi(true);
+    }
+
+    @Foo(Constants.method_annotation)  // @1 commentout
+    // @1 uncomment @Foo(Constants.new_method_annotation)
+    public void hi(
+    @Foo(Constants.method_parameter_annotation)  // @1 commentout
+    // @1 uncomment @Foo(Constants.new_method_parameter_annotation)
+                   boolean isNewVersion) {
+
+        if (isNewVersion) {
+            System.out.println("Checking for NEW versions of annotations in "
+                + getClass());
+        }
+
+        // class annotations check:
+        Foo foo = getClass().getAnnotation(Foo.class);
+        if (foo == null) {
+          throw new Error("FAIL: cannot get class_annotation from "
+                        + getClass());
+        }
+
+        String class_annotation = foo.value();
+        System.out.println("class annotation is: " + class_annotation);
+        if (isNewVersion) {
+            if (class_annotation.equals(Constants.new_class_annotation)) {
+                System.out.println("PASS: class_annotation was changed.");
+            } else {
+                System.out.println("FAIL: class_annotation was NOT changed.");
+            }
+        }
+
+        // field annotations check:
+        try {
+            Field my_field = getClass().getField("dummy_field");
+            foo = my_field.getAnnotation(Foo.class);
+            if (foo == null) {
+              throw new Error("FAIL: cannot get field_annotation from "
+                            + getClass() + ".dummy_field");
+            }
+            String field_annotation = foo.value();
+            System.out.println("field annotation is: " + field_annotation);
+            if (isNewVersion) {
+                if (field_annotation.equals(Constants.new_field_annotation)) {
+                    System.out.println("PASS: field_annotation was changed.");
+                } else {
+                    System.out.println(
+                        "FAIL: field_annotation was NOT changed.");
+                }
+        }
+        } catch (NoSuchFieldException nsfe) {
+            throw new Error("FAIL: cannot find field 'dummy_field' in "
+                          + getClass());
+        }
+
+        // method annotations check:
+        try {
+            Class params[] = new Class[1];
+            params[0] = Boolean.TYPE;
+            Method my_method = getClass().getMethod("hi", params);
+            foo = my_method.getAnnotation(Foo.class);
+            if (foo == null) {
+              throw new Error("FAIL: cannot get field_annotation from "
+                            + getClass() + ".hi()");
+            }
+            String method_annotation = foo.value();
+            System.out.println("method annotation is: " + method_annotation);
+            if (isNewVersion) {
+                if (method_annotation.equals(Constants.new_method_annotation)) {
+                    System.out.println("PASS: method_annotation was changed.");
+                } else {
+                    System.out.println(
+                        "FAIL: method_annotation was NOT changed.");
+                }
+            }
+        } catch (NoSuchMethodException nsme) {
+            throw new Error("FAIL: cannot find method 'hi' in " + getClass());
+        }
+
+        // method parameter annotations check:
+        try {
+            Class params[] = new Class[1];
+            params[0] = Boolean.TYPE;
+            Method my_method = getClass().getMethod("hi", params);
+            Annotation my_annotations[][] = my_method.getParameterAnnotations();
+            if (my_annotations.length != 1) {
+                throw new Error("FAIL: unexpected my_annotations.length ("
+                              + my_annotations.length);
+            }
+            Annotation my_annotation[] = my_annotations[0];
+            if (my_annotation.length != 1) {
+                throw new Error("FAIL: unexpected my_annotation.length ("
+                              + my_annotation.length);
+            }
+            foo = (Foo)my_annotation[0];
+            String method_parameter_annotation = foo.value();
+            System.out.println("method parameter annotation is: "
+                + method_parameter_annotation);
+            if (isNewVersion) {
+                if (method_parameter_annotation.equals(
+                    Constants.new_method_parameter_annotation)) {
+                    System.out.println(
+                        "PASS: method_parameter_annotation was changed.");
+                } else {
+                    System.out.println(
+                        "FAIL: method_parameter_annotation was NOT changed.");
+                }
+            }
+        } catch (NoSuchMethodException nsme) {
+            throw new Error("FAIL: cannot find method 'hi' in " + getClass());
+        }
+    }
+}
+
+// this subclass exists just to make the RedefineClasses() code do a
+// subclass walk to update the counter
+class MySubClass extends RedefineAnnotationTarg {
+    int my_int_field_makes_me_different;
+}
+
+// this subclass exists just to make the RedefineClasses() code do a
+// sub-subclass walk to update the counter
+class MySubSubClass extends MySubClass {
+    float my_float_field_makes_me_different;
+}
+
+class Constants {
+    static final String class_annotation     = "Patrick's class comment";
+    static final String new_class_annotation = "*NEW* Patrick's class comment";
+
+    static final String field_annotation     = "dummy_field comment";
+    static final String new_field_annotation = "*NEW* dummy_field comment";
+
+    static final String method_annotation     = "method hi() comment";
+    static final String new_method_annotation = "*NEW* method hi() comment";
+
+    static final String method_parameter_annotation     =
+        "param isNewVersion comment";
+    static final String new_method_parameter_annotation =
+        "*NEW* param isNewVersion comment";
+}
+
+
+/**
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Inherited
+@interface Foo {
+    String value();
+}
+
+public class RedefineAnnotation extends JdbTest {
+
+    public static void main(String argv[]) {
+        new RedefineAnnotation().run();
+    }
+
+    private RedefineAnnotation() {
+        super(DEBUGGEE_CLASS, SOURCE_FILE);
+    }
+
+    private static final String DEBUGGEE_CLASS = RedefineAnnotationTarg.class.getName();
+    private static final String SOURCE_FILE = "RedefineAnnotation.java";
+
+    @Override
+    protected void runCases() {
+        setBreakpoints(1);
+        jdb.command(JdbCommand.run());
+
+        redefineClass(1, "-g");
+        jdb.contToExit(1);
+
+        new OutputAnalyzer(getDebuggeeOutput())
+                .shouldNotContain("FAIL:");
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineAnnotation.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2006, 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 5002251 6407335 6412391
-#  @summary Redefine a class that has an annotation and verify that the
-#    new annotation is returned.
-#
-#  @key intermittent
-#  @run shell RedefineAnnotation.sh
-
-compileOptions=-g
-
-# Uncomment this to see the JDI trace
-#jdbOptions=-dbgtrace
-
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-
-import java.lang.annotation.*;
-import java.lang.reflect.*;
-
-/**
- */
-@Foo(Constants.class_annotation)  // @1 commentout
-// @1 uncomment @Foo(Constants.new_class_annotation)
-public class $1 {
-@Foo(Constants.field_annotation)  // @1 commentout
-// @1 uncomment @Foo(Constants.new_field_annotation)
-    public int dummy_field;
-
-    public static void main(String[] args) {
-        MySubClass sub = new MySubClass();
-        MySubSubClass subsub = new MySubSubClass();
-        new $1().hi(false);
-        new $1().hi(true);  // @1 breakpoint
-        sub.hi(true);
-        subsub.hi(true);
-    }
-
-@Foo(Constants.method_annotation)  // @1 commentout
-// @1 uncomment @Foo(Constants.new_method_annotation)
-    public void hi(
-@Foo(Constants.method_parameter_annotation)  // @1 commentout
-// @1 uncomment @Foo(Constants.new_method_parameter_annotation)
-                   boolean isNewVersion) {
-
-        if (isNewVersion) {
-            System.out.println("Checking for NEW versions of annotations in "
-                + getClass());
-        }
-
-        // class annotations check:
-        Foo foo = getClass().getAnnotation(Foo.class);
-        if (foo == null) {
-          throw new Error("FAIL: cannot get class_annotation from "
-                        + getClass());
-        }
-
-        String class_annotation = foo.value();
-        System.out.println("class annotation is: " + class_annotation);
-        if (isNewVersion) {
-            if (class_annotation.equals(Constants.new_class_annotation)) {
-                System.out.println("PASS: class_annotation was changed.");
-            } else {
-                System.out.println("FAIL: class_annotation was NOT changed.");
-            }
-        }
-    
-        // field annotations check:
-        try {
-            Field my_field = getClass().getField("dummy_field");
-            foo = my_field.getAnnotation(Foo.class);
-            if (foo == null) {
-              throw new Error("FAIL: cannot get field_annotation from "
-                            + getClass() + ".dummy_field");
-            }
-            String field_annotation = foo.value();
-            System.out.println("field annotation is: " + field_annotation);
-            if (isNewVersion) {
-                if (field_annotation.equals(Constants.new_field_annotation)) {
-                    System.out.println("PASS: field_annotation was changed.");
-                } else {
-                    System.out.println(
-                        "FAIL: field_annotation was NOT changed.");
-                }
-        }
-        } catch (NoSuchFieldException nsfe) {
-            throw new Error("FAIL: cannot find field 'dummy_field' in "
-                          + getClass());
-        }
-    
-        // method annotations check:
-        try {
-            Class params[] = new Class[1];
-            params[0] = Boolean.TYPE;
-            Method my_method = getClass().getMethod("hi", params);
-            foo = my_method.getAnnotation(Foo.class);
-            if (foo == null) {
-              throw new Error("FAIL: cannot get field_annotation from "
-                            + getClass() + ".hi()");
-            }
-            String method_annotation = foo.value();
-            System.out.println("method annotation is: " + method_annotation);
-            if (isNewVersion) {
-                if (method_annotation.equals(Constants.new_method_annotation)) {
-                    System.out.println("PASS: method_annotation was changed.");
-                } else {
-                    System.out.println(
-                        "FAIL: method_annotation was NOT changed.");
-                }
-            }
-        } catch (NoSuchMethodException nsme) {
-            throw new Error("FAIL: cannot find method 'hi' in " + getClass());
-        }
-    
-        // method parameter annotations check:
-        try {
-            Class params[] = new Class[1];
-            params[0] = Boolean.TYPE;
-            Method my_method = getClass().getMethod("hi", params);
-            Annotation my_annotations[][] = my_method.getParameterAnnotations();
-            if (my_annotations.length != 1) {
-                throw new Error("FAIL: unexpected my_annotations.length ("
-                              + my_annotations.length);
-            }
-            Annotation my_annotation[] = my_annotations[0];
-            if (my_annotation.length != 1) {
-                throw new Error("FAIL: unexpected my_annotation.length ("
-                              + my_annotation.length);
-            }
-            foo = (Foo)my_annotation[0];
-            String method_parameter_annotation = foo.value();
-            System.out.println("method parameter annotation is: "
-                + method_parameter_annotation);
-            if (isNewVersion) {
-                if (method_parameter_annotation.equals(
-                    Constants.new_method_parameter_annotation)) {
-                    System.out.println(
-                        "PASS: method_parameter_annotation was changed.");
-                } else {
-                    System.out.println(
-                        "FAIL: method_parameter_annotation was NOT changed.");
-                }
-            }
-        } catch (NoSuchMethodException nsme) {
-            throw new Error("FAIL: cannot find method 'hi' in " + getClass());
-        }
-    }
-}
-
-// this subclass exists just to make the RedefineClasses() code do a
-// subclass walk to update the counter
-class MySubClass extends $1 {
-  int my_int_field_makes_me_different;
-}
-
-// this subclass exists just to make the RedefineClasses() code do a
-// sub-subclass walk to update the counter
-class MySubSubClass extends MySubClass {
-  float my_float_field_makes_me_different;
-}
-
-class Constants {
-    static final String class_annotation     = "Patrick's class comment";
-    static final String new_class_annotation = "*NEW* Patrick's class comment";
-
-    static final String field_annotation     = "dummy_field comment";
-    static final String new_field_annotation = "*NEW* dummy_field comment";
-
-    static final String method_annotation     = "method hi() comment";
-    static final String new_method_annotation = "*NEW* method hi() comment";
-
-    static final String method_parameter_annotation     =
-        "param isNewVersion comment";
-    static final String new_method_parameter_annotation =
-        "*NEW* param isNewVersion comment";
-}
-
-
-/**
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Inherited
-@interface Foo {
-    String value();
-}
-
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    runToBkpt @1
-    redefineClass @1
-    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
-
-debuggeeFailIfPresent 'FAIL:'
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineChangeClassOrder.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,135 @@
+/*
+ * 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
+ * @bug 6270982
+ * @summary Redefine a class so that the order of external classes in
+ *          the constant pool are changed.
+ * @comment converted from test/jdk/com/sun/jdi/RedefineChangeClassOrder.sh
+ *
+ * @library /test/lib
+ * @compile -g RedefineChangeClassOrder.java
+ * @run main/othervm RedefineChangeClassOrder
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+class RedefineChangeClassOrderTarg {
+    public static void main(String[] args) {
+        new RedefineChangeClassOrderTarg().hi(false);
+        new RedefineChangeClassOrderTarg().hi(true);  // @1 breakpoint
+    }
+
+    public void hi(boolean expected) {
+        boolean isNewVersion = false; // @1 commentout
+        // @1 uncomment boolean isNewVersion = true;
+
+        if (expected == isNewVersion) {
+            System.out.println("PASS: expected and isNewVersion match.");
+        } else {
+            System.out.println("FAIL: expected and isNewVersion do not match.");
+            System.out.println("expected=" + expected
+              + "  isNewVersion=" + isNewVersion);
+        }
+
+        Foo1 foo1 = new Foo1();  // @1 commentout
+        foo1.hi();  // @1 commentout
+
+        // This Hack code block exists to force some verification_type_info
+        // objects of subtype Object_variable_info into the StackMapTable.
+        //
+        // In the redefined code, the above Foo1 code is effectively
+        // moved after the Foo2 code below which causes things to be
+        // layed out in a different order in the constant pool. The
+        // cpool_index in the Object_variable_info has to be updated
+        // in the redefined code's StackMapTable to refer to right
+        /// constant pool index in the merged constant pool.
+        Hack hack = getClass().getAnnotation(Hack.class);
+        if (hack != null) {
+            String class_annotation = hack.value();
+            System.out.println("class annotation is: " + class_annotation);
+            if (isNewVersion) {
+                if (class_annotation.equals("JUNK")) {
+                    System.out.println("class_annotation is JUNK.");
+                } else {
+                    System.out.println("class_annotation is NOT JUNK.");
+                }
+            }
+        }
+
+        Foo2 foo2 = new Foo2();
+        foo2.hi();
+
+        // @1 uncomment Foo1 foo1 = new Foo1();
+        // @1 uncomment foo1.hi();
+    }
+}
+
+class Foo1 {
+    public void hi() {
+        System.out.println("Hello from " + getClass());
+    }
+}
+
+class Foo2 {
+    public void hi() {
+        System.out.println("Hello from " + getClass());
+    }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Hack {
+    String value();
+}
+
+
+public class RedefineChangeClassOrder extends JdbTest {
+
+    public static void main(String argv[]) {
+        new RedefineChangeClassOrder().run();
+    }
+
+    private RedefineChangeClassOrder() {
+        super(DEBUGGEE_CLASS, SOURCE_FILE);
+    }
+
+    private static final String DEBUGGEE_CLASS = RedefineChangeClassOrderTarg.class.getName();
+    private static final String SOURCE_FILE = "RedefineChangeClassOrder.java";
+
+    @Override
+    protected void runCases() {
+        setBreakpoints(1);
+        jdb.command(JdbCommand.run());
+        redefineClass(1, "-g");
+        jdb.contToExit(1);
+
+        new OutputAnalyzer(getDebuggeeOutput())
+                .shouldNotContain("FAIL:");
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineChangeClassOrder.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2006, 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 6270982
-#  @summary Redefine a class so that the order of external classes in
-#  the constant pool are changed.
-#  @author dcubed
-#
-#  @run shell RedefineChangeClassOrder.sh
-
-compileOptions=-g
-
-# Would like to run this test with this option:
-# -XX:-FailOverToOldVerifier
-
-# Uncomment this to see the JDI trace
-#jdbOptions=-dbgtrace
-
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-public class $1 {
-    public static void main(String[] args) {
-        new $1().hi(false);
-        new $1().hi(true);  // @1 breakpoint
-    }
-
-    public void hi(boolean expected) {
-        boolean isNewVersion = false; // @1 commentout
-        // @1 uncomment boolean isNewVersion = true;
-
-        if (expected == isNewVersion) {
-            System.out.println("PASS: expected and isNewVersion match.");
-        } else {
-            System.out.println("FAIL: expected and isNewVersion do not match.");
-            System.out.println("expected=" + expected
-              + "  isNewVersion=" + isNewVersion);
-        }
-
-        Foo1 foo1 = new Foo1();  // @1 commentout
-        foo1.hi();  // @1 commentout
-
-        // This Hack code block exists to force some verification_type_info
-        // objects of subtype Object_variable_info into the StackMapTable.
-        //
-        // In the redefined code, the above Foo1 code is effectively
-        // moved after the Foo2 code below which causes things to be
-        // layed out in a different order in the constant pool. The
-        // cpool_index in the Object_variable_info has to be updated
-        // in the redefined code's StackMapTable to refer to right
-        /// constant pool index in the merged constant pool.
-        Hack hack = getClass().getAnnotation(Hack.class);
-        if (hack != null) {
-            String class_annotation = hack.value();
-            System.out.println("class annotation is: " + class_annotation);
-            if (isNewVersion) {
-                if (class_annotation.equals("JUNK")) {
-                    System.out.println("class_annotation is JUNK.");
-                } else {
-                    System.out.println("class_annotation is NOT JUNK.");
-                }
-            }
-        }
-
-        Foo2 foo2 = new Foo2();
-        foo2.hi();
-
-        // @1 uncomment Foo1 foo1 = new Foo1();
-        // @1 uncomment foo1.hi();
-    }
-}
-
-class Foo1 {
-    public void hi() {
-        System.out.println("Hello from " + getClass());
-    }
-}
-
-class Foo2 {
-    public void hi() {
-        System.out.println("Hello from " + getClass());
-    }
-}
-
-@Retention(RetentionPolicy.RUNTIME)
-@interface Hack {
-    String value();
-}
-
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    runToBkpt @1
-    redefineClass @1
-    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
-
-debuggeeFailIfPresent 'FAIL:'
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineClasses.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,146 @@
+/*
+ * 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 4628760
+ * @summary RedefineClasses gets assertion: "Should be a method entry in cpcache!"
+ * @comment converted from test/jdk/com/sun/jdi/RedefineClasses.sh
+ *
+ * @library /test/lib
+ * @run main/othervm RedefineClasses
+ */
+
+/* On windows, with b90, this gets this:
+ * assert(u2_at_bcp >= 0 && u2_at_bcp < old_cache->length(), "Bad cpcache index!")
+ *
+ * Error happened during: VM_RedefineClasses
+ *
+ * Error ID: D:/jdk1.4/hotspot\src\share\vm\prims\jvmdi_hotswap.cpp, 331
+
+ * On solaris, and on windows with 4559100 fixed, this test fails with:
+ *
+ * HotSpot Virtual Machine Error, assertion failure
+ * Please report this error at
+ * http://java.sun.com/cgi-bin/bugreport.cgi
+ *
+ * Java VM: Java HotSpot(TM) Client VM (1.4-internal-debug mixed mode)
+ *
+ * assert(old_cache->entry_at(u2_at_bcp)->is_method_entry(), "Should be a method entry in cpcache!")
+ *
+ * Error happened during: VM_RedefineClasses
+ *
+ * Error ID: M:\ws\m\b2\service_hs_baseline\src\share\vm\prims\jvmdi_hotswap.cpp, 335
+ */
+
+/*
+ * With -Xcomp on solaris this passes, but takes 2 minutes.
+ */
+
+import lib.jdb.ClassTransformer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+import java.lang.Thread;
+import java.util.HashMap;
+import javax.swing.*;
+import java.util.*;
+
+class RedefineClassesTarg {
+    int xxx = 20;
+    //ThreadGroup k = new ThreadGroup("group");
+    int i;
+
+    public RedefineClassesTarg() {
+    }
+
+    public void a1() {
+    a2();
+    }
+
+    public void a2() {
+    a3();
+    }
+
+    public void a3() {
+        System.out.println("out from a3");   // @1 breakpoint
+        //System.out.println("hello world"); // @ 1 delete this isn't even necesary
+    }
+    public void a4() {
+        System.out.println("in a4");
+        int i = 2;
+        int j = 3333;
+        System.out.println("i + j = " + (i + j));
+        System.out.println("out from a4");
+        System.out.println("def");
+        a1();
+    }
+
+    public void aa() {
+        a4();
+        System.out.println("out from aa");
+    }
+
+
+    public static void main(String[] args) {
+        byte xyz[] = new byte[] { 'a', 'b', 'c' };
+
+        int x1 = 100;
+        x1 = 101;
+        x1 = 102;
+        x1 = 103;
+        String m1 = "def";
+        String m2 = "abc";
+        String m3 = "def";
+
+        int[] m = new int[] { 100, 200, 300 };
+
+        RedefineClassesTarg untitled31 = new RedefineClassesTarg();
+        untitled31.aa();
+    }
+}
+
+public class RedefineClasses extends JdbTest {
+
+    public static void main(String argv[]) {
+        new RedefineClasses().run();
+    }
+
+    private RedefineClasses() {
+        super(DEBUGGEE_CLASS, SOURCE_FILE);
+    }
+
+    private static final String DEBUGGEE_CLASS = RedefineClassesTarg.class.getName();
+    private static final String SOURCE_FILE = "RedefineClasses.java";
+
+    @Override
+    protected void runCases() {
+        setBreakpoints(1);
+        jdb.command(JdbCommand.run());
+        String transformedClassFile = ClassTransformer.fromTestSource(SOURCE_FILE)
+                .transform(1, DEBUGGEE_CLASS);
+        jdb.command(JdbCommand.redefine(DEBUGGEE_CLASS, transformedClassFile));
+        jdb.command(JdbCommand.redefine(DEBUGGEE_CLASS, transformedClassFile));
+        jdb.command(JdbCommand.redefine(DEBUGGEE_CLASS, transformedClassFile));
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineClasses.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,159 +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 4628760
-#  @summary RedefineClasses gets assertion: "Should be a method entry in cpcache!"
-#  @author jjh
-#
-#  @run shell/timeout=180 RedefineClasses.sh
-
-# On windows, with b90, this gets this:
-# assert(u2_at_bcp >= 0 && u2_at_bcp < old_cache->length(), "Bad cpcache index!")
-#
-# Error happened during: VM_RedefineClasses
-#
-# Error ID: D:/jdk1.4/hotspot\src\share\vm\prims\jvmdi_hotswap.cpp, 331
-
-# On solaris, and on windows with 4559100 fixed, this test fails with:
-#
-# HotSpot Virtual Machine Error, assertion failure
-# Please report this error at
-# http://java.sun.com/cgi-bin/bugreport.cgi
-#
-# Java VM: Java HotSpot(TM) Client VM (1.4-internal-debug mixed mode)
-#
-# assert(old_cache->entry_at(u2_at_bcp)->is_method_entry(), "Should be a method entry in cpcache!")
-#
-# Error happened during: VM_RedefineClasses
-#
-# Error ID: M:\ws\m\b2\service_hs_baseline\src\share\vm\prims\jvmdi_hotswap.cpp, 335
-
-
-# With -Xcomp on solaris this passes, but takes 2 minutes, thus the /timeout above.
-
-# These are variables that can be set to control execution
-
-java=java
-
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-
-
-import java.lang.Thread;
-import java.util.HashMap;
-import javax.swing.*;
-import java.util.*;
-
-
-public class $1 {
-  int xxx = 20;
-  //ThreadGroup k = new ThreadGroup("group");
-  int i;
-
-  public $1() {
-  }
-
-  public void a1() {
-      a2();
-  }
-
-  public void a2() {
-    a3();
-  }
-
-  public void a3() {
-     System.out.println("out from a3");   // @1 breakpoint
-     //System.out.println("hello world"); // @ 1 delete this isn't even necesary
-  }
-  public void a4() {
-    System.out.println("in a4");
-    int i = 2;
-    int j = 3333;
-    System.out.println("i + j = " + (i + j));
-    System.out.println("out from a4");
-    System.out.println("def");
-    a1();
-  }
-
-  public void aa() {
-    a4();
-    System.out.println("out from aa");
-  }
-
-
-  public static void main(String[] args) {
-    byte xyz[] = new byte[] { 'a', 'b', 'c' };
-
-    int x1 = 100;
-    x1 = 101;
-    x1 = 102;
-    x1 = 103;
-    String m1 = "def";
-    String m2 = "abc";
-    String m3 = "def";
-
-    int[] m = new int[] { 100, 200, 300 };
-
-    $1 untitled31 = new $1();
-    untitled31.aa();
-  }
-}
-
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    runToBkpt
-    cmd redefine $classname $tmpFileDir/$classname.class
-    cmd redefine $classname $tmpFileDir/$classname.class
-    cmd redefine $classname $tmpFileDir/$classname.class
-}
-
-
-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
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineClearBreakpoint.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,99 @@
+/*
+ * 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 4705330
+ * @summary Netbeans Fix and Continue crashes JVM
+ * @comment converted from test/jdk/com/sun/jdi/RedefineClearBreakpoint.sh
+ *
+ * @library /test/lib
+ * @compile -g RedefineClearBreakpoint.java
+ * @run main/othervm RedefineClearBreakpoint
+ */
+
+/*
+ * The failure occurs after a breakpoint is set and then cleared
+ * after a class redefinition, in a method that was EMCP.
+ * This sequence creates a state in which subsequent operations
+ * such as accessing local vars via JVMDI, can cause a hotspot crash.
+ */
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+import java.util.List;
+
+class RedefineClearBreakpointTarg {
+
+    public RedefineClearBreakpointTarg() {
+        int a=23;
+        a=m(a);
+    }
+    public int m(int b){
+        int bb=89;
+        System.out.println("RedefineClearBreakpointTarg -  constructor" + b); //@1 breakpoint
+        return b*b;
+    }
+
+    public static void main(java.lang.String[] args) {
+        new RedefineClearBreakpointTarg();
+        int jj = 0;   //@1 delete
+    }
+
+}
+
+
+public class RedefineClearBreakpoint extends JdbTest {
+
+    public static void main(String argv[]) {
+        new RedefineClearBreakpoint().run();
+    }
+
+    private RedefineClearBreakpoint() {
+        super(DEBUGGEE_CLASS, SOURCE_FILE);
+    }
+
+    private static final String DEBUGGEE_CLASS = RedefineClearBreakpointTarg.class.getName();
+    private static final String SOURCE_FILE = "RedefineClearBreakpoint.java";
+
+    @Override
+    protected void runCases() {
+        List<Integer> bps = parseBreakpoints(getTestSourcePath(SOURCE_FILE), 1);
+        Asserts.assertEquals(bps.size(), 1, "unexpected breakpoint count");
+        jdb.command(JdbCommand.stopAt(DEBUGGEE_CLASS, bps.get(0)));
+        jdb.command(JdbCommand.run());
+        redefineClass(1, "-g");
+
+        jdb.command(JdbCommand.stopAt(DEBUGGEE_CLASS, bps.get(0)));
+        jdb.command(JdbCommand.next());     // This is needed to make the crash happen at the 'locals' cmd
+
+        jdb.command(JdbCommand.clear(DEBUGGEE_CLASS, bps.get(0)));
+        jdb.command(JdbCommand.locals());   // The crash happens here
+
+        new OutputAnalyzer(getDebuggeeOutput())
+                .shouldNotContain("Internal exception:");
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineClearBreakpoint.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +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.
-#
-
-#  @test
-#  @bug 4705330
-#  @summary Netbeans Fix and Continue crashes JVM
-#  @author Jim Holmlund/Swamy Venkataramanappa
-#  @key intermittent
-#  @run shell RedefineClearBreakpoint.sh
-
-#  The failure occurs after a bkpt is set and then cleared
-#  after a class redefinition, in a method that was EMCP.
-#  This sequence creates a state in which subsequent operations
-#  such as accessing local vars via JVMDI, can cause a hotspot crash.
-
-# These are variables that can be set to control execution
-
-compileOptions=-g
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-
-public class $1 {
-        
-        public $1() {
-            int a=23;
-            a=m(a);
-            
-        }
-        public int m(int b){
-            int bb=89;
-            System.out.println("$1 -  constructor" + b); //@1 breakpoint
-            return b*b;
-        }
-        
-        public static void main(java.lang.String[] args) {
-            new $1();        
-            int jj = 0;   //@1 delete
-        }
-            
-}
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    runToBkpt @1
-    redefineClass @1
-    #cmd clear    NOTE this shows that jdb thinks the bpt is still set :-(
-    setBkpts @1
-    cmd next     # This is needed to make the crash happen at the 'locals' cmd
-    cmd clear shtest:11
-    cmd locals   # The crash happens here.
-    #where
-}
-
-
-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
-debuggeeFailIfPresent "Internal exception:"
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineG.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,106 @@
+/*
+ * 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 4777868
+ * @summary Compile with java -g, do a RedefineClasses, and you don't get local vars
+ * @comment converted from test/jdk/com/sun/jdi/Redefine-g.sh
+ *
+ * @library /test/lib
+ * @compile RedefineG.java
+ * @run main/othervm RedefineG
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+
+// Compile the first version without -g and the 2nd version with -g.
+class RedefineGTarg {
+    public RedefineGTarg() {
+    }
+    public static void main(String[] args){
+        int gus=22;
+        RedefineGTarg kk=new RedefineGTarg();
+        kk.m1("ab");
+      }
+
+    void m1(String p1) {
+        int m1l1 = 1;
+        System.out.println("m1(String) called");
+        m1(p1, "2nd");
+        // @1 uncomment System.out.println("Hello Milpitas!");
+    }
+
+    void m1(String p1, String p2) {
+        int m1l2 = 2;
+        System.out.println("m2" + p1 + p2);  // @1 breakpoint
+    }
+
+}
+
+public class RedefineG extends JdbTest {
+    public static void main(String argv[]) {
+        new RedefineG().run();
+    }
+
+    private RedefineG() {
+        super(DEBUGGEE_CLASS,
+                "RedefineG.java");
+    }
+
+    private static final String DEBUGGEE_CLASS = RedefineGTarg.class.getName();
+
+    @Override
+    protected void runCases() {
+        setBreakpoints(1);
+        jdb.command(JdbCommand.run());
+        jdb.command(JdbCommand.where(""));
+        jdb.command(JdbCommand.locals());
+
+        redefineClass(1, "-g");
+        jdb.command(JdbCommand.where(""));
+        jdb.command(JdbCommand.locals());
+
+        jdb.command(JdbCommand.pop());
+        jdb.command(JdbCommand.where(""));
+        jdb.command(JdbCommand.locals());
+
+        jdb.command(JdbCommand.pop());
+        jdb.command(JdbCommand.where(""));
+        jdb.command(JdbCommand.locals());
+
+        jdb.contToExit(1);
+
+        new OutputAnalyzer(getJdbOutput())
+                .shouldContain("p1 = \"ab\"")
+                .shouldContain("p2 = \"2nd\"")
+                .shouldContain("m1l2 = 2")
+                .shouldNotContain("m1l1")
+                .shouldContain("args = instance of java.lang.String")
+                .shouldContain("gus = 22")
+                .shouldContain("kk = instance of " + DEBUGGEE_CLASS);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/RedefineImplementor.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,82 @@
+/*
+ * 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
+ * @bug 6173560
+ * @summary Redefine a class that implements an interface
+ *          and verify that a subclass calls the right method.
+ * @comment converted from test/jdk/com/sun/jdi/RedefineImplementor.sh
+ *
+ * @library /test/lib
+ * @compile -g RedefineImplementor.java
+ * @run main/othervm RedefineImplementor
+ */
+
+import jdk.test.lib.process.OutputAnalyzer;
+import lib.jdb.JdbCommand;
+import lib.jdb.JdbTest;
+
+class RedefineImplementorTarg implements Runnable {
+    public void run() {
+        System.out.println("RedefineImplementorTarg's run");
+        // @1 uncomment System.out.println("This is the new version of RedefineImplementorTarg");
+    }
+
+    public static void main(String[] args) {
+        Runnable r = new B();
+        B.func(r);
+        B.func(r);  // @1 breakpoint
+    }
+
+}
+
+class B extends RedefineImplementorTarg {
+    static void func(Runnable r) {
+        r.run();
+    }
+}
+
+public class RedefineImplementor extends JdbTest {
+    public static void main(String argv[]) {
+        new RedefineImplementor().run();
+    }
+
+    private RedefineImplementor() {
+        super(RedefineImplementorTarg.class.getName(),
+                "RedefineImplementor.java");
+    }
+
+    @Override
+    protected void runCases() {
+        setBreakpoints(1);
+        jdb.command(JdbCommand.run());
+
+        redefineClass(1, "-g");
+
+        jdb.contToExit(1);
+
+        new OutputAnalyzer(getDebuggeeOutput())
+                .shouldContain("This is the new version of ");
+    }
+}
--- a/test/jdk/com/sun/jdi/RedefineImplementor.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-#!/bin/sh
-
-#
-# Copyright (c) 2006, 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 6173560
-#  @summary Redefine a class that implements an interface
-#    and verify that a subclass calls the right method.
-#
-#
-#  @run shell RedefineImplementor.sh
-
-compileOptions=-g
-
-# Uncomment this to see the JDI trace
-#jdbOptions=-dbgtrace
-
-createJavaFile()
-{
-    cat <<EOF > $1.java.1
-
-public class $1 implements Runnable {
-    public void run() {
-        System.out.println("$1's run");
-        // @1 uncomment System.out.println("This is the new version of $1");
-    }
-
-    public static void main(String[] args) {
-        Runnable r = new B();
-        B.func(r);
-        B.func(r);  // @1 breakpoint
-    }
-
-}
-
-class B extends $1 {
-    static void func(Runnable r) {
-        r.run();
-    }
-}
-
-EOF
-}
-
-# This is called to feed cmds to jdb.
-dojdbCmds()
-{
-    setBkpts @1
-    runToBkpt @1
-    redefineClass @1
-    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
-
-debuggeeFailIfNotPresent 'This is the new version of '
-pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jdi/lib/jdb/ClassTransformer.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,163 @@
+/*
+ * 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 lib.jdb;
+
+import jdk.test.lib.compiler.CompilerUtils;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.MessageFormat;
+import java.util.Arrays;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+
+// ClassTransformer provides functionality to transform java source and compile it.
+// We cannot use InMemoryJavaCompiler as test files usually contain 2 classes (the test itself and debuggee)
+// and InMemoryJavaCompiler cannot compile them.
+public class ClassTransformer {
+
+    private final List<String> lines;
+    private String fileName;
+    private String workDir = "ver{0}";
+    private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+    private ClassTransformer(List<String> lines) {
+        this.lines = lines;
+    }
+
+    public ClassTransformer setFileName(String fileName) {
+        this.fileName = fileName;
+        return this;
+    }
+
+    // workDir is a MessageFormat pattern, id (int) is an {0} arg of the pattern.
+    // can be relative (relatively "scratch" dir) or absolute.
+    public ClassTransformer setWorkDir(String dir) {
+        workDir = dir;
+        return this;
+    }
+
+    public static ClassTransformer fromString(String content) {
+        return new ClassTransformer(Arrays.asList(content.split("\\R")));
+    }
+
+    public static ClassTransformer fromFile(Path filePath) {
+        try {
+            return new ClassTransformer(Files.readAllLines(filePath))
+                    .setFileName(filePath.getFileName().toString());
+        } catch (IOException e) {
+            throw new RuntimeException("failed to read " + filePath, e);
+        }
+    }
+    public static ClassTransformer fromFile(String filePath) {
+        return fromFile(Paths.get(filePath));
+    }
+
+    public static ClassTransformer fromTestSource(String fileName) {
+        return fromFile(Paths.get(System.getProperty("test.src")).resolve(fileName));
+    }
+
+    // returns path to the .class file of the transformed class
+    public String transform(int id, String className, String... compilerOptions) {
+        Path subdir = Paths.get(".").resolve(MessageFormat.format(workDir, id));
+        Path transformedSrc = subdir.resolve(fileName);
+        try {
+            Files.createDirectories(subdir);
+            Files.write(transformedSrc, transform(id).getBytes());
+        } catch (IOException e) {
+            throw new RuntimeException("failed to write transformed " + transformedSrc, e);
+        }
+        try {
+            // need to add extra classpath args
+            List<String> args = new LinkedList<>(Arrays.asList(compilerOptions));
+            args.add("-cp");
+            args.add(System.getProperty("java.class.path"));
+            CompilerUtils.compile(subdir, subdir, false, args.toArray(new String[args.size()]));
+        } catch (IOException e) {
+            throw new RuntimeException("failed to compile " + transformedSrc, e);
+        }
+        return subdir.resolve(className + ".class").toString();
+    }
+
+    /*
+    * To do RedefineClasses operations, embed @1 tags in the .java
+    * file to tell this script how to modify it to produce the 2nd
+    * version of the .class file to be used in the redefine operation.
+    * Here are examples of each editing tag and what change
+    * it causes in the new file.  Note that blanks are not preserved
+    * in these editing operations.
+    *
+    * @1 uncomment
+    *  orig:   // @1 uncomment   gus = 89;
+    *  new:         gus = 89;
+    *
+    * @1 commentout
+    *  orig:   gus = 89      // @1 commentout
+    *  new: // gus = 89      // @1 commentout
+    *
+    * @1 delete
+    *  orig:  gus = 89      // @1 delete
+    *  new:   entire line deleted
+    *
+    * @1 newline
+    *  orig:  gus = 89;     // @1 newline gus++;
+    *  new:   gus = 89;     //
+    *         gus++;
+    *
+    * @1 replace
+    *  orig:  gus = 89;     // @1 replace gus = 90;
+    *  new:   gus = 90;
+    */
+    public String transform(int id) {
+        Pattern delete = Pattern.compile("@" + id + " *delete");
+        Pattern uncomment = Pattern.compile("// *@" + id + " *uncomment (.*)");
+        Pattern commentout = Pattern.compile(".* @" + id + " *commentout");
+        Pattern newline = Pattern.compile("(.*) @" + id + " *newline (.*)");
+        Pattern replace = Pattern.compile("@" + id + " *replace (.*)");
+        return lines.stream()
+                .filter(s -> !delete.matcher(s).find())     // @1 delete
+                .map(s -> {
+                    Matcher m = uncomment.matcher(s);       // @1 uncomment
+                    return m.find() ? m.group(1) : s;
+                })
+                .map(s-> {
+                    Matcher m = commentout.matcher(s);      // @1 commentout
+                    return m.find() ? "//" + s : s;
+                })
+                .map(s -> {
+                    Matcher m = newline.matcher(s);         // @1 newline
+                    return m.find() ? m.group(1) + LINE_SEPARATOR + m.group(2) : s;
+                })
+                .map(s -> {
+                    Matcher m = replace.matcher(s);         // @1 replace
+                    return m.find() ? m.group(1) : s;
+                })
+                .collect(Collectors.joining(LINE_SEPARATOR));
+    }
+
+}
--- a/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java	Tue Sep 18 16:41:24 2018 -0700
@@ -149,6 +149,11 @@
         return new JdbCommand("stop in " + targetClass + "." + methodName);
     }
 
+    // clear <class id>:<line>   -- clear a breakpoint at a line
+    public static JdbCommand clear(String targetClass, int lineNum) {
+        return new JdbCommand("clear " + targetClass + ":" + lineNum);
+    }
+
     // exception type used by catch/ignore
     public enum ExType{
         uncaught,
@@ -239,4 +244,12 @@
     public static JdbCommand watch(String classId, String fieldName) {
         return new JdbCommand("watch " + classId + "." + fieldName);
     }
+
+    public static JdbCommand pop() {
+        return new JdbCommand("pop");
+    }
+
+    public static JdbCommand redefine(String classId, String classFileName) {
+        return new JdbCommand("redefine " + classId + " " + classFileName);
+    }
 }
--- a/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -44,6 +44,7 @@
     public static class LaunchOptions {
         public final String debuggeeClass;
         public final List<String> debuggeeOptions = new LinkedList<>();
+        public String sourceFilename;
 
         public LaunchOptions(String debuggeeClass) {
             this.debuggeeClass = debuggeeClass;
@@ -56,21 +57,28 @@
             debuggeeOptions.addAll(Arrays.asList(options));
             return this;
         }
+        public LaunchOptions setSourceFilename(String name) {
+            sourceFilename = name;
+            return this;
+        }
     }
 
     public JdbTest(LaunchOptions launchOptions) {
-        this.launchOptions= launchOptions;
-        debuggeeClass = launchOptions.debuggeeClass;
+        this.launchOptions = launchOptions;
     }
     public JdbTest(String debuggeeClass) {
         this(new LaunchOptions(debuggeeClass));
     }
 
+    // sourceFilename is used by setBreakpoints and redefineClass
+    public JdbTest(String debuggeeClass, String sourceFilename) {
+        this(new LaunchOptions(debuggeeClass).setSourceFilename(sourceFilename));
+    }
+
     protected Jdb jdb;
     protected Process debuggee;
     private final List<String> debuggeeOutput = new LinkedList<>();
     private final LaunchOptions launchOptions;
-    protected final String debuggeeClass;   // shortland for launchOptions.debuggeeClass
 
     // returns the whole jdb output as a string
     public String getJdbOutput() {
@@ -201,7 +209,39 @@
     // from the file from test source directory.
     // returns number of the breakpoints set.
     protected int setBreakpointsFromTestSource(String debuggeeFileName, int id) {
-        return setBreakpoints(jdb, debuggeeClass, System.getProperty("test.src") + "/" + debuggeeFileName, id);
+        return setBreakpoints(jdb, launchOptions.debuggeeClass,
+                              getTestSourcePath(debuggeeFileName), id);
+    }
+
+    // sets breakpoints in the class {@code launchOptions.debuggeeClass}
+    // to the lines parsed by {@code parseBreakpoints}
+    // from the file from test source directory specified by {@code launchOptions.sourceFilename}.
+    // returns number of the breakpoints set.
+    protected int setBreakpoints(int id) {
+        verifySourceFilename();
+        return setBreakpointsFromTestSource(launchOptions.sourceFilename, id);
+    }
+
+    // transforms class with the specified id (see {@code ClassTransformer})
+    // and executes "redefine" jdb command for {@code launchOptions.debuggeeClass}.
+    // returns reply for the command.
+    protected List<String> redefineClass(int id, String... compilerOptions) {
+        verifySourceFilename();
+        String transformedClassFile = ClassTransformer.fromTestSource(launchOptions.sourceFilename)
+                .transform(id, launchOptions.debuggeeClass, compilerOptions);
+        return jdb.command(JdbCommand.redefine(launchOptions.debuggeeClass, transformedClassFile));
+    }
+
+    // gets full test source path for the given test filename
+    protected static String getTestSourcePath(String fileName) {
+        return Paths.get(System.getProperty("test.src")).resolve(fileName).toString();
+    }
+
+    // verifies that sourceFilename is specified in ctor
+    private void verifySourceFilename() {
+        if (launchOptions.sourceFilename == null) {
+            throw new RuntimeException("launchOptions.sourceFilename must be specified.");
+        }
     }
 
     protected OutputAnalyzer execCommand(JdbCommand cmd) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/com/sun/jndi/ldap/DisconnectNPETest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,193 @@
+/*
+ * 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 javax.naming.Context;
+import javax.naming.NamingException;
+import javax.naming.directory.DirContext;
+import javax.naming.directory.InitialDirContext;
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.Hashtable;
+
+/*
+ * @test
+ * @bug 8205330
+ * @summary Test that If a connection has already been established and then
+ *          the LDAP directory server sends an (unsolicited)
+ *          "Notice of Disconnection", make sure client handle it correctly,
+ *          no NPE been thrown.
+ * @run main/othervm DisconnectNPETest
+ */
+
+public class DisconnectNPETest {
+    // Normally the NPE bug should be hit less than 100 times run, but just in
+    // case, we set repeat count to 1000 here.
+    private static final int REPEAT_COUNT = 1000;
+
+    public static void main(String[] args) throws IOException {
+        new DisconnectNPETest().run();
+    }
+
+    private ServerSocket serverSocket;
+    private Hashtable<Object, Object> env;
+    private TestLDAPServer server;
+
+    private void initRes() throws IOException {
+        serverSocket = new ServerSocket(0, 0, InetAddress.getLoopbackAddress());
+        server = new TestLDAPServer();
+        server.start();
+    }
+
+    private void initTest() {
+        env = new Hashtable<>();
+        env.put(Context.INITIAL_CONTEXT_FACTORY,
+                "com.sun.jndi.ldap.LdapCtxFactory");
+        env.put(Context.PROVIDER_URL, String.format("ldap://%s:%d/",
+                InetAddress.getLoopbackAddress().getHostName(),
+                serverSocket.getLocalPort()));
+        env.put(Context.SECURITY_AUTHENTICATION, "simple");
+        env.put(Context.SECURITY_PRINCIPAL,
+                "cn=8205330,ou=Client6,ou=Vendor1,o=IMC,c=US");
+        env.put(Context.SECURITY_CREDENTIALS, "secret123");
+    }
+
+    private void run() throws IOException {
+        initRes();
+        initTest();
+        int count = 0;
+        try {
+            while (count < REPEAT_COUNT) {
+                count++;
+                InitialDirContext context = null;
+                try {
+                    context = new InitialDirContext(env);
+                } catch (NamingException ne) {
+                    System.out.println("(" + count + "/" + REPEAT_COUNT
+                            + ") It's ok to get NamingException: " + ne);
+                    // for debug
+                    ne.printStackTrace(System.out);
+                } finally {
+                    cleanupContext(context);
+                }
+            }
+        } finally {
+            System.out.println("Test count: " + count + "/" + REPEAT_COUNT);
+            cleanupTest();
+        }
+    }
+
+    private void cleanupTest() {
+        if (server != null) {
+            server.stopServer();
+        }
+        cleanupClosableRes(serverSocket);
+    }
+
+    private void cleanupContext(DirContext context) {
+        if (context != null) {
+            try {
+                context.close();
+            } catch (NamingException e) {
+                // ignore
+            }
+        }
+    }
+
+    private static void cleanupClosableRes(Closeable res) {
+        if (res != null) {
+            try {
+                res.close();
+            } catch (Exception e) {
+                // ignore
+            }
+        }
+    }
+
+    class TestLDAPServer extends Thread {
+        private volatile boolean isRunning;
+
+        TestLDAPServer() {
+            isRunning = true;
+        }
+
+        private void stopServer() {
+            isRunning = false;
+        }
+
+        @Override
+        public void run() {
+            try {
+                while (isRunning) {
+                    Socket clientSocket = serverSocket.accept();
+                    Thread handler = new Thread(
+                            new LDAPServerHandler(clientSocket));
+                    handler.start();
+                }
+            } catch (IOException e) {
+                if (isRunning) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
+
+    static class LDAPServerHandler implements Runnable {
+        // "Notice of Disconnection" message
+        private static final byte[] DISCONNECT_MSG = { 0x30, 0x4C, 0x02, 0x01,
+                0x00, 0x78, 0x47, 0x0A, 0x01, 0x34, 0x04, 0x00, 0x04, 0x28,
+                0x55, 0x4E, 0x41, 0x56, 0x41, 0x49, 0x4C, 0x41, 0x42, 0x4C,
+                0x45, 0x3A, 0x20, 0x54, 0x68, 0x65, 0x20, 0x73, 0x65, 0x72,
+                0x76, 0x65, 0x72, 0x20, 0x77, 0x69, 0x6C, 0x6C, 0x20, 0x64,
+                0x69, 0x73, 0x63, 0x6F, 0x6E, 0x6E, 0x65, 0x63, 0x74, 0x21,
+                (byte) 0x8A, 0x16, 0x31, 0x2E, 0x33, 0x2E, 0x36, 0x2E, 0x31,
+                0x2E, 0x34, 0x2E, 0x31, 0x2E, 0x31, 0x34, 0x36, 0x36, 0x2E,
+                0x32, 0x30, 0x30, 0x33, 0x36 };
+        private static final byte[] BIND_RESPONSE = { 0x30, 0x0C, 0x02, 0x01,
+                0x01, 0x61, 0x07, 0x0A, 0x01, 0x00, 0x04, 0x00, 0x04, 0x00 };
+        private final Socket clientSocket;
+
+        private LDAPServerHandler(final Socket clientSocket) {
+            this.clientSocket = clientSocket;
+        }
+
+        @Override
+        public void run() {
+            try (clientSocket;
+                    OutputStream out = clientSocket.getOutputStream();
+                    InputStream in = clientSocket.getInputStream()) {
+                if (in.read() > 0) {
+                    in.skip(in.available());
+                    out.write(BIND_RESPONSE);
+                    out.write(DISCONNECT_MSG);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+}
--- a/test/jdk/com/sun/tools/attach/RunnerUtil.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/tools/attach/RunnerUtil.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
 
 import jdk.test.lib.thread.ProcessThread;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * Utility functions for test runners.
--- a/test/jdk/com/sun/tools/attach/StartManagementAgent.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/com/sun/tools/attach/StartManagementAgent.java	Tue Sep 18 16:41:24 2018 -0700
@@ -34,19 +34,18 @@
 import javax.management.remote.JMXConnectorFactory;
 
 import jdk.test.lib.thread.ProcessThread;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * @test
  * @summary Test for VirtualMachine.startManagementAgent and VirtualMachine.startLocalManagementAgent
  *
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
  *          jdk.attach
  *          jdk.jartool/sun.tools.jar
  *
- * @run build jdk.testlibrary.* Application SimpleProvider jdk.testlibrary.*
+ * @run build Application SimpleProvider
  * @run main/timeout=300 StartManagementAgent
  */
 
--- a/test/jdk/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -27,12 +27,12 @@
   @bug 8071668
   @summary Check whether clipboard see changes from external process after taking ownership
   @author Anton Nashatyrev: area=datatransfer
-  @library /lib/testlibrary
-  @build jdk.testlibrary.Utils
+  @library /test/lib
+  @build jdk.test.lib.Utils
   @run main ClipboardInterVMTest
 */
 
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 import java.awt.*;
 import java.awt.datatransfer.*;
--- a/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,7 +27,8 @@
  * @summary Call Class.forName() on the system classloader from a class loaded
  *          from a custom classloader.
  * @library /lib/testlibrary
- * @build jdk.testlibrary.Utils JarUtils
+ * @library /test/lib
+ * @build jdk.test.lib.Utils JarUtils
  * @build ClassForName ClassForNameLeak
  * @run main/othervm/policy=test.policy -Djava.security.manager ClassForNameLeak
  */
@@ -48,7 +49,7 @@
 import java.util.concurrent.Future;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * Create .jar, load ClassForName from .jar using a URLClassLoader
--- a/test/jdk/java/lang/ClassLoader/getResource/GetResource.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/ClassLoader/getResource/GetResource.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,7 +24,6 @@
 /*
  * @test
  * @bug 6760902
- * @library /lib/testlibrary
  * @library /test/lib
  * @build jdk.test.lib.process.ProcessTools
  * @run testng GetResource
@@ -45,7 +44,7 @@
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.JDKToolFinder;
 import static jdk.test.lib.process.ProcessTools.*;
 
 import org.testng.annotations.BeforeTest;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/Object/WaitTooLong.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * 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 8210787
+ * @summary Object.wait(long, int) throws inappropriate IllegalArgumentException
+ */
+
+public class WaitTooLong {
+    public static void main(String[] args) {
+        test(0);
+        test(1);
+        test(500000);
+        test(999999);
+    }
+
+    static void test(int nanos) {
+        try {
+            WaitTooLong.class.wait(Long.MAX_VALUE, nanos);
+        } catch (IllegalMonitorStateException expected) {
+        } catch (IllegalArgumentException | InterruptedException unexpected) {
+            throw new RuntimeException("Unexpected", unexpected);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/String/AlignIndent.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,201 @@
+/*
+ * 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
+ * @summary Unit tests for String#align and String#indent
+ * @run main AlignIndent
+ */
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+public class AlignIndent {
+    static final List<String> ENDS = List.of("", "\n", "   \n", "\n\n", "\n\n\n");
+    static final List<String> MIDDLES = List.of(
+            "",
+            "xyz",
+            "   xyz",
+            "      xyz",
+            "xyz   ",
+            "   xyz   ",
+            "      xyz   ",
+            "xyz\u2022",
+            "   xyz\u2022",
+            "xyz\u2022   ",
+            "   xyz\u2022   ",
+            "   // comment"
+    );
+
+    public static void main(String[] args) {
+        test1();
+        test2();
+        test3();
+    }
+
+    /*
+     * Test String#align() functionality.
+     */
+    static void test1() {
+        for (String prefix : ENDS) {
+            for (String suffix : ENDS) {
+                for (String middle : MIDDLES) {
+                    {
+                        String input = prefix + "   abc   \n" + middle + "\n   def   \n" + suffix;
+                        String output = input.align();
+
+                        String[] inLines = input.split("\\R");
+                        String[] outLines = output.split("\\R");
+
+                        String[] inLinesBody = getBody(inLines);
+
+                        if (inLinesBody.length < outLines.length) {
+                            report("String::align()", "Result has more lines than expected", input, output);
+                        } else if (inLinesBody.length > outLines.length) {
+                            report("String::align()", "Result has fewer lines than expected", input, output);
+                        }
+
+                        int indent = -1;
+                        for (int i = 0; i < inLinesBody.length; i++) {
+                            String in = inLinesBody[i];
+                            String out = outLines[i];
+                            if (!out.isBlank()) {
+                                int offset = in.indexOf(out);
+                                if (offset == -1) {
+                                    report("String::align()", "Portions of line are missing", input, output);
+                                }
+                                if (indent == -1) {
+                                    indent = offset;
+                                } else if (offset != indent) {
+                                    report("String::align()",
+                                            "Inconsistent indentation in result", input, output);
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+     * Test String#align(int n) functionality.
+     */
+    static void test2() {
+        for (int adjust : new int[] {-8, -7, -4, -3, -2, -1, 0, 1, 2, 3, 4, 7, 8}) {
+            for (String prefix : ENDS) {
+                for (String suffix : ENDS) {
+                    for (String middle : MIDDLES) {
+                        {
+                            String input = prefix + "   abc   \n" + middle + "\n   def   \n" + suffix;
+                            String output = input.align(adjust);
+                            String expected = input.align().indent(adjust);
+
+                            if (!output.equals(expected)) {
+                                report("String::align(int n)",
+                                        "Result inconsistent with align().indent(n)", expected, output);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    /*
+     * Test String#indent(int n) functionality.
+     */
+    static void test3() {
+        for (int adjust : new int[] {-8, -7, -4, -3, -2, -1, 0, 1, 2, 3, 4, 7, 8}) {
+            for (String prefix : ENDS) {
+                for (String suffix : ENDS) {
+                    for (String middle : MIDDLES) {
+                        String input = prefix + "   abc   \n" + middle + "\n   def   \n" + suffix;
+                        String output = input.indent(adjust);
+
+                        Stream<String> stream = input.lines();
+                        if (adjust > 0) {
+                            final String spaces = " ".repeat(adjust);
+                            stream = stream.map(s -> s.isBlank() ? s : spaces + s);
+                        } else if (adjust < 0) {
+                            stream = stream.map(s -> s.substring(Math.min(-adjust, indexOfNonWhitespace(s))));
+                        }
+                        String expected = stream.collect(Collectors.joining("\n", "", "\n"));
+
+                        if (!output.equals(expected)) {
+                            report("String::indent(int n)",
+                                    "Result indentation not as expected", expected, output);
+                        }
+                    }
+                }
+            }
+        }
+    }
+
+    public static int indexOfNonWhitespace(String s) {
+        int left = 0;
+        while (left < s.length()) {
+            char ch = s.charAt(left);
+            if (ch != ' ' && ch != '\t' && !Character.isWhitespace(ch)) {
+                break;
+            }
+            left++;
+        }
+        return left;
+    }
+
+
+    private static String[] getBody(String[] inLines) {
+        int from = -1, to = -1;
+        for (int i = 0; i < inLines.length; i++) {
+            String line = inLines[i];
+            if (!line.isBlank()) {
+                if (from == -1) {
+                    from = i;
+                }
+                to = i + 1;
+            }
+        }
+        return Arrays.copyOfRange(inLines, from, to);
+    }
+
+    /*
+     * Report difference in result.
+     */
+    static void report(String test, String message, String input, String output) {
+        System.err.println("Testing " + test + ": " + message);
+        System.err.println();
+        System.err.println("Input: length = " + input.length());
+        System.err.println("_".repeat(40));
+        System.err.print(input.replaceAll(" ", "."));
+        System.err.println("_".repeat(40));
+        System.err.println();
+        System.err.println("Output: length = " + output.length());
+        System.err.println("_".repeat(40));
+        System.err.print(output.replaceAll(" ", "."));
+        System.err.println("_".repeat(40));
+        throw new RuntimeException();
+    }
+}
--- a/test/jdk/java/lang/System/LoggerFinder/modules/Base.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/Base.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,7 +32,7 @@
 import java.util.List;
 import java.util.stream.Stream;
 
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.compiler.CompilerUtils;
 
 import static jdk.test.lib.process.ProcessTools.executeCommand;
--- a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,8 +32,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary /test/lib
- * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @library /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm JDKLoggerForImageTest
  */
 
--- a/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,8 +32,8 @@
  *            2. clients are in named/unnamed module,
  *               patched system module, or Xbootclasspath
  *          This test DOES require existence of java.logging module
- * @library /lib/testlibrary /test/lib
- * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @library /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm JDKLoggerForJDKTest
  */
 
--- a/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,8 +32,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary /test/lib
- * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @library /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm LoggerInImageTest
  */
 
--- a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -34,8 +34,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary /test/lib
- * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @library /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm NamedLoggerForImageTest
  */
 
--- a/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -34,8 +34,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary /test/lib
- * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @library /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm NamedLoggerForJDKTest
  */
 
--- a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -34,8 +34,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary /test/lib
- * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @library /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm UnnamedLoggerForImageTest
  */
 
--- a/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -34,8 +34,8 @@
  *               patched system module, or Xbootclasspath
  *          This test does not require existence of java.logging module,
  *          but require jdk.compiler module
- * @library /lib/testlibrary /test/lib
- * @build Base jdk.test.lib.compiler.CompilerUtils jdk.testlibrary.*
+ * @library /test/lib
+ * @build Base jdk.test.lib.compiler.CompilerUtils
  * @run main/othervm UnnamedLoggerForJDKTest
  */
 
--- a/test/jdk/java/lang/Thread/ThreadStateController.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/Thread/ThreadStateController.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -28,7 +28,7 @@
 import java.util.concurrent.locks.LockSupport;
 
 import jdk.test.lib.LockFreeLogger;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /**
  * ThreadStateController allows a thread to request this thread to transition
--- a/test/jdk/java/lang/Throwable/LegacyChainedExceptionSerialization.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/Throwable/LegacyChainedExceptionSerialization.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, 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
@@ -22,10 +22,15 @@
  */
 
 import java.io.*;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.UndeclaredThrowableException;
+import java.security.PrivilegedActionException;
+import java.util.Base64;
+import java.util.Map;
 
 /**
  * @test
- * @bug     4385429 8004928
+ * @bug     4385429 8004928 8210721
  * @summary Certain legacy chained exceptions throw IllegalArgumentException
  *          upon deserialization if "causative exception" is null.
  * @author  Josh Bloch
@@ -33,18 +38,31 @@
 public class LegacyChainedExceptionSerialization {
     private static Throwable[] broken = {
         new ClassNotFoundException(),
+        new ClassNotFoundException("bar", new IOException("reading class file")),
         new ExceptionInInitializerError(),
+        new ExceptionInInitializerError(new NullPointerException("foo")),
         new java.lang.reflect.UndeclaredThrowableException(null),
+        new java.lang.reflect.UndeclaredThrowableException(new IllegalArgumentException("foo")),
         new java.lang.reflect.InvocationTargetException(null),
-        new java.security.PrivilegedActionException(null)
+        new java.lang.reflect.InvocationTargetException(new Error("goo")),
+        new java.security.PrivilegedActionException(null),
+        new java.security.PrivilegedActionException(new IOException("foo")),
     };
 
+
     public static void main(String[] args) throws Exception {
         for (int i=0; i<broken.length; i++)
             test(broken[i]);
+
+        for (Map.Entry<String, Throwable> e : SERIALIZED_DATA.entrySet()) {
+            Throwable t = deserialize(e.getKey());
+            verify(t, e.getValue());
+        }
+
+        testOverriddenGetCause();
     }
 
-    private static void test(Throwable e) throws Exception {
+    private static Throwable test(Throwable e) throws Exception {
         ByteArrayOutputStream bout = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream(bout);
         out.writeObject(e);
@@ -54,5 +72,247 @@
             new ByteArrayInputStream(bout.toByteArray());
         ObjectInputStream in = new ObjectInputStream(bin);
         Throwable clone = (Throwable) in.readObject();
+        return clone;
     }
+
+    private static void testOverriddenGetCause() throws Exception {
+        SubClass sc = new SubClass(new NullPointerException());
+        SubClass clone = (SubClass)test(sc);
+        Throwable cause = clone.getException();
+        if (!(cause instanceof NullPointerException) || cause.getMessage() != null) {
+            throw new RuntimeException("unexpected cause: " + cause);
+        }
+
+    }
+
+    private static Throwable deserialize(String ser) throws Exception {
+        Base64.Decoder decoder = Base64.getDecoder();
+        try (ByteArrayInputStream bin = new ByteArrayInputStream(decoder.decode(ser));
+             ObjectInputStream ois = new ObjectInputStream(bin)) {
+            return (Throwable)ois.readObject();
+        }
+    }
+
+    /*
+     * Verify the deserialization of the serialized data from an old version.
+     * See SERIALIZED_DATA.
+     */
+    private static void verify(Throwable t, Throwable expected) {
+        String msg = expected.getMessage();
+        Throwable cause = expected.getCause();
+        if (t.getMessage() != msg && msg != null && !msg.equals(t.getMessage())) {
+            throw new RuntimeException("unexpected message: " + t.getMessage()
+                    + " expected: " + msg);
+        }
+        Throwable e = t.getCause();
+        if (e.getClass() != cause.getClass()) {
+            throw new RuntimeException("unexpected cause: " + t.getCause());
+        }
+        String causedBy = cause.getMessage();
+        if (e.getMessage() != causedBy) {
+            if (e.getMessage() == null || causedBy == null || !causedBy.equals(e.getMessage())) {
+                throw new RuntimeException("unexpected message: " + t.getMessage()
+                    + " expected: " + causedBy);
+            }
+        }
+        Throwable exception = null;
+        if (t instanceof ExceptionInInitializerError) {
+            exception = ((ExceptionInInitializerError)t).getException();
+        } else if (t instanceof ClassNotFoundException) {
+            exception = ((ClassNotFoundException)t).getException();
+        } else if (t instanceof InvocationTargetException) {
+            exception = ((InvocationTargetException) t).getTargetException();
+        } else if (t instanceof UndeclaredThrowableException) {
+            exception = ((UndeclaredThrowableException) t).getUndeclaredThrowable();
+        } else if (t instanceof PrivilegedActionException) {
+            exception = ((PrivilegedActionException) t).getException();
+        } else {
+            // skip the cause == exception check below
+            e = null;
+        }
+        if (e != exception) {
+            throw new RuntimeException("unexpected exception: " + exception);
+        }
+    }
+
+    static class SubClass extends ExceptionInInitializerError {
+        public SubClass(Throwable t) {
+            super(t);
+        }
+        @Override
+        public Throwable getCause() {
+            return new Throwable("always new");
+        }
+    }
+
+    /*
+     * The following strings are base64-encoded serialized data generated
+     * by running the jdk10SerializeThrowable method with JDK 10 runtime.
+     *
+     *   private static void jdk10SerializeThrowable(Throwable e) throws Exception {
+     *       Base64.Encoder encoder = Base64.getEncoder();
+     *       try (ByteArrayOutputStream os = new ByteArrayOutputStream();
+     *            ObjectOutputStream out = new ObjectOutputStream(os)) {
+     *           out.writeObject(e);
+     *           out.flush();
+     *           String s = encoder.encodeToString(os.toByteArray());
+     *           for (int i=0; i < s.length();) {
+     *               int end = Math.min(i+60, s.length());
+     *               CharSequence seq = s.subSequence(i, end);
+     *               System.out.format("\"%s\" +%n", seq);
+     *               i = end;
+     *           }
+     *       }
+     *   }
+     */
+
+    private static final String EIIE_OLD_VERSION =
+        "rO0ABXNyACVqYXZhLmxhbmcuRXhjZXB0aW9uSW5Jbml0aWFsaXplckVycm9y" +
+        "FR400Amhk4ACAAFMAAlleGNlcHRpb250ABVMamF2YS9sYW5nL1Rocm93YWJs" +
+        "ZTt4cgAWamF2YS5sYW5nLkxpbmthZ2VFcnJvcjGtS1U0qEq6AgAAeHIAD2ph" +
+        "dmEubGFuZy5FcnJvckUdNlaLgg5WAgAAeHIAE2phdmEubGFuZy5UaHJvd2Fi" +
+        "bGXVxjUnOXe4ywMABEwABWNhdXNlcQB+AAFMAA1kZXRhaWxNZXNzYWdldAAS" +
+        "TGphdmEvbGFuZy9TdHJpbmc7WwAKc3RhY2tUcmFjZXQAHltMamF2YS9sYW5n" +
+        "L1N0YWNrVHJhY2VFbGVtZW50O0wAFHN1cHByZXNzZWRFeGNlcHRpb25zdAAQ" +
+        "TGphdmEvdXRpbC9MaXN0O3hwcHB1cgAeW0xqYXZhLmxhbmcuU3RhY2tUcmFj" +
+        "ZUVsZW1lbnQ7AkYqPDz9IjkCAAB4cAAAAAFzcgAbamF2YS5sYW5nLlN0YWNr" +
+        "VHJhY2VFbGVtZW50YQnFmiY23YUCAAhCAAZmb3JtYXRJAApsaW5lTnVtYmVy" +
+        "TAAPY2xhc3NMb2FkZXJOYW1lcQB+AAVMAA5kZWNsYXJpbmdDbGFzc3EAfgAF" +
+        "TAAIZmlsZU5hbWVxAH4ABUwACm1ldGhvZE5hbWVxAH4ABUwACm1vZHVsZU5h" +
+        "bWVxAH4ABUwADW1vZHVsZVZlcnNpb25xAH4ABXhwAQAAAAd0AANhcHB0AARU" +
+        "ZXN0dAAJVGVzdC5qYXZhdAAEbWFpbnBwc3IAH2phdmEudXRpbC5Db2xsZWN0" +
+        "aW9ucyRFbXB0eUxpc3R6uBe0PKee3gIAAHhweHNyAB5qYXZhLmxhbmcuTnVs" +
+        "bFBvaW50ZXJFeGNlcHRpb25HpaGO/zHhuAIAAHhyABpqYXZhLmxhbmcuUnVu" +
+        "dGltZUV4Y2VwdGlvbp5fBkcKNIPlAgAAeHIAE2phdmEubGFuZy5FeGNlcHRp" +
+        "b27Q/R8+GjscxAIAAHhxAH4ABHEAfgAWdAADZm9vdXEAfgAJAAAAAXNxAH4A" +
+        "CwEAAAAHcQB+AA1xAH4ADnEAfgAPcQB+ABBwcHEAfgASeA==";
+
+    private static final String CNFE_OLD_VERSION =
+        "rO0ABXNyACBqYXZhLmxhbmcuQ2xhc3NOb3RGb3VuZEV4Y2VwdGlvbn9azWY+" +
+        "1CCOAgABTAACZXh0ABVMamF2YS9sYW5nL1Rocm93YWJsZTt4cgAmamF2YS5s" +
+        "YW5nLlJlZmxlY3RpdmVPcGVyYXRpb25FeGNlcHRpb24AAAAAB1vNFQIAAHhy" +
+        "ABNqYXZhLmxhbmcuRXhjZXB0aW9u0P0fPho7HMQCAAB4cgATamF2YS5sYW5n" +
+        "LlRocm93YWJsZdXGNSc5d7jLAwAETAAFY2F1c2VxAH4AAUwADWRldGFpbE1l" +
+        "c3NhZ2V0ABJMamF2YS9sYW5nL1N0cmluZztbAApzdGFja1RyYWNldAAeW0xq" +
+        "YXZhL2xhbmcvU3RhY2tUcmFjZUVsZW1lbnQ7TAAUc3VwcHJlc3NlZEV4Y2Vw" +
+        "dGlvbnN0ABBMamF2YS91dGlsL0xpc3Q7eHBwdAADYmFydXIAHltMamF2YS5s" +
+        "YW5nLlN0YWNrVHJhY2VFbGVtZW50OwJGKjw8/SI5AgAAeHAAAAABc3IAG2ph" +
+        "dmEubGFuZy5TdGFja1RyYWNlRWxlbWVudGEJxZomNt2FAgAIQgAGZm9ybWF0" +
+        "SQAKbGluZU51bWJlckwAD2NsYXNzTG9hZGVyTmFtZXEAfgAFTAAOZGVjbGFy" +
+        "aW5nQ2xhc3NxAH4ABUwACGZpbGVOYW1lcQB+AAVMAAptZXRob2ROYW1lcQB+" +
+        "AAVMAAptb2R1bGVOYW1lcQB+AAVMAA1tb2R1bGVWZXJzaW9ucQB+AAV4cAEA" +
+        "AAAMdAADYXBwdAAEVGVzdHQACVRlc3QuamF2YXQABG1haW5wcHNyAB9qYXZh" +
+        "LnV0aWwuQ29sbGVjdGlvbnMkRW1wdHlMaXN0ergXtDynnt4CAAB4cHhzcgAT" +
+        "amF2YS5pby5JT0V4Y2VwdGlvbmyAc2RlJfCrAgAAeHEAfgADcQB+ABV0ABJy" +
+        "ZWFkaW5nIGNsYXNzIGZpbGV1cQB+AAoAAAABc3EAfgAMAQAAAAxxAH4ADnEA" +
+        "fgAPcQB+ABBxAH4AEXBwcQB+ABN4";
+
+    private static final String ITE1_OLD_VERSION =
+        "rO0ABXNyACtqYXZhLmxhbmcucmVmbGVjdC5JbnZvY2F0aW9uVGFyZ2V0RXhj" +
+        "ZXB0aW9uOLEmjtZxJG8CAAFMAAZ0YXJnZXR0ABVMamF2YS9sYW5nL1Rocm93" +
+        "YWJsZTt4cgAmamF2YS5sYW5nLlJlZmxlY3RpdmVPcGVyYXRpb25FeGNlcHRp" +
+        "b24AAAAAB1vNFQIAAHhyABNqYXZhLmxhbmcuRXhjZXB0aW9u0P0fPho7HMQC" +
+        "AAB4cgATamF2YS5sYW5nLlRocm93YWJsZdXGNSc5d7jLAwAETAAFY2F1c2Vx" +
+        "AH4AAUwADWRldGFpbE1lc3NhZ2V0ABJMamF2YS9sYW5nL1N0cmluZztbAApz" +
+        "dGFja1RyYWNldAAeW0xqYXZhL2xhbmcvU3RhY2tUcmFjZUVsZW1lbnQ7TAAU" +
+        "c3VwcHJlc3NlZEV4Y2VwdGlvbnN0ABBMamF2YS91dGlsL0xpc3Q7eHBwdAAD" +
+        "YmFydXIAHltMamF2YS5sYW5nLlN0YWNrVHJhY2VFbGVtZW50OwJGKjw8/SI5" +
+        "AgAAeHAAAAABc3IAG2phdmEubGFuZy5TdGFja1RyYWNlRWxlbWVudGEJxZom" +
+        "Nt2FAgAIQgAGZm9ybWF0SQAKbGluZU51bWJlckwAD2NsYXNzTG9hZGVyTmFt" +
+        "ZXEAfgAFTAAOZGVjbGFyaW5nQ2xhc3NxAH4ABUwACGZpbGVOYW1lcQB+AAVM" +
+        "AAptZXRob2ROYW1lcQB+AAVMAAptb2R1bGVOYW1lcQB+AAVMAA1tb2R1bGVW" +
+        "ZXJzaW9ucQB+AAV4cAEAAAARdAADYXBwdAAEVGVzdHQACVRlc3QuamF2YXQA" +
+        "BG1haW5wcHNyAB9qYXZhLnV0aWwuQ29sbGVjdGlvbnMkRW1wdHlMaXN0ergX" +
+        "tDynnt4CAAB4cHhzcgAPamF2YS5sYW5nLkVycm9yRR02VouCDlYCAAB4cQB+" +
+        "AARxAH4AFXQAA2Zvb3VxAH4ACgAAAAFzcQB+AAwBAAAAEXEAfgAOcQB+AA9x" +
+        "AH4AEHEAfgARcHBxAH4AE3g=";
+
+    private static final String ITE2_OLD_VERSION =
+        "rO0ABXNyACtqYXZhLmxhbmcucmVmbGVjdC5JbnZvY2F0aW9uVGFyZ2V0RXhj" +
+        "ZXB0aW9uOLEmjtZxJG8CAAFMAAZ0YXJnZXR0ABVMamF2YS9sYW5nL1Rocm93" +
+        "YWJsZTt4cgAmamF2YS5sYW5nLlJlZmxlY3RpdmVPcGVyYXRpb25FeGNlcHRp" +
+        "b24AAAAAB1vNFQIAAHhyABNqYXZhLmxhbmcuRXhjZXB0aW9u0P0fPho7HMQC" +
+        "AAB4cgATamF2YS5sYW5nLlRocm93YWJsZdXGNSc5d7jLAwAETAAFY2F1c2Vx" +
+        "AH4AAUwADWRldGFpbE1lc3NhZ2V0ABJMamF2YS9sYW5nL1N0cmluZztbAApz" +
+        "dGFja1RyYWNldAAeW0xqYXZhL2xhbmcvU3RhY2tUcmFjZUVsZW1lbnQ7TAAU" +
+        "c3VwcHJlc3NlZEV4Y2VwdGlvbnN0ABBMamF2YS91dGlsL0xpc3Q7eHBwcHVy" +
+        "AB5bTGphdmEubGFuZy5TdGFja1RyYWNlRWxlbWVudDsCRio8PP0iOQIAAHhw" +
+        "AAAAAXNyABtqYXZhLmxhbmcuU3RhY2tUcmFjZUVsZW1lbnRhCcWaJjbdhQIA" +
+        "CEIABmZvcm1hdEkACmxpbmVOdW1iZXJMAA9jbGFzc0xvYWRlck5hbWVxAH4A" +
+        "BUwADmRlY2xhcmluZ0NsYXNzcQB+AAVMAAhmaWxlTmFtZXEAfgAFTAAKbWV0" +
+        "aG9kTmFtZXEAfgAFTAAKbW9kdWxlTmFtZXEAfgAFTAANbW9kdWxlVmVyc2lv" +
+        "bnEAfgAFeHABAAAAEnQAA2FwcHQABFRlc3R0AAlUZXN0LmphdmF0AARtYWlu" +
+        "cHBzcgAfamF2YS51dGlsLkNvbGxlY3Rpb25zJEVtcHR5TGlzdHq4F7Q8p57e" +
+        "AgAAeHB4c3IAD2phdmEubGFuZy5FcnJvckUdNlaLgg5WAgAAeHEAfgAEcQB+" +
+        "ABR0AANnb291cQB+AAkAAAABc3EAfgALAQAAABJxAH4ADXEAfgAOcQB+AA9x" +
+        "AH4AEHBwcQB+ABJ4";
+
+    private static final String UTE1_OLD_VERSION =
+        "rO0ABXNyAC5qYXZhLmxhbmcucmVmbGVjdC5VbmRlY2xhcmVkVGhyb3dhYmxl" +
+        "RXhjZXB0aW9uBJTY3HP5/P8CAAFMABN1bmRlY2xhcmVkVGhyb3dhYmxldAAV" +
+        "TGphdmEvbGFuZy9UaHJvd2FibGU7eHIAGmphdmEubGFuZy5SdW50aW1lRXhj" +
+        "ZXB0aW9unl8GRwo0g+UCAAB4cgATamF2YS5sYW5nLkV4Y2VwdGlvbtD9Hz4a" +
+        "OxzEAgAAeHIAE2phdmEubGFuZy5UaHJvd2FibGXVxjUnOXe4ywMABEwABWNh" +
+        "dXNlcQB+AAFMAA1kZXRhaWxNZXNzYWdldAASTGphdmEvbGFuZy9TdHJpbmc7" +
+        "WwAKc3RhY2tUcmFjZXQAHltMamF2YS9sYW5nL1N0YWNrVHJhY2VFbGVtZW50" +
+        "O0wAFHN1cHByZXNzZWRFeGNlcHRpb25zdAAQTGphdmEvdXRpbC9MaXN0O3hw" +
+        "cHQAA2JhcnVyAB5bTGphdmEubGFuZy5TdGFja1RyYWNlRWxlbWVudDsCRio8" +
+        "PP0iOQIAAHhwAAAAAXNyABtqYXZhLmxhbmcuU3RhY2tUcmFjZUVsZW1lbnRh" +
+        "CcWaJjbdhQIACEIABmZvcm1hdEkACmxpbmVOdW1iZXJMAA9jbGFzc0xvYWRl" +
+        "ck5hbWVxAH4ABUwADmRlY2xhcmluZ0NsYXNzcQB+AAVMAAhmaWxlTmFtZXEA" +
+        "fgAFTAAKbWV0aG9kTmFtZXEAfgAFTAAKbW9kdWxlTmFtZXEAfgAFTAANbW9k" +
+        "dWxlVmVyc2lvbnEAfgAFeHABAAAAE3QAA2FwcHQABFRlc3R0AAlUZXN0Lmph" +
+        "dmF0AARtYWlucHBzcgAfamF2YS51dGlsLkNvbGxlY3Rpb25zJEVtcHR5TGlz" +
+        "dHq4F7Q8p57eAgAAeHB4c3IAImphdmEubGFuZy5JbGxlZ2FsQXJndW1lbnRF" +
+        "eGNlcHRpb261iXPTfWaPvAIAAHhxAH4AAnEAfgAVdAADZm9vdXEAfgAKAAAA" +
+        "AXNxAH4ADAEAAAATcQB+AA5xAH4AD3EAfgAQcQB+ABFwcHEAfgATeA==";
+
+    private static final String UTE2_OLD_VERSION =
+        "rO0ABXNyAC5qYXZhLmxhbmcucmVmbGVjdC5VbmRlY2xhcmVkVGhyb3dhYmxl" +
+        "RXhjZXB0aW9uBJTY3HP5/P8CAAFMABN1bmRlY2xhcmVkVGhyb3dhYmxldAAV" +
+        "TGphdmEvbGFuZy9UaHJvd2FibGU7eHIAGmphdmEubGFuZy5SdW50aW1lRXhj" +
+        "ZXB0aW9unl8GRwo0g+UCAAB4cgATamF2YS5sYW5nLkV4Y2VwdGlvbtD9Hz4a" +
+        "OxzEAgAAeHIAE2phdmEubGFuZy5UaHJvd2FibGXVxjUnOXe4ywMABEwABWNh" +
+        "dXNlcQB+AAFMAA1kZXRhaWxNZXNzYWdldAASTGphdmEvbGFuZy9TdHJpbmc7" +
+        "WwAKc3RhY2tUcmFjZXQAHltMamF2YS9sYW5nL1N0YWNrVHJhY2VFbGVtZW50" +
+        "O0wAFHN1cHByZXNzZWRFeGNlcHRpb25zdAAQTGphdmEvdXRpbC9MaXN0O3hw" +
+        "cHB1cgAeW0xqYXZhLmxhbmcuU3RhY2tUcmFjZUVsZW1lbnQ7AkYqPDz9IjkC" +
+        "AAB4cAAAAAFzcgAbamF2YS5sYW5nLlN0YWNrVHJhY2VFbGVtZW50YQnFmiY2" +
+        "3YUCAAhCAAZmb3JtYXRJAApsaW5lTnVtYmVyTAAPY2xhc3NMb2FkZXJOYW1l" +
+        "cQB+AAVMAA5kZWNsYXJpbmdDbGFzc3EAfgAFTAAIZmlsZU5hbWVxAH4ABUwA" +
+        "Cm1ldGhvZE5hbWVxAH4ABUwACm1vZHVsZU5hbWVxAH4ABUwADW1vZHVsZVZl" +
+        "cnNpb25xAH4ABXhwAQAAABR0AANhcHB0AARUZXN0dAAJVGVzdC5qYXZhdAAE" +
+        "bWFpbnBwc3IAH2phdmEudXRpbC5Db2xsZWN0aW9ucyRFbXB0eUxpc3R6uBe0" +
+        "PKee3gIAAHhweHNyACJqYXZhLmxhbmcuSWxsZWdhbEFyZ3VtZW50RXhjZXB0" +
+        "aW9utYlz031mj7wCAAB4cQB+AAJxAH4AFHQAA2dvb3VxAH4ACQAAAAFzcQB+" +
+        "AAsBAAAAFHEAfgANcQB+AA5xAH4AD3EAfgAQcHBxAH4AEng=";
+
+    private static final String PAE_OLD_VERSION =
+        "rO0ABXNyACdqYXZhLnNlY3VyaXR5LlByaXZpbGVnZWRBY3Rpb25FeGNlcHRp" +
+        "b25Bj1P2UhH1ugIAAUwACWV4Y2VwdGlvbnQAFUxqYXZhL2xhbmcvRXhjZXB0" +
+        "aW9uO3hyABNqYXZhLmxhbmcuRXhjZXB0aW9u0P0fPho7HMQCAAB4cgATamF2" +
+        "YS5sYW5nLlRocm93YWJsZdXGNSc5d7jLAwAETAAFY2F1c2V0ABVMamF2YS9s" +
+        "YW5nL1Rocm93YWJsZTtMAA1kZXRhaWxNZXNzYWdldAASTGphdmEvbGFuZy9T" +
+        "dHJpbmc7WwAKc3RhY2tUcmFjZXQAHltMamF2YS9sYW5nL1N0YWNrVHJhY2VF" +
+        "bGVtZW50O0wAFHN1cHByZXNzZWRFeGNlcHRpb25zdAAQTGphdmEvdXRpbC9M" +
+        "aXN0O3hwcHB1cgAeW0xqYXZhLmxhbmcuU3RhY2tUcmFjZUVsZW1lbnQ7AkYq" +
+        "PDz9IjkCAAB4cAAAAAFzcgAbamF2YS5sYW5nLlN0YWNrVHJhY2VFbGVtZW50" +
+        "YQnFmiY23YUCAAhCAAZmb3JtYXRJAApsaW5lTnVtYmVyTAAPY2xhc3NMb2Fk" +
+        "ZXJOYW1lcQB+AAVMAA5kZWNsYXJpbmdDbGFzc3EAfgAFTAAIZmlsZU5hbWVx" +
+        "AH4ABUwACm1ldGhvZE5hbWVxAH4ABUwACm1vZHVsZU5hbWVxAH4ABUwADW1v" +
+        "ZHVsZVZlcnNpb25xAH4ABXhwAQAAABd0AANhcHB0AARUZXN0dAAJVGVzdC5q" +
+        "YXZhdAAEbWFpbnBwc3IAH2phdmEudXRpbC5Db2xsZWN0aW9ucyRFbXB0eUxp" +
+        "c3R6uBe0PKee3gIAAHhweHNyABNqYXZhLmlvLklPRXhjZXB0aW9ubIBzZGUl" +
+        "8KsCAAB4cQB+AAJxAH4AFHQAA2Zvb3VxAH4ACQAAAAFzcQB+AAsBAAAAF3EA" +
+        "fgANcQB+AA5xAH4AD3EAfgAQcHBxAH4AEng=";
+
+    private static Map<String, Throwable> SERIALIZED_DATA = Map.of(
+        EIIE_OLD_VERSION, new ExceptionInInitializerError(new NullPointerException("foo")),
+        CNFE_OLD_VERSION, new ClassNotFoundException("bar", new IOException("reading class file")),
+        ITE1_OLD_VERSION, new InvocationTargetException(new Error("foo"), "bar"),
+        ITE2_OLD_VERSION, new InvocationTargetException(new Error("goo")),
+        UTE1_OLD_VERSION, new UndeclaredThrowableException(new IllegalArgumentException("foo"), "bar"),
+        UTE2_OLD_VERSION, new UndeclaredThrowableException(new IllegalArgumentException("goo")),
+        PAE_OLD_VERSION,  new PrivilegedActionException(new IOException("foo"))
+    );
 }
--- a/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,17 +23,16 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * @test
  * @bug 6289149
  * @summary test when the agent's class is missing the premain() function.
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
  *          java.instrument
- * @run build jdk.testlibrary.* DummyMain
+ * @run build DummyMain
  * @run shell ../MakeJAR3.sh NoPremainAgent
  * @run main/othervm -XX:-CreateCoredumpOnCrash NoPremainAgentTest
  */
--- a/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,16 +23,15 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * @test
  * @bug 5055293
  * @summary Test non ascii characters in the Premain-Class attribute.
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
- * @run build jdk.testlibrary.* DummyMain
+ * @run build DummyMain
  * @run main PremainClassTest
  */
 public class PremainClassTest {
--- a/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,17 +23,16 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * @test
  * @bug 6289149
  * @summary test when the agent's class has a zero arg premain() function.
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
  *          java.instrument
- * @run build jdk.testlibrary.* DummyMain
+ * @run build DummyMain
  * @run shell ../MakeJAR3.sh ZeroArgPremainAgent
  * @run main/othervm -XX:-CreateCoredumpOnCrash ZeroArgPremainAgentTest
  */
--- a/test/jdk/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -22,7 +22,7 @@
  */
 
 import jdk.test.lib.TimeLimitedRunner;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
 import test.java.lang.invoke.lib.Helper;
 
--- a/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -25,7 +25,7 @@
 
 import jdk.test.lib.TimeLimitedRunner;
 import jdk.testlibrary.Asserts;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import test.java.lang.invoke.lib.CodeCacheOverflowProcessor;
 import test.java.lang.invoke.lib.Helper;
 
--- a/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile MethodHandlesTest.java MethodHandlesAsCollectorTest.java remote/RemoteExample.java
  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:-VerifyDependencies
--- a/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile MethodHandlesTest.java MethodHandlesCastFailureTest.java remote/RemoteExample.java
  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:-VerifyDependencies
--- a/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile MethodHandlesTest.java MethodHandlesGeneralTest.java remote/RemoteExample.java
  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:-VerifyDependencies
--- a/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile MethodHandlesTest.java MethodHandlesInsertArgumentsTest.java remote/RemoteExample.java
  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:-VerifyDependencies
--- a/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile MethodHandlesTest.java MethodHandlesInvokersTest.java remote/RemoteExample.java
  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:-VerifyDependencies
--- a/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile MethodHandlesTest.java MethodHandlesPermuteArgumentsTest.java remote/RemoteExample.java
  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:-VerifyDependencies
--- a/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for java.lang.invoke.MethodHandles
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile MethodHandlesTest.java MethodHandlesSpreadArgumentsTest.java remote/RemoteExample.java
  * @run junit/othervm/timeout=2500 -XX:+IgnoreUnrecognizedVMOptions
  *                                 -XX:-VerifyDependencies
--- a/test/jdk/java/lang/invoke/PermuteArgsTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/PermuteArgsTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -23,7 +23,7 @@
 
 /* @test
  * @summary unit tests for method handles which permute their arguments
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-VerifyDependencies -ea -esa -DPermuteArgsTest.MAX_ARITY=8 test.java.lang.invoke.PermuteArgsTest
  */
 
--- a/test/jdk/java/lang/invoke/TestCatchExceptionWithVarargs.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/TestCatchExceptionWithVarargs.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, 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
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8019184
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @summary MethodHandles.catchException() fails when methods have 8 args + varargs
  * @run main TestCatchExceptionWithVarargs
  */
--- a/test/jdk/java/lang/invoke/VarargsArrayTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/VarargsArrayTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -34,7 +34,7 @@
  * @summary unit tests for varargs array methods: MethodHandleInfo.varargsArray(int),
  *          MethodHandleInfo.varargsArray(Class,int) & MethodHandleInfo.varargsList(int)
  * @modules java.base/sun.invoke.util
- * @library /lib/testlibrary /java/lang/invoke/common
+ * @library /test/lib /java/lang/invoke/common
  * @compile/module=java.base java/lang/invoke/MethodHandleHelper.java
  * @run main/bootclasspath VarargsArrayTest
  * @run main/bootclasspath/othervm -DVarargsArrayTest.MAX_ARITY=255 -DVarargsArrayTest.START_ARITY=250
--- a/test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -23,7 +23,7 @@
 
 package test.java.lang.invoke.lib;
 
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /**
  * Helper class used to catch and process VirtualMachineError with message "Out
@@ -36,7 +36,7 @@
     /**
      * Checks if an instance of Throwable is caused by VirtualMachineError with
      * message "Out of space in CodeCache". May be used as filter in method
-     * {@code jdk.testlibrary.Utils.filterException}.
+     * {@code jdk.test.lib.Utils.filterException}.
      *
      * @param t - Throwable to check.
      * @return true if Throwable is caused by VME, false otherwise.
--- a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,9 +32,9 @@
  * @requires vm.gc == "null"
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
- * @library /lib/testlibrary/ /test/lib
+ * @library /test/lib
  *
- * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
+ * @build LowMemoryTest MemoryUtil RunUtil
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LowMemoryTest
@@ -45,9 +45,9 @@
 import java.util.concurrent.Phaser;
 import javax.management.*;
 import javax.management.openmbean.CompositeData;
+import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolFinder;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 import sun.hotspot.code.Compiler;
 
--- a/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,10 +28,10 @@
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Arrays;
+import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.Utils;
 
 public class RunUtil {
 
--- a/test/jdk/java/net/CookieHandler/CookieManagerTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/net/CookieHandler/CookieManagerTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -31,6 +31,9 @@
  */
 
 import com.sun.net.httpserver.*;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
 import java.io.IOException;
 import java.net.*;
 import static java.net.Proxy.NO_PROXY;
@@ -160,14 +163,40 @@
         exchange.close();
     }
 
+    private static String trim(String s) {
+        StringBuilder sb = new StringBuilder();
+        for (int i=0; i<s.length(); i++) {
+            char c = s.charAt(i);
+            if (!Character.isWhitespace(c))
+                sb.append(c);
+        }
+        return sb.toString();
+    }
+
+    private static boolean cookieEquals(String s1, String s2) {
+        s1 = trim(s1);
+        s2 = trim(s2);
+        String[] s1a = s1.split(";");
+        String[] s2a = s2.split(";");
+        List<String> l1 = new LinkedList(List.of(s1a));
+        List<String> l2 = new LinkedList(List.of(s2a));
+        Collections.sort(l1);
+        Collections.sort(l2);
+        int i = 0;
+        for (String s : l1) {
+            if (!s.equals(l2.get(i++))) {
+                return false;
+            }
+        }
+        return true;
+    }
+
     private void checkRequest(Headers hdrs) {
 
         assert testDone > 0;
         String cookieHeader = hdrs.getFirst("Cookie");
-        if (cookieHeader != null &&
-            cookieHeader
-                .equalsIgnoreCase(testCases[testcaseDone][testDone-1]
-                                  .cookieToRecv))
+        if (cookieHeader != null && cookieEquals(
+                cookieHeader, testCases[testcaseDone][testDone-1].cookieToRecv))
         {
             System.out.printf("%15s %s\n", "PASSED:", cookieHeader);
         } else {
--- a/test/jdk/java/net/MulticastSocket/MultiDead.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/net/MulticastSocket/MultiDead.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -25,8 +25,7 @@
  * @test
  * @bug 8072466
  * @summary Deadlock when initializing MulticastSocket and DatagramSocket
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
+ * @library /test/lib
  * @run main/othervm MultiDead
  */
 
@@ -36,8 +35,8 @@
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.CountDownLatch;
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
 
 public class MultiDead {
     private static final int THREAD_PAIR_COUNT = 4;
--- a/test/jdk/java/net/httpclient/EchoHandler.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/net/httpclient/EchoHandler.java	Tue Sep 18 16:41:24 2018 -0700
@@ -40,6 +40,7 @@
 import java.util.logging.Logger;
 
 public class EchoHandler implements HttpHandler {
+    static final Path CWD = Paths.get(".");
     public EchoHandler() {}
 
     @Override
@@ -53,7 +54,7 @@
             map1.add("X-Hello", "world");
             map1.add("X-Bye", "universe");
             String fixedrequest = map.getFirst("XFixed");
-            File outfile = File.createTempFile("foo", "bar");
+            File outfile = Files.createTempFile(CWD, "foo", "bar").toFile();
             FileOutputStream fos = new FileOutputStream(outfile);
             int count = (int) is.transferTo(fos);
             is.close();
--- a/test/jdk/java/net/httpclient/security/Driver.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/net/httpclient/security/Driver.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,10 +25,11 @@
  * @test
  * @bug 8087112
  * @library /lib/testlibrary/
+ * @library /test/lib
  * @modules java.net.http
  *          java.logging
  *          jdk.httpserver
- * @build jdk.testlibrary.SimpleSSLContext jdk.testlibrary.Utils
+ * @build jdk.testlibrary.SimpleSSLContext jdk.test.lib.Utils
  * @compile ../../../../com/sun/net/httpserver/LogFilter.java
  * @compile ../../../../com/sun/net/httpserver/FileServerHandler.java
  * @compile ../ProxyServer.java
@@ -55,7 +56,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /**
  * Driver for tests
--- a/test/jdk/java/net/spi/URLStreamHandlerProvider/Basic.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/net/spi/URLStreamHandlerProvider/Basic.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -46,7 +46,7 @@
 import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
 import jdk.test.lib.util.FileUtils;
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.JDKToolFinder;
 import static java.lang.String.format;
 import static java.util.Arrays.asList;
 
@@ -55,10 +55,10 @@
  * @bug 8064924
  * @modules jdk.compiler
  * @summary Basic test for URLStreamHandlerProvider
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @build jdk.test.lib.Platform
  *        jdk.test.lib.util.FileUtils
- *        jdk.testlibrary.JDKToolFinder
+ *        jdk.test.lib.JDKToolFinder
  * @compile Basic.java Child.java
  * @run main Basic
  */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/whitebox/CookieTestDriver.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,29 @@
+/*
+ * 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
+ * @modules java.base/java.net
+ * @run main/othervm java.base/java.net.CookieManagerTest
+ */
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/whitebox/TEST.properties	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,3 @@
+modules = \
+    java.base/java.net
+bootclasspath.dirs=.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/whitebox/java.base/java/net/CookieManagerTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,133 @@
+/*
+ * 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 java.net;
+
+import java.net.CookieManager;
+import java.net.HttpCookie;
+import java.util.*;
+import java.util.stream.Collectors;
+
+// Whitebox Test of CookieManager.sortByPathAndAge
+
+public class CookieManagerTest
+{
+    Random r1; // random is reseeded so it is reproducible
+    long seed;
+
+    public static void main(String[] args) {
+        CookieManagerTest test = new CookieManagerTest();
+        test.run();
+    }
+
+    CookieManagerTest() {
+        r1 = new Random();
+        seed = r1.nextLong();
+        System.out.println("Random seed is: " + seed);
+        r1.setSeed(seed);
+    }
+
+    static class TestCookie {
+        String path;
+        long creationTime;
+
+        static TestCookie of(String path, long creationTime) {
+            TestCookie t = new TestCookie();
+            t.path = path;
+            t.creationTime = creationTime;
+            return t;
+        }
+    }
+
+    // The order shown below is what we expect the sort to produce
+    // longest paths first then for same length path by age (oldest first)
+    // This array is copied to a list and shuffled before being passed to
+    // the sort function several times.
+
+    TestCookie[] cookies = new TestCookie[] {
+        TestCookie.of("alpha/bravo/charlie/delta", 50),
+        TestCookie.of("alphA/Bravo/charlie/delta", 100),
+        TestCookie.of("bravo/charlie/delta", 1),
+        TestCookie.of("bravo/chArlie/delta", 2),
+        TestCookie.of("bravo/charlie/delta", 5),
+        TestCookie.of("bravo/charliE/dElta", 10),
+        TestCookie.of("charlie/delta", 1),
+        TestCookie.of("charlie/delta", 1),
+        TestCookie.of("charlie/delta", 1),
+        TestCookie.of("charlie/delta", 2),
+        TestCookie.of("charlie/delta", 2),
+        TestCookie.of("charlie/delta", 2),
+        TestCookie.of("ChaRlie/delta", 3),
+        TestCookie.of("charliE/deLta", 4),
+        TestCookie.of("cHarlie/delta", 7),
+        TestCookie.of("chaRRie/delta", 9),
+        TestCookie.of("delta", 999),
+        TestCookie.of("Delta", 1000),
+        TestCookie.of("Delta", 1000),
+        TestCookie.of("DeLta", 1001),
+        TestCookie.of("DeLta", 1002),
+        TestCookie.of("/", 2),
+        TestCookie.of("/", 3),
+        TestCookie.of("/", 300)
+    };
+
+    public void run()
+    {
+        for (int i=0; i<100; i++) {
+            List<TestCookie> l1 = new LinkedList(Arrays.asList(cookies));
+            Collections.shuffle(l1, r1);
+            List<HttpCookie> l2 = l1
+                    .stream()
+                    .map(this::createCookie)
+                    .collect(Collectors.toList());
+
+
+            // call PP method of CookieManager
+            List<String> result = CookieManager.sortByPathAndAge(l2);
+            int index = 0;
+            for (String r : result) {
+                if (!r.contains("name=\"value\""))
+                    continue;
+                // extract Path value
+                r = r.substring(r.indexOf("Path=")+6);
+                // remove trailing "
+
+                // should go from name="value";$Path="bravo/charlie/delta" ->
+                //                                    bravo/charlie/delta
+                r = r.substring(0, r.indexOf('"'));
+                if (!r.equals(cookies[index].path)) {
+                    System.err.printf("ERROR: got %s index: %d", r, index);
+                    System.err.printf(" expected: %s\n", cookies[index].path);
+                    throw new RuntimeException("Test failed");
+                }
+                index++;
+            }
+        }
+    }
+
+    private HttpCookie createCookie(TestCookie tc) {
+        HttpCookie ck = new HttpCookie("name", "value", null, tc.creationTime);
+        ck.setPath(tc.path);
+        return ck;
+    }
+}
--- a/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -25,8 +25,8 @@
  * @test
  * @bug 8137121 8137230
  * @summary (fc) Infinite loop FileChannel.truncate
- * @library /lib/testlibrary
- * @build jdk.testlibrary.Utils
+ * @library /test/lib
+ * @build jdk.test.lib.Utils
  * @run main/othervm/timeout=300 LoopingTruncate
  */
 
@@ -37,7 +37,7 @@
 import java.nio.file.Path;
 import static java.nio.file.StandardOpenOption.*;
 import java.util.concurrent.TimeUnit;
-import static jdk.testlibrary.Utils.adjustTimeout;
+import static jdk.test.lib.Utils.adjustTimeout;
 
 public class LoopingTruncate {
 
--- a/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java	Tue Sep 18 16:41:24 2018 -0700
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 8199433
+ * @bug 8199433 8208780
  * @run testng SelectWithConsumer
  * @summary Unit test for Selector select(Consumer), select(Consumer,long) and
  *          selectNow(Consumer)
@@ -62,9 +62,19 @@
         var interestOps = key.interestOps();
         var notifiedOps = new AtomicInteger();
 
+        if (expectedOps == 0) {
+            // ensure select(Consumer) does not block indefinitely
+            sel.wakeup();
+        } else {
+            // ensure that the channel is ready for all expected operations
+            sel.select();
+            while ((key.readyOps() & interestOps) != expectedOps) {
+                Thread.sleep(100);
+                sel.select();
+            }
+        }
+
         // select(Consumer)
-        if (expectedOps == 0)
-            sel.wakeup(); // ensure select does not block
         notifiedOps.set(0);
         int n = sel.select(k -> {
             assertTrue(Thread.currentThread() == callerThread);
--- a/test/jdk/java/nio/channels/Selector/Wakeup.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/nio/channels/Selector/Wakeup.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -24,7 +24,7 @@
 /* @test
  * @bug 6405995
  * @summary Unit test for selector wakeup and interruption
- * @library .. /lib/testlibrary/
+ * @library .. /test/lib
  */
 
 import java.io.*;
@@ -44,7 +44,7 @@
     }
 
     static class Sleeper extends TestThread {
-        private static final long TIMEOUT = jdk.testlibrary.Utils.adjustTimeout(20_000);
+        private static final long TIMEOUT = jdk.test.lib.Utils.adjustTimeout(20_000);
 
         // barrier is used to synchronize sleeper thread and checking
         // thread which is the main thread: when go() get to the end,
--- a/test/jdk/java/security/KeyStore/PKCS12/EntryProtectionTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/EntryProtectionTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -40,7 +40,7 @@
  * @summary Test for feature 'support stronger entry protection'. An entry is
  * stored to keystore with different PasswordProtection objects which are
  * specified by different PBE algorithms (use -Dseed=X to set PRNG seed)
- * @library /test/lib /lib/testlibrary ../
+ * @library /test/lib ../
  * @key randomness
  * @build jdk.test.lib.RandomFactory
  * @run main EntryProtectionTest
--- a/test/jdk/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java	Tue Sep 18 16:41:24 2018 -0700
@@ -36,7 +36,7 @@
  * @bug 8048830
  * @summary Test for PKCS12 keystore list , export commands. Refer README for
  * keystore files information
- * @library /lib/testlibrary ../
+ * @library ../
  * @library /test/lib
  * @run main KeytoolReaderP12Test
  */
--- a/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java	Tue Sep 18 16:41:24 2018 -0700
@@ -31,7 +31,7 @@
  * @test
  * @bug 8048830
  * @summary Tests for creating pkcs12 keystore with various algorithms
- * @library /lib/testlibrary ../
+ * @library ../
  * @library /test/lib
  * @run main KeytoolWriteP12Test
  */
--- a/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -39,7 +39,7 @@
  * @test
  * @bug 8048830
  * @summary Entry's attribute set should be empty
- * @library /lib/testlibrary ../
+ * @library ../
  * @library /test/lib
  * @run main MetadataEmptyTest
  */
--- a/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -43,7 +43,7 @@
  * @test
  * @bug 8048830
  * @summary Test store metadata attributes to PKCS12 keystore.
- * @library /lib/testlibrary ../
+ * @library ../
  * @library /test/lib
  * @run main MetadataStoreLoadTest
  */
--- a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -42,7 +42,7 @@
  * @summary Test imports certificate from file to PKCS12 keystore store it as
  * trusted certificate Check import errors (must be not errors) & check keystore
  * content after import
- * @library /lib/testlibrary ../
+ * @library ../
  * @library /test/lib
  * @run main StoreTrustedCertAPITest
  */
--- a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java	Tue Sep 18 16:41:24 2018 -0700
@@ -38,7 +38,7 @@
  * @bug 8048830
  * @summary Tests keytool command imports certificate , list keystore, print
  * certificate and import password help.
- * @library /lib/testlibrary ../
+ * @library ../
  * @library /test/lib
  * @run main StoreTrustedCertKeytool
  */
--- a/test/jdk/java/security/KeyStore/PKCS12/Utils.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/security/KeyStore/PKCS12/Utils.java	Tue Sep 18 16:41:24 2018 -0700
@@ -34,7 +34,7 @@
 import java.util.List;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.JDKToolFinder;
 import static java.lang.System.out;
 import java.util.ArrayList;
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/ServiceLoader/basic/ServiceLoaderBasicTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,162 @@
+/*
+ * 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 4640520 6354623 7198496
+ * @summary Unit test for java.util.ServiceLoader
+ * @library /lib/testlibrary /test/lib
+ * @build JarUtils jdk.test.lib.process.*
+ *        Basic Load FooService FooProvider1 FooProvider2 FooProvider3 BarProvider
+ * @run testng ServiceLoaderBasicTest
+ */
+
+
+import java.io.File;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.List;
+
+import jdk.test.lib.JDKToolFinder;
+import jdk.test.lib.Utils;
+import jdk.test.lib.process.ProcessTools;
+
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static java.nio.file.StandardOpenOption.CREATE;
+import static java.nio.file.StandardCopyOption.REPLACE_EXISTING;
+import static java.util.Arrays.asList;
+
+public class ServiceLoaderBasicTest {
+
+    private static final String METAINFO = "META-INF/services/FooService";
+    private static final Path XTEST_CONFIG = Path.of("x.test").resolve(METAINFO);
+    private static final Path XMETA_CONFIG = Path.of("x.meta").resolve(METAINFO);
+    private static final Path P2JAR = Path.of("p2.jar");
+    private static final Path P2DUPJAR = Path.of("p2dup.jar");
+    private static final Path P3JAR = Path.of("x.ext", "p3.jar");
+
+    private static final String XTEST = File.pathSeparator + "x.test";
+    private static final String XMETA = File.pathSeparator + "x.meta";
+    private static final String P2 = File.pathSeparator + P2JAR.toString();
+    private static final String P2DUP = File.pathSeparator + P2DUPJAR.toString();
+    private static final String P3 = File.pathSeparator + P3JAR.toString();
+
+    private static final String XTEST_CP = Utils.TEST_CLASS_PATH + XTEST;
+    private static final String P2_CP = Utils.TEST_CLASS_PATH + P2;
+    private static final String P2DUP_CP = P2_CP + P2DUP;
+    private static final String P3P2_CP = Utils.TEST_CLASS_PATH + P3 + P2;
+    private static final String XTESTP2_CP = XTEST_CP + P2;
+    private static final String P3XTEST_CP = Utils.TEST_CLASS_PATH + P3 + XTEST;
+    private static final String P3XTESTP2_CP = P3XTEST_CP + P2;
+    private static final String XMETA_CP = Utils.TEST_CLASS_PATH + XMETA;
+    private static final String XMETAXTEST_CP = XMETA_CP + XTEST;
+    private static final String XTESTXMETA_CP = XTEST_CP + XMETA;
+    private static final String XTESTXMETAP2_CP = XTESTXMETA_CP + P2;
+
+    @BeforeClass
+    public void initialize() throws Exception {
+        createProviderConfig(XTEST_CONFIG, "FooProvider1");
+        createProviderConfig(XMETA_CONFIG, "FooProvider42");
+        createJar(P2JAR, "FooProvider2", List.of("FooProvider2"));
+        createJar(P3JAR, "FooProvider3", List.of("FooProvider3", "FooService"));
+        Files.copy(P2JAR, P2DUPJAR, REPLACE_EXISTING);
+    }
+
+    @DataProvider
+    public Object[][] testCases() {
+        return new Object[][]{
+            //       CLI options,            Test,       Runtime arguments
+            // Success cases
+            {List.of("-cp", XTESTP2_CP,      "Basic")},
+            {List.of("-cp", XTEST_CP,        "Load",     "FooProvider1")},
+            {List.of("-cp", P2_CP,           "Load",     "FooProvider2")},
+            {List.of("-cp", P2DUP_CP,        "Load",     "FooProvider2")},
+            {List.of("-cp", P3P2_CP,         "Load",     "FooProvider3", "FooProvider2")},
+            {List.of("-cp", XTESTP2_CP,      "Load",     "FooProvider1", "FooProvider2")},
+            {List.of("-cp", P3XTEST_CP,      "Load",     "FooProvider3", "FooProvider1")},
+            {List.of("-cp", P3XTESTP2_CP,    "Load",     "FooProvider3",
+                                                         "FooProvider1",
+                                                         "FooProvider2")},
+            // Failures followed by successes
+            {List.of("-cp", XTESTXMETA_CP,   "Load",     "FooProvider1", "fail")},
+            {List.of("-cp", XMETAXTEST_CP,   "Load",     "fail", "FooProvider1")},
+            {List.of("-cp", XTESTXMETAP2_CP, "Load",     "FooProvider1", "fail", "FooProvider2")}
+        };
+    }
+
+    @DataProvider
+    public Object[][] negativeTestCases() {
+        return new Object[][]{
+            {"blah blah"},
+            {"9234"},
+            {"X!"},
+            {"BarProvider"},
+            {"FooProvider42"}
+        };
+    }
+
+    @Test(dataProvider = "testCases")
+    public void testProvider(List<String> args) throws Throwable {
+        runJava(args);
+    }
+
+    @Test(dataProvider = "negativeTestCases")
+    public void testBadProvider(String providerName) throws Throwable {
+        Files.write(XMETA_CONFIG, providerName.getBytes());
+        runJava(List.of("-cp", XMETA_CP, "Load", "fail"));
+    }
+
+    private void runJava(List<String> opts) throws Throwable {
+        List<String> cmds = new ArrayList<>();
+        cmds.add(JDKToolFinder.getJDKTool("java"));
+        cmds.addAll(asList(Utils.getTestJavaOpts()));
+        cmds.addAll(opts);
+
+        ProcessTools.executeCommand(cmds.stream()
+                    .filter(t -> !t.isEmpty())
+                    .toArray(String[]::new))
+                    .shouldHaveExitValue(0);
+    }
+
+    private void createProviderConfig(Path config, String providerName) throws Exception {
+        Files.createDirectories(config.getParent());
+        Files.write(config, providerName.getBytes(), CREATE);
+    }
+
+    private void createJar(Path jar, String provider, List<String> files) throws Exception {
+        Path xdir = Path.of(provider);
+        createProviderConfig(xdir.resolve(METAINFO), provider);
+
+        for (String f : files) {
+            Path source = Path.of(Utils.TEST_CLASSES, f + ".class");
+            Path target = xdir.resolve(source.getFileName());
+            Files.copy(source, target, REPLACE_EXISTING);
+        }
+        JarUtils.createJarFile(jar, xdir);
+    }
+
+}
--- a/test/jdk/java/util/ServiceLoader/basic/basic.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-#
-# 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
-# @bug 4640520 6354623 7198496
-# @summary Unit test for java.util.ServiceLoader
-#
-# @build Basic Load FooService FooProvider1 FooProvider2 FooProvider3 BarProvider
-# @run shell basic.sh
-
-# Command-line usage: sh basic.sh /path/to/build
-
-if [ -z "$TESTJAVA" ]; then
-  if [ $# -lt 1 ]; then exit 1; fi
-  TESTJAVA="$1"; shift
-  COMPILEJAVA="${TESTJAVA}"
-  TESTSRC="`pwd`"
-  TESTCLASSES="`pwd`"
-fi
-
-JAVA="$TESTJAVA/bin/java"
-JAR="$COMPILEJAVA/bin/jar"
-
-OS=`uname -s`
-case "$OS" in
-    SunOS | Darwin | AIX )
-      FS='/'
-      SEP=':' ;;
-    Linux )
-      FS='/'
-      SEP=':' ;;
-    * )
-      FS='\\'
-      SEP='\;' ;;
-esac
-
-JARD=x.jar
-EXTD=x.ext
-TESTD=x.test
-P3JAR=${EXTD}${FS}p3.jar
-
-if [ \! -d $EXTD ]; then
-    # Initialize
-    echo Initializing...
-    rm -rf $JARD $EXTD $TESTD
-    mkdir -p $JARD $EXTD $TESTD
-
-    for n in 2 3; do
-      rm -rf $JARD/*; mkdir -p $JARD/META-INF/services
-      echo FooProvider$n \
-        >$JARD/META-INF/services/FooService
-      cp $TESTCLASSES/FooProvider$n.class $JARD
-      if [ $n = 3 ]; then
-        cp $TESTCLASSES/FooService.class $JARD
-      fi
-      (cd $JARD; "$JAR" ${TESTTOOLVMOPTS} -cf ../p$n.jar *)
-    done
-
-    cp p2.jar p2dup.jar
-    mv p3.jar $EXTD
-
-    cp $TESTCLASSES/Load.class $TESTD
-    cp $TESTCLASSES/FooService.class $TESTD
-    cp $TESTCLASSES/FooProvider1.class $TESTD
-    mkdir -p $TESTD/META-INF/services
-    echo FooProvider1 \
-      >$TESTD/META-INF/services/FooService
-
-    # This gives us:
-    #   $TESTD: FooProvider1
-    #   .     : FooProvider2, in p2.jar
-    #   $EXTD:  FooProvider3, in p3.jar
-
-fi
-
-failures=0
-
-go() {
-  echo ''
-  cp="$1"; shift
-  if [ -z "$cp" ]; then cp="$TESTCLASSES"; else cp="$TESTCLASSES$SEP$cp"; fi
-  vmargs="$1"; shift
-  sh -xc "'$JAVA' ${TESTVMOPTS} -cp $cp $vmargs $T $*" 2>&1
-  if [ $? != 0 ]; then failures=`expr $failures + 1`; fi
-}
-
-
-# Java-level tests
-
-T=Basic
-go ".${SEP}$TESTD${SEP}p2.jar" ""
-
-# Success cases
-
-T=Load
-
-go "$TESTD" "" FooProvider1
-
-go ".${SEP}p2.jar" "" FooProvider2
-
-go ".${SEP}p2.jar${SEP}p2dup.jar" "" FooProvider2
-
-go "${P3JAR}${SEP}p2.jar" "" FooProvider3 FooProvider2
-
-go "$TESTD${SEP}p2.jar" "" FooProvider1 FooProvider2
-
-go "${P3JAR}${SEP}$TESTD" "" FooProvider3 FooProvider1
-
-go "${P3JAR}${SEP}$TESTD${SEP}p2.jar" "" \
-  FooProvider3 FooProvider1 FooProvider2
-
-# Failure cases
-
-mkdir -p x.meta/META-INF/services
-
-# Simple failures
-for p in FooProvider42 'blah blah' 9234 'X!' BarProvider; do
-  echo $p >x.meta/META-INF/services/FooService
-  go ".${SEP}x.meta" "" fail
-done
-
-# Failures followed by successes
-echo FooProvider42 >x.meta/META-INF/services/FooService
-go "$TESTD${SEP}x.meta" "" FooProvider1 fail
-go "x.meta${SEP}$TESTD" "" fail FooProvider1
-go "$TESTD${SEP}x.meta${SEP}${SEP}p2.jar" "" \
-  FooProvider1 fail FooProvider2
-
-
-# Summary
-
-echo ''
-if [ $failures -gt 0 ];
-  then echo "$failures case(s) failed";
-  else echo "All cases passed"; fi
-exit $failures
--- a/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -21,9 +21,9 @@
  * questions.
  */
 
-/*
+ /*
  * @test
- * @bug 8005471 8008577 8129881 8130845 8136518 8181157
+ * @bug 8005471 8008577 8129881 8130845 8136518 8181157 8210490
  * @modules jdk.localedata
  * @run main/othervm -Djava.locale.providers=CLDR CLDRDisplayNamesTest
  * @summary Make sure that localized time zone names of CLDR are used
@@ -51,7 +51,7 @@
             "\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u590f\u6642\u9593",
             "GMT-07:00",
             //"\u30a2\u30e1\u30ea\u30ab\u592a\u5e73\u6d0b\u6642\u9593",
-            //"PT"
+        //"PT"
         },
         {
             "zh-CN",
@@ -60,7 +60,7 @@
             "\u5317\u7f8e\u592a\u5e73\u6d0b\u590f\u4ee4\u65f6\u95f4",
             "GMT-07:00",
             //"\u5317\u7f8e\u592a\u5e73\u6d0b\u65f6\u95f4",
-            //"PT",
+        //"PT",
         },
         {
             "de-DE",
@@ -69,7 +69,7 @@
             "Nordamerikanische Westk\u00fcsten-Sommerzeit",
             "GMT-07:00",
             //"Nordamerikanische Westk\u00fcstenzeit",
-            //"PT",
+        //"PT",
         },
     };
 
@@ -86,7 +86,7 @@
                 String name = tz.getDisplayName(daylight, style, locale);
                 if (!data[i].equals(name)) {
                     System.err.printf("error: got '%s' expected '%s' (style=%d, daylight=%s, locale=%s)%n",
-                                      name, data[i], style, daylight, locale);
+                            name, data[i], style, daylight, locale);
                     errors++;
                 }
             }
@@ -117,6 +117,17 @@
             Locale.setDefault(originalLocale);
         }
 
+        // for 8210490
+        // Check that TimeZone.getDisplayName should honor passed locale parameter,
+        // even if default locale is set to some other locale.
+        Locale.setDefault(Locale.forLanguageTag("ar-PK"));
+        TimeZone zi = TimeZone.getTimeZone("Etc/GMT-5");
+        String displayName = zi.getDisplayName(false, TimeZone.SHORT, Locale.US);
+        Locale.setDefault(originalLocale);
+        if (!displayName.equals("GMT+05:00")) {
+            System.err.printf("Wrong display name for timezone Etc/GMT-5 : expected GMT+05:00,  Actual " + displayName);
+            errors++;
+        }
         if (errors > 0) {
             throw new RuntimeException("test failed");
         }
--- a/test/jdk/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary Checks for responsiveness of blocking queues to cancellation.
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -56,7 +56,7 @@
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class CancelledProducerConsumerLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/BlockingQueue/Interrupt.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/BlockingQueue/Interrupt.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2014, 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
@@ -26,7 +26,7 @@
  * @bug 6384064
  * @summary Check proper handling of interrupts
  * @author Martin Buchholz
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -41,7 +41,7 @@
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.Executor;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class Interrupt {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary  multiple producers and single consumer using blocking queues
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -52,7 +52,7 @@
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.atomic.AtomicInteger;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class MultipleProducersSingleConsumerLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary  multiple producers and consumers using blocking queues
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -52,7 +52,7 @@
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.atomic.AtomicInteger;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class ProducerConsumerLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary  check ordering for blocking queues with 1 producer and multiple consumers
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -51,7 +51,7 @@
 import java.util.concurrent.LinkedTransferQueue;
 import java.util.concurrent.PriorityBlockingQueue;
 import java.util.concurrent.SynchronousQueue;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class SingleProducerMultipleConsumerLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/CompletableFuture/Basic.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/CompletableFuture/Basic.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 8005696
  * @summary Basic tests for CompletableFuture
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @run main Basic
  * @run main/othervm -Djava.util.concurrent.ForkJoinPool.common.parallelism=0 Basic
  * @author Chris Hegarty
@@ -56,7 +56,7 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.atomic.AtomicInteger;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class Basic {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -41,7 +41,7 @@
  * inserts it, and if present, with probability premove it removes
  * it.  (pinsert and premove are expressed as percentages to simplify
  * parsing from command line.)
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @run main/timeout=1600 MapLoops
  */
 
@@ -54,7 +54,7 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class MapLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658 6785442
  * @summary Checks that a set of threads can repeatedly get and modify items
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @run main ConcurrentQueueLoops 8 123456
  */
 
@@ -58,7 +58,7 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.LinkedTransferQueue;
 import java.util.concurrent.atomic.AtomicInteger;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class ConcurrentQueueLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6253848 6366811
  * @summary Basic tests for CyclicBarrier
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Martin Buchholz, David Holmes
  */
 
@@ -39,7 +39,7 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.TimeoutException;
 import java.util.concurrent.atomic.AtomicInteger;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class Basic {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/Exchanger/ExchangeLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/Exchanger/ExchangeLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary checks to make sure a pipeline of exchangers passes data.
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -44,7 +44,7 @@
 import java.util.concurrent.Exchanger;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class ExchangeLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4965960
  * @summary  Exercise ExecutorCompletionService
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -44,7 +44,7 @@
 import java.util.concurrent.ExecutorCompletionService;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class ExecutorCompletionServiceLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/Executors/AutoShutdown.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/Executors/AutoShutdown.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2011, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6399443
  * @summary Check for auto-shutdown and gc of singleThreadExecutors
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @run main/othervm/timeout=1000 AutoShutdown
  * @author Martin Buchholz
  */
@@ -41,7 +41,7 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class AutoShutdown {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2012, 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
@@ -26,7 +26,7 @@
  * @bug 6431315
  * @summary ExecutorService.invokeAll might hang
  * @author Martin Buchholz
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -37,7 +37,7 @@
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.RejectedExecutionException;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /**
  * Adapted from Doug Lea, which was...
--- a/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -37,7 +37,7 @@
  * @summary Checks for responsiveness of futures to cancellation.
  * Runs under the assumption that ITERS computations require more than
  * TIMEOUT msecs to complete.
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @run main/timeout=2000 CancelledFutureLoops
  */
 
@@ -52,7 +52,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.locks.ReentrantLock;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public final class CancelledFutureLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/FutureTask/DoneMeansDone.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/FutureTask/DoneMeansDone.java	Tue Sep 18 16:41:24 2018 -0700
@@ -36,7 +36,7 @@
  * @bug 8073704
  * @summary Checks that once isDone() returns true,
  * get() never throws InterruptedException or TimeoutException
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -52,7 +52,7 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicReference;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class DoneMeansDone {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 6725789
  * @summary Check for long overflow in task time comparison.
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.DAYS;
@@ -45,7 +45,7 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledThreadPoolExecutor;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class DelayOverflow {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 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,14 +26,14 @@
  * @bug 7091003
  * @summary ScheduledExecutorService never executes Runnable
  *          with corePoolSize of zero
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Chris Hegarty
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 
 import java.util.concurrent.ScheduledThreadPoolExecutor;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /**
  * Verify that tasks can be run even with a core pool size of 0.
--- a/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 8022642 8065320 8129861
  * @summary Ensure relative sanity when zero core threads
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @modules java.base/java.util.concurrent:open
  */
 
@@ -48,7 +48,7 @@
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.BooleanSupplier;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class ZeroCoreThreads {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6233235 6268386
  * @summary Test allowsCoreThreadTimeOut
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Martin Buchholz
  */
 
@@ -37,7 +37,7 @@
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class CoreThreadTimeOut {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/Custom.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/Custom.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6277663
  * @summary Test TPE extensibility framework
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Martin Buchholz
  */
 
@@ -41,7 +41,7 @@
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.function.BooleanSupplier;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class Custom {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
 /*
  * @test
  * @summary Should be able to shutdown a pool when worker creation failed.
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -44,7 +44,7 @@
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class FlakyThreadFactory {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6576792
  * @summary non-idle worker threads should not be interrupted
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -34,7 +34,7 @@
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class SelfInterrupt {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java	Tue Sep 18 16:41:24 2018 -0700
@@ -36,7 +36,7 @@
  * @test
  * @summary Only one thread should be created when a thread needs to
  * be kept alive to service a delayed task waiting in the queue.
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -44,7 +44,7 @@
 import java.util.concurrent.ScheduledThreadPoolExecutor;
 import java.util.concurrent.ThreadFactory;
 import java.util.concurrent.atomic.AtomicLong;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class ThreadRestarts {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6458662
  * @summary poolSize might shrink below corePoolSize after timeout
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Martin Buchholz
  */
 
@@ -34,7 +34,7 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.SynchronousQueue;
 import java.util.concurrent.ThreadPoolExecutor;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class TimeOutShrink {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/forkjoin/SubmissionTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/forkjoin/SubmissionTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -23,13 +23,13 @@
 
 import java.util.concurrent.ForkJoinPool;
 import java.util.concurrent.atomic.AtomicBoolean;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * @test
  * @bug 8078490
  * @summary Test submission and execution of task without joining
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 public class SubmissionTest {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary basic safety and liveness of ReentrantLocks, and other locks based on them
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -48,7 +48,7 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public final class CheckedLockLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6460501 6236036 6500694 6490770
  * @summary Repeated failed timed waits shouldn't leak memory
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Martin Buchholz
  */
 
@@ -56,7 +56,7 @@
 import java.util.concurrent.locks.ReentrantReadWriteLock;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class TimedAcquireLeak {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary Checks for missed signals by locking and unlocking each of an array of locks once per thread
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -45,7 +45,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.locks.ReentrantLock;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public final class LockOncePerThreadLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658
  * @summary multiple threads using a single lock
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -45,7 +45,7 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.ThreadLocalRandom;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public final class SimpleReentrantLockLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 4486658 5031862 8140471
  * @summary Checks for responsiveness of locks to timeouts.
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -46,7 +46,7 @@
 import java.util.concurrent.ThreadLocalRandom;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.ReentrantLock;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public final class TimeoutLockLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2008, 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
@@ -25,7 +25,7 @@
  * @test
  * @bug 6207928 6328220 6378321 6625723
  * @summary Recursive lock invariant sanity checks
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Martin Buchholz
  */
 
@@ -45,7 +45,7 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.concurrent.locks.ReentrantReadWriteLock;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 // I am the Cownt, and I lahve to cownt.
 public class Count {
--- a/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Tue Sep 18 16:41:24 2018 -0700
@@ -41,7 +41,7 @@
  * inserts it, and if present, with probability premove it removes
  * it.  (pinsert and premove are expressed as percentages to simplify
  * parsing from command line.)
- * @library /lib/testlibrary/
+ * @library /test/lib
  */
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
@@ -51,7 +51,7 @@
 import java.util.concurrent.CyclicBarrier;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class MapLoops {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/concurrent/locks/StampedLock/Basic.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/concurrent/locks/StampedLock/Basic.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,7 +35,7 @@
  * @test
  * @bug 8005697
  * @summary Basic tests for StampedLock
- * @library /lib/testlibrary/
+ * @library /test/lib
  * @author Chris Hegarty
  */
 
@@ -50,7 +50,7 @@
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReadWriteLock;
 import java.util.concurrent.locks.StampedLock;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class Basic {
     static final long LONG_DELAY_MS = Utils.adjustTimeout(10_000);
--- a/test/jdk/java/util/zip/ZipFile/DeleteTempJar.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/java/util/zip/ZipFile/DeleteTempJar.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, 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
@@ -21,16 +21,6 @@
  * questions.
  */
 
-/* @test
-   @bug 4166799
-   @summary Make sure URL-downloaded jar files (jar_cache files)
-            will be deleted when VM exits.
-
-   @modules jdk.httpserver
-   @build DeleteTempJar
-   @run shell deletetempjar.sh
- */
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
@@ -106,6 +96,5 @@
         else return fail(x + " not equal to " + y);}
     public static void main(String[] args) throws Throwable {
         try {realMain(args);} catch (Throwable t) {unexpected(t);}
-        System.out.println("\nPassed = " + passed + " failed = " + failed);
         if (failed > 0) throw new AssertionError("Some tests failed");}
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/zip/ZipFile/DeleteTempJarTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * 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 4166799
+ * @summary Make sure URL-downloaded jar files (jar_cache files)
+ *          will be deleted when VM exits.
+ * @modules jdk.httpserver
+ * @library /test/lib
+ * @build jdk.test.lib.process.*
+ *        DeleteTempJar
+ * @run main DeleteTempJarTest
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.Asserts;
+
+public class DeleteTempJarTest {
+
+    public static void main(String[] args) throws Exception {
+        String tmpFile = ProcessTools.executeTestJvm(DeleteTempJar.class.getName())
+                                     .shouldHaveExitValue(0)
+                                     .getStdout();
+
+        Asserts.assertFalse(Files.exists(Paths.get(tmpFile.trim())));
+    }
+}
--- a/test/jdk/java/util/zip/ZipFile/deletetempjar.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-#! /bin/sh
-
-#
-# Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please 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 [ "x$TESTJAVA" = x ]; then
-  TESTJAVA=$1; shift
-  TESTCLASSES=.
-fi
-
-tmpfile=`$TESTJAVA/bin/java ${TESTVMOPTS} -classpath $TESTCLASSES DeleteTempJar`
-rc=$?
-if [ $rc != 0 ]; then
-    echo Unexpected failure with exit status $rc
-    exit $rc
-elif [ -f "$tmpfile" ]; then
-  echo "temp file not deleted"; exit 1
-fi
--- a/test/jdk/javax/management/monitor/GaugeMonitorDeadlockTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/management/monitor/GaugeMonitorDeadlockTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, 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
@@ -28,7 +28,7 @@
  * or notif delivered.
  * @author Eamonn McManus
  *
- * @library /lib/testlibrary
+ * @library /test/lib
  *
  * @run clean GaugeMonitorDeadlockTest
  * @run build GaugeMonitorDeadlockTest
@@ -50,7 +50,7 @@
 import javax.management.monitor.GaugeMonitor;
 import javax.management.monitor.GaugeMonitorMBean;
 
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class GaugeMonitorDeadlockTest {
     private static enum When {IN_GET_ATTRIBUTE, IN_NOTIFY};
--- a/test/jdk/javax/management/monitor/StartStopTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/management/monitor/StartStopTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, 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
@@ -28,9 +28,8 @@
  *          monitors are started and stopped in a loop.
  * @author Luis-Miguel Alventosa
  *
- * @library /lib/testlibrary
+ * @library /test/lib
  *
- * @build jdk.testlibrary.*
  * @run clean StartStopTest
  * @run build StartStopTest
  * @run main/othervm/timeout=300 StartStopTest 1
@@ -56,7 +55,7 @@
 import javax.management.monitor.MonitorNotification;
 import javax.management.monitor.StringMonitor;
 
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class StartStopTest {
     static int maxPoolSize;
--- a/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,6 @@
  * All the communication should be done via Open Types
  * @author Olivier Lagneau
  * @modules java.management.rmi
- * @library /lib/testlibrary
  * @library /test/lib
  * @compile Basic.java
  * @run main/othervm/timeout=300 -DDEBUG_STANDARD MXBeanWeirdParamTest
@@ -59,8 +58,8 @@
 import javax.management.openmbean.TabularDataSupport;
 import javax.management.openmbean.TabularType;
 
+import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolFinder;
 
 public class MXBeanWeirdParamTest {
 
@@ -121,7 +120,7 @@
     private List<String> buildCommandLine() {
         List<String> opts = new ArrayList<>();
         opts.add(JDKToolFinder.getJDKTool("java"));
-        opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts()));
+        opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
         // We need to set WEIRD_PARAM propertty on the client-side
         opts.add("-DWEIRD_PARAM");
         opts.add("-cp");
--- a/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,12 +24,11 @@
  /*
  * @test
  * @bug 8159377
- * @library /lib/testlibrary
  * @library /test/lib
  * @summary Tests ObjectFilter on default agent
  * @author Harsha Wardhana B
  * @modules java.management
- * @build jdk.testlibrary.* DefaultAgentFilterTest
+ * @build DefaultAgentFilterTest
  * @run main/othervm/timeout=600 -XX:+UsePerfData DefaultAgentFilterTest
  */
 import java.io.EOFException;
@@ -56,7 +55,7 @@
 import javax.management.remote.JMXServiceURL;
 
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class DefaultAgentFilterTest {
 
--- a/test/jdk/javax/management/remote/mandatory/loading/MethodResultTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/management/remote/mandatory/loading/MethodResultTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -27,7 +27,7 @@
  * @summary Tests client default class loader used before JSR 160 loader
  * @author Eamonn McManus
  *
- * @library /lib/testlibrary
+ * @library /test/lib
  *
  * @run clean MethodResultTest
  * @run build MethodResultTest
@@ -40,7 +40,7 @@
 import java.util.*;
 import javax.management.*;
 import javax.management.remote.*;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
    This test checks that the class loader that is used to deserialize
--- a/test/jdk/javax/management/security/AuthorizationTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/management/security/AuthorizationTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,7 +27,6 @@
  * @summary Checks various authentication behavior from remote jmx client
  * @author Olivier Lagneau
  * @modules java.management.rmi
- * @library /lib/testlibrary
  * @library /test/lib
  * @compile Simple.java
  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=username1 -Dpassword=password1 AuthorizationTest -server -mapType x.access.file;x.password.file -populate -client -mapType credentials
@@ -65,8 +64,8 @@
 import javax.management.Attribute ;
 import javax.management.ObjectName ;
 
+import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolFinder;
 
 public class AuthorizationTest {
 
@@ -177,7 +176,7 @@
     private List<String> buildCommandLine(String args[]) {
         List<String> opts = new ArrayList<>();
         opts.add(JDKToolFinder.getJDKTool("java"));
-        opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts()));
+        opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
 
         String usernameValue = System.getProperty(USERNAME_PROPERTY);
         if (usernameValue != null) {
--- a/test/jdk/javax/management/security/SecurityTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/management/security/SecurityTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,7 +27,6 @@
  * @summary Checks various secure ways of connecting from remote jmx client
  * @author Olivier Lagneau
  * @modules java.management.rmi
- * @library /lib/testlibrary
  * @library /test/lib
  * @compile MBS_Light.java ServerDelegate.java TestSampleLoginModule.java
  * @run main/othervm/timeout=300 -DDEBUG_STANDARD -Dusername=SQE_username -Dpassword=SQE_password SecurityTest -server -mapType x.password.file -client -mapType credentials
@@ -81,8 +80,8 @@
 
 import java.security.Security;
 
+import jdk.test.lib.JDKToolFinder;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolFinder;
 
 public class SecurityTest {
 
@@ -398,7 +397,7 @@
 
         List<String> opts = new ArrayList<>();
         opts.add(JDKToolFinder.getJDKTool("java"));
-        opts.addAll(Arrays.asList(jdk.testlibrary.Utils.getTestJavaOpts()));
+        opts.addAll(Arrays.asList(jdk.test.lib.Utils.getTestJavaOpts()));
 
         // We need to forward some properties to the client side
         opts.add("-Dtest.src=" + System.getProperty("test.src"));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/naming/module/RunBasic.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,122 @@
+/*
+ * 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
+ * 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.JDKToolFinder;
+import jdk.test.lib.Utils;
+import jdk.test.lib.compiler.CompilerUtils;
+import jdk.test.lib.process.ProcessTools;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import static jdk.test.lib.Utils.TEST_SRC;
+
+/*
+ * @test
+ * @summary Test of JNDI factories using classes exported by third-party modules.
+ * @library /test/lib
+ * @modules jdk.compiler
+ * @run main RunBasic
+ */
+
+/*
+ * Demonstrates Java object storage/retrieval, LDAP control and URL context
+ * usage using an LDAP directory. The objects and their associated object
+ * factories, state factories, control factories and URL context factories
+ * are exported from third-party modules.
+ *
+ * Seven types of object are used:
+ *   - an AWT object (Serializable) from the 'java.desktop' JDK module
+ *   - a Person object (DirContext) from the 'person' third-party module
+ *   - a Fruit object (Referenceable) from the 'fruit' third-party module
+ *   - an RMI object (Remote) from the 'hello' third-party module
+ *   - an LDAP request control (Control) from the 'foo' third-party module
+ *   - an LDAP response control (Control) from the 'authz' third-party module
+ *   - an ldapv4 URL (DirContext) from the 'ldapv4' third-party module
+ */
+
+public class RunBasic {
+
+    private static final List<String> JAVA_CMDS;
+
+    static {
+        String javaPath = JDKToolFinder.getJDKTool("java");
+
+        JAVA_CMDS = Stream
+                .concat(Stream.of(javaPath), Stream.of(Utils.getTestJavaOpts()))
+                .collect(Collectors.collectingAndThen(Collectors.toList(),
+                        Collections::unmodifiableList));
+    }
+
+    public static void main(String[] args) throws Throwable {
+        // prepare all test modules
+        prepareModule("person");
+        prepareModule("fruit");
+        prepareModule("hello");
+        prepareModule("foo");
+        prepareModule("authz");
+        prepareModule("ldapv4");
+        prepareModule("test", "--module-source-path",
+                Path.of(TEST_SRC, "src").toString());
+
+        // run tests
+        runTest("java.desktop", "test.StoreObject");
+        runTest("person", "test.StorePerson");
+        runTest("fruit", "test.StoreFruit");
+        runTest("hello", "test.StoreRemote");
+        runTest("foo", "test.ConnectWithFoo");
+        runTest("authz", "test.ConnectWithAuthzId");
+        runTest("ldapv4", "test.ReadByUrl");
+    }
+
+    private static void prepareModule(String mod, String... opts)
+            throws IOException {
+        System.out.println("Preparing the '" + mod + "' module...");
+        makeDir("mods", mod);
+        CompilerUtils.compile(Path.of(TEST_SRC, "src", mod),
+                Path.of("mods", (mod.equals("test") ? "" : mod)), opts);
+    }
+
+    private static void makeDir(String first, String... more)
+            throws IOException {
+        Files.createDirectories(Path.of(first, more));
+    }
+
+    private static void runTest(String desc, String clsName) throws Throwable {
+        System.out.println("Running with the '" + desc + "' module...");
+        runJava("-Dtest.src=" + TEST_SRC, "-p", "mods", "-m", "test/" + clsName,
+                "ldap://localhost/dc=ie,dc=oracle,dc=com");
+    }
+
+    private static void runJava(String... opts) throws Throwable {
+        ProcessTools.executeCommand(
+                Stream.of(JAVA_CMDS, List.of(opts)).flatMap(Collection::stream)
+                        .toArray(String[]::new)).shouldHaveExitValue(0);
+    }
+}
--- a/test/jdk/javax/naming/module/basic.sh	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-#
-# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# @test
-# @summary Test of JNDI factories using classes exported by third-party modules.
-
-# Demonstrates Java object storage/retrieval, LDAP control and URL context
-# usage using an LDAP directory. The objects and their associated object
-# factories, state factories, control factories and URL context factories
-# are exported from third-party modules.
-#
-# Seven types of object are used:
-#   - an AWT object (Serializable) from the 'java.desktop' JDK module
-#   - a Person object (DirContext) from the 'person' third-party module
-#   - a Fruit object (Referenceable) from the 'fruit' third-party module
-#   - an RMI object (Remote) from the 'hello' third-party module
-#   - an LDAP request control (Control) from the 'foo' third-party module
-#   - an LDAP response control (Control) from the 'authz' third-party module
-#   - an ldapv4 URL (DirContext) from the 'ldapv4' third-party module
-#
-
-set -e
-
-if [ -z "$TESTJAVA" ]; then
-  if [ $# -lt 1 ]; then exit 1; fi
-  TESTJAVA="$1"; shift
-  COMPILEJAVA="${TESTJAVA}"
-  TESTSRC="`pwd`"
-  TESTCLASSES="`pwd`"
-fi
-
-JAVAC="$COMPILEJAVA/bin/javac"
-JAVA="$TESTJAVA/bin/java"
-
-echo "\nPreparing the 'person' module..."
-mkdir -p mods/person
-$JAVAC -d mods/person `find $TESTSRC/src/person -name "*.java"`
-
-echo "\nPreparing the 'fruit' module..."
-mkdir -p mods/fruit
-$JAVAC -d mods/fruit `find $TESTSRC/src/fruit -name "*.java"`
-
-echo "\nPreparing the 'hello' module..."
-mkdir -p mods/hello
-$JAVAC -d mods/hello `find $TESTSRC/src/hello -name "*.java"`
-
-echo "\nPreparing the 'foo' module..."
-mkdir -p mods/foo
-$JAVAC -d mods/foo `find $TESTSRC/src/foo -name "*.java"`
-
-echo "\nPreparing the 'authz' module..."
-mkdir -p mods/authz
-$JAVAC -d mods/authz `find $TESTSRC/src/authz -name "*.java"`
-
-echo "\nPreparing the 'ldapv4' module..."
-mkdir -p mods/ldapv4
-$JAVAC -d mods/ldapv4 `find $TESTSRC/src/ldapv4 -name "*.java"`
-
-echo "\nPreparing the 'test' module..."
-mkdir -p mods/test
-$JAVAC -d mods --module-source-path $TESTSRC/src `find $TESTSRC/src/test -name "*.java"`
-
-
-echo "\nRunning with the 'java.desktop' module..."
-$JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StoreObject ldap://localhost/dc=ie,dc=oracle,dc=com
-
-echo "\nRunning with the 'person' module..."
-$JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StorePerson ldap://localhost/dc=ie,dc=oracle,dc=com
-
-echo "\nRunning with the 'fruit' module..."
-$JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StoreFruit ldap://localhost/dc=ie,dc=oracle,dc=com
-
-echo "\nRunning with the 'hello' module..."
-$JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.StoreRemote ldap://localhost/dc=ie,dc=oracle,dc=com
-
-echo "\nRunning with the 'foo' module..."
-$JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.ConnectWithFoo ldap://localhost/dc=ie,dc=oracle,dc=com
-
-echo "\nRunning with the 'authz' module..."
-$JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.ConnectWithAuthzId ldap://localhost/dc=ie,dc=oracle,dc=com
-
-echo "\nRunning with the 'ldapv4' module..."
-$JAVA -Dtest.src=${TESTSRC} -p mods -m test/test.ReadByUrl ldap://localhost/dc=ie,dc=oracle,dc=com
-
--- a/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,6 +27,8 @@
             0x1302, Protocol.TLSV1_3, Protocol.TLSV1_3),
     TLS_AES_128_GCM_SHA256(
             0x1301, Protocol.TLSV1_3, Protocol.TLSV1_3),
+    TLS_CHACHA20_POLY1305_SHA256(
+            0x1303, Protocol.TLSV1_3, Protocol.TLSV1_3),
     TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256(
             0xCCAA, Protocol.TLSV1_2, Protocol.TLSV1_2),
     TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256(
--- a/test/jdk/javax/net/ssl/TLSCommon/SSLEngineTestCase.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/net/ssl/TLSCommon/SSLEngineTestCase.java	Tue Sep 18 16:41:24 2018 -0700
@@ -182,7 +182,8 @@
 
     private static final String[] TLS13_CIPHERS = {
             "TLS_AES_256_GCM_SHA384",
-            "TLS_AES_128_GCM_SHA256"
+            "TLS_AES_128_GCM_SHA256",
+            "TLS_CHACHA20_POLY1305_SHA256"
     };
 
     private static final String[] SUPPORTED_NON_KRB_CIPHERS;
--- a/test/jdk/javax/xml/crypto/dsig/GenerationTests.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,7 +24,7 @@
 /**
  * @test
  * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949
- *      8046724 8079693 8177334
+ *      8046724 8079693 8177334 8205507 8210736
  * @summary Basic unit tests for generating XML Signatures with JSR 105
  * @modules java.base/sun.security.util
  *          java.base/sun.security.x509
@@ -32,7 +32,7 @@
  *          jdk.httpserver/com.sun.net.httpserver
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java GenerationTests.java
- * @run main/othervm/timeout=300 GenerationTests
+ * @run main/othervm/timeout=300 -Dsun.net.httpserver.nodelay=true GenerationTests
  * @author Sean Mullan
  */
 
@@ -51,7 +51,6 @@
 import java.security.NoSuchAlgorithmException;
 import java.security.PrivateKey;
 import java.security.PublicKey;
-import java.security.SecureRandom;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateFactory;
 import java.security.cert.X509CRL;
@@ -258,6 +257,26 @@
         KeyValue, x509data, KeyName
     }
 
+    // cached keys (for performance) used by test_create_detached_signature().
+    private static HashMap<String,Key[]> cachedKeys = new HashMap<>();
+
+    // Load cachedKeys persisted in a file to reproduce a failure.
+    // The keys are always saved to "cached-keys" but you can rename
+    // it to a different file name and load it here. Note: The keys will
+    // always be persisted so renaming is a good idea although the
+    // content might not change.
+    static {
+        String cacheFile = System.getProperty("use.cached.keys");
+        if (cacheFile != null) {
+            try (FileInputStream fis = new FileInputStream(cacheFile);
+                 ObjectInputStream ois = new ObjectInputStream(fis)) {
+                cachedKeys = (HashMap<String,Key[]>) ois.readObject();
+            } catch (Exception e) {
+                throw new AssertionError("Cannot read " + cacheFile, e);
+            }
+        }
+    }
+
     private static boolean result = true;
 
     public static void main(String args[]) throws Exception {
@@ -422,6 +441,12 @@
                     XMLSignatureException.class);
         }
 
+        // persist cached keys to a file.
+        try (FileOutputStream fos = new FileOutputStream("cached-keys", true);
+             ObjectOutputStream oos = new ObjectOutputStream(fos)) {
+            oos.writeObject(cachedKeys);
+        }
+
         if (!result) {
             throw new RuntimeException("At least one test case failed");
         }
@@ -1650,37 +1675,9 @@
 
         SignatureMethod sm = fac.newSignatureMethod(signatureMethod, null);
 
-        Key signingKey;
-        Key validationKey;
-        if (signatureMethod.contains("#hmac-")) {
-            // http://...#hmac-sha1 -> hmac-sha1 -> hmacsha1
-            String algName = signatureMethod
-                    .substring(signatureMethod.indexOf('#') + 1)
-                    .replace("-", "");
-            KeyGenerator kg = KeyGenerator.getInstance(algName);
-            signingKey = kg.generateKey();
-            validationKey = signingKey;
-        } else {
-            KeyPairGenerator kpg;
-            SecureRandom random = new SecureRandom();
-            if (signatureMethod.contains("#rsa-")
-                    || signatureMethod.contains("-rsa-MGF1")) {
-                kpg = KeyPairGenerator.getInstance("RSA");
-                kpg.initialize(signatureMethod.contains("#sha512-rsa-MGF1")
-                        ? 2048 : 1024, random);
-            } else if (signatureMethod.contains("#dsa-")) {
-                kpg = KeyPairGenerator.getInstance("DSA");
-                kpg.initialize(1024, random);
-            } else if (signatureMethod.contains("#ecdsa-")) {
-                kpg = KeyPairGenerator.getInstance("EC");
-                kpg.initialize(256, random);
-            } else {
-                throw new RuntimeException("Unsupported signature algorithm");
-            }
-            KeyPair kp = kpg.generateKeyPair();
-            validationKey = kp.getPublic();
-            signingKey = kp.getPrivate();
-        }
+        Key[] pair = getCachedKeys(signatureMethod);
+        Key signingKey = pair[0];
+        Key validationKey = pair[1];
 
         SignedInfo si = fac.newSignedInfo(cm, sm, refs, null);
 
@@ -1759,6 +1756,44 @@
         return true;
     }
 
+    private static Key[] getCachedKeys(String signatureMethod) {
+        return cachedKeys.computeIfAbsent(signatureMethod, sm -> {
+            try {
+                System.out.print("<create keys for " + sm + ">");
+                System.out.flush();
+                if (sm.contains("#hmac-")) {
+                    // http://...#hmac-sha1 -> hmac-sha1 -> hmacsha1
+                    String algName = sm
+                            .substring(sm.indexOf('#') + 1)
+                            .replace("-", "");
+                    KeyGenerator kg = KeyGenerator.getInstance(algName);
+                    Key signingKey = kg.generateKey();
+                    return new Key[] { signingKey, signingKey};
+                } else {
+                    KeyPairGenerator kpg;
+                    if (sm.contains("#rsa-")
+                            || sm.contains("-rsa-MGF1")) {
+                        kpg = KeyPairGenerator.getInstance("RSA");
+                        kpg.initialize(
+                                sm.contains("#sha512-rsa-MGF1") ? 2048 : 1024);
+                    } else if (sm.contains("#dsa-")) {
+                        kpg = KeyPairGenerator.getInstance("DSA");
+                        kpg.initialize(1024);
+                    } else if (sm.contains("#ecdsa-")) {
+                        kpg = KeyPairGenerator.getInstance("EC");
+                        kpg.initialize(256);
+                    } else {
+                        throw new RuntimeException("Unsupported signature algorithm");
+                    }
+                    KeyPair kp = kpg.generateKeyPair();
+                    return new Key[] { kp.getPrivate(), kp.getPublic()};
+                }
+            } catch (NoSuchAlgorithmException e) {
+                throw new AssertionError("Should not happen", e);
+            }
+        });
+    }
+
     private static final String DSA_Y =
         "070662842167565771936588335128634396171789331656318483584455493822" +
         "400811200853331373030669235424928346190274044631949560438023934623" +
--- a/test/jdk/jdk/nio/zipfs/ZipFSTester.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/jdk/nio/zipfs/ZipFSTester.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2015, 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 java.net.URI;
 import java.net.URLDecoder;
 import java.nio.ByteBuffer;
+import java.nio.channels.Channels;
 import java.nio.channels.FileChannel;
 import java.nio.channels.SeekableByteChannel;
 import java.nio.file.DirectoryStream;
@@ -58,8 +59,10 @@
 import java.util.Random;
 import java.util.Set;
 import java.util.concurrent.TimeUnit;
+import java.util.zip.CRC32;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+import java.util.zip.ZipOutputStream;
 
 import static java.nio.file.StandardOpenOption.*;
 import static java.nio.file.StandardCopyOption.*;
@@ -70,7 +73,7 @@
  * @test
  * @bug 6990846 7009092 7009085 7015391 7014948 7005986 7017840 7007596
  *      7157656 8002390 7012868 7012856 8015728 8038500 8040059 8069211
- *      8131067
+ *      8131067 8034802
  * @summary Test Zip filesystem provider
  * @modules jdk.zipfs
  * @run main ZipFSTester
@@ -80,23 +83,27 @@
 public class ZipFSTester {
 
     public static void main(String[] args) throws Exception {
-
         // create JAR file for test, actual contents don't matter
         Path jarFile = Utils.createJarFile("tester.jar",
                 "META-INF/MANIFEST.MF",
                 "dir1/foo",
-                "dir2/bar");
+                "dir2/bar",
+                "dir1/dir3/fooo");
 
         try (FileSystem fs = newZipFileSystem(jarFile, Collections.emptyMap())) {
             test0(fs);
             test1(fs);
             test2(fs);   // more tests
         }
+
+        testStreamChannel();
         testTime(jarFile);
         test8069211();
         test8131067();
     }
 
+    private static Random rdm = new Random();
+
     static void test0(FileSystem fs)
         throws Exception
     {
@@ -121,13 +128,28 @@
     static void test1(FileSystem fs0)
         throws Exception
     {
-        Random rdm = new Random();
-        // clone a fs and test on it
+        // prepare a src for testing
+        Path src = getTempPath();
+        String tmpName = src.toString();
+        try (OutputStream os = Files.newOutputStream(src)) {
+            byte[] bits = new byte[12345];
+            rdm.nextBytes(bits);
+            os.write(bits);
+        }
+
+        // clone a fs from fs0 and test on it
         Path tmpfsPath = getTempPath();
         Map<String, Object> env = new HashMap<String, Object>();
         env.put("create", "true");
         try (FileSystem copy = newZipFileSystem(tmpfsPath, env)) {
             z2zcopy(fs0, copy, "/", 0);
+
+            // copy the test jar itself in
+            Files.copy(Paths.get(fs0.toString()), copy.getPath("/foo.jar"));
+            Path zpath = copy.getPath("/foo.jar");
+            try (FileSystem zzfs = FileSystems.newFileSystem(zpath, null)) {
+                Files.copy(src, zzfs.getPath("/srcInjarjar"));
+            }
         }
 
         try (FileSystem fs = newZipFileSystem(tmpfsPath, new HashMap<String, Object>())) {
@@ -142,15 +164,6 @@
                 throw new RuntimeException("newFileSystem(URI...) does not throw exception");
             } catch (FileSystemAlreadyExistsException fsaee) {}
 
-            // prepare a src
-            Path src = getTempPath();
-            String tmpName = src.toString();
-            OutputStream os = Files.newOutputStream(src);
-            byte[] bits = new byte[12345];
-            rdm.nextBytes(bits);
-            os.write(bits);
-            os.close();
-
             try {
                 provider.newFileSystem(new File(System.getProperty("test.src", ".")).toPath(),
                                        new HashMap<String, Object>());
@@ -162,6 +175,8 @@
                 throw new RuntimeException("newFileSystem() opens a non-zip file as zipfs");
             } catch (UnsupportedOperationException uoe) {}
 
+            // walk
+            walk(fs.getPath("/"));
 
             // copyin
             Path dst = getPathWithParents(fs, tmpName);
@@ -236,10 +251,29 @@
             // test channels
             channel(fs, dst);
             Files.delete(dst);
-            Files.delete(src);
+
+            // test foo.jar in jar/zipfs #8034802
+            Path jpath = fs.getPath("/foo.jar");
+            System.out.println("walking: " + jpath);
+            try (FileSystem zzfs = FileSystems.newFileSystem(jpath, null)) {
+                walk(zzfs.getPath("/"));
+                // foojar:/srcInjarjar
+                checkEqual(src, zzfs.getPath("/srcInjarjar"));
+
+                dst = getPathWithParents(zzfs, tmpName);
+                fchCopy(src, dst);
+                checkEqual(src, dst);
+                tmp = Paths.get(tmpName + "_Tmp");
+                fchCopy(dst, tmp);   //  out
+                checkEqual(src, tmp);
+                Files.delete(tmp);
+
+                channel(zzfs, dst);
+                Files.delete(dst);
+            }
         } finally {
-            if (Files.exists(tmpfsPath))
-                Files.delete(tmpfsPath);
+            Files.deleteIfExists(tmpfsPath);
+            Files.deleteIfExists(src);
         }
     }
 
@@ -383,6 +417,158 @@
         Files.delete(fs3Path);
     }
 
+    static final int METHOD_STORED     = 0;
+    static final int METHOD_DEFLATED   = 8;
+
+    static Object[][] getEntries() {
+        Object[][] entries = new Object[10 + rdm.nextInt(20)][3];
+        for (int i = 0; i < entries.length; i++) {
+            entries[i][0] = "entries" + i;
+            entries[i][1] = rdm.nextInt(10) % 2 == 0 ?
+                METHOD_STORED : METHOD_DEFLATED;
+            entries[i][2] = new byte[rdm.nextInt(8192)];
+            rdm.nextBytes((byte[])entries[i][2]);
+        }
+        return entries;
+    }
+
+    // check the content of read from zipfs is equal to the "bytes"
+    private static void checkRead(Path path, byte[] expected) throws IOException {
+        //streams
+        try (InputStream is = Files.newInputStream(path)) {
+            if (!Arrays.equals(is.readAllBytes(), expected)) {
+                System.out.printf(" newInputStream <%s> failed...%n", path.toString());
+                throw new RuntimeException("CHECK FAILED!");
+            }
+        }
+
+        // channels -- via sun.nio.ch.ChannelInputStream
+        try (SeekableByteChannel sbc = Files.newByteChannel(path);
+            InputStream is = Channels.newInputStream(sbc)) {
+
+            // check all bytes match
+            if (!Arrays.equals(is.readAllBytes(), expected)) {
+                System.out.printf(" newByteChannel <%s> failed...%n", path.toString());
+                throw new RuntimeException("CHECK FAILED!");
+            }
+
+            // Check if read position is at the end
+            if (sbc.position() != expected.length) {
+                System.out.printf("pos [%s]: size=%d, position=%d%n",
+                                  path.toString(), expected.length, sbc.position());
+                throw new RuntimeException("CHECK FAILED!");
+            }
+
+            // Check position(x) + read() at the random/specific pos/len
+            byte[] buf = new byte[1024];
+            ByteBuffer bb = ByteBuffer.wrap(buf);
+            for (int i = 0; i < 10; i++) {
+                int pos = rdm.nextInt((int)sbc.size());
+                int len = rdm.nextInt(Math.min(buf.length, expected.length - pos));
+                // System.out.printf("  --> %d, %d%n", pos, len);
+                bb.position(0).limit(len);    // bb.flip().limit(len);
+                if (sbc.position(pos).position() != pos ||
+                    sbc.read(bb) != len ||
+                    !Arrays.equals(buf, 0, bb.position(), expected, pos, pos + len)) {
+                    System.out.printf("read()/position() failed%n");
+                }
+            }
+        } catch (IOException x) {
+            x.printStackTrace();
+            throw new RuntimeException("CHECK FAILED!");
+        }
+    }
+
+    // test entry stream/channel reading
+    static void testStreamChannel() throws Exception {
+        Path zpath = getTempPath();
+        try {
+            var crc = new CRC32();
+            Object[][] entries = getEntries();
+
+            // [1] create zip via ZipOutputStream
+            try (var os = Files.newOutputStream(zpath);
+                 var zos = new ZipOutputStream(os)) {
+                for (Object[] entry : entries) {
+                   var ze = new ZipEntry((String)entry[0]);
+                   int method = (int)entry[1];
+                   byte[] bytes = (byte[])entry[2];
+                   if (method == METHOD_STORED) {
+                       ze.setSize(bytes.length);
+                       crc.reset();
+                       crc.update(bytes);
+                       ze.setCrc(crc.getValue());
+                   }
+                   ze.setMethod(method);
+                   zos.putNextEntry(ze);
+                   zos.write(bytes);
+                   zos.closeEntry();
+                }
+            }
+            try (var zfs = newZipFileSystem(zpath, Collections.emptyMap())) {
+                for (Object[] e : entries) {
+                    Path path = zfs.getPath((String)e[0]);
+                    int method = (int)e[1];
+                    byte[] bytes = (byte[])e[2];
+                    // System.out.printf("checking read [%s, %d, %d]%n",
+                    //                   path.toString(), bytes.length, method);
+                    checkRead(path, bytes);
+                }
+            }
+            Files.deleteIfExists(zpath);
+
+            // [2] create zip via zfs.newByteChannel
+            try (var zfs = newZipFileSystem(zpath, Map.of("create", "true"))) {
+                for (Object[] e : entries) {
+                    //  tbd: method is not used
+                    try (var sbc = Files.newByteChannel(zfs.getPath((String)e[0]),
+                                                        CREATE_NEW, WRITE)) {
+                        sbc.write(ByteBuffer.wrap((byte[])e[2]));
+                    }
+                }
+            }
+            try (var zfs = newZipFileSystem(zpath, Collections.emptyMap())) {
+                for (Object[] e : entries) {
+                    checkRead(zfs.getPath((String)e[0]), (byte[])e[2]);
+                }
+            }
+            Files.deleteIfExists(zpath);
+
+            // [3] create zip via Files.write()/newoutputStream/
+            try (var zfs = newZipFileSystem(zpath, Map.of("create", "true"))) {
+                for (Object[] e : entries) {
+                    Files.write(zfs.getPath((String)e[0]), (byte[])e[2]);
+                }
+            }
+            try (var zfs = newZipFileSystem(zpath, Collections.emptyMap())) {
+                for (Object[] e : entries) {
+                    checkRead(zfs.getPath((String)e[0]), (byte[])e[2]);
+                }
+            }
+            Files.deleteIfExists(zpath);
+
+            // [4] create zip via zfs.newByteChannel, with "method_stored"
+            try (var zfs = newZipFileSystem(zpath,
+                    Map.of("create", true, "noCompression", true))) {
+                for (Object[] e : entries) {
+                    try (var sbc = Files.newByteChannel(zfs.getPath((String)e[0]),
+                                                        CREATE_NEW, WRITE)) {
+                        sbc.write(ByteBuffer.wrap((byte[])e[2]));
+                    }
+                }
+            }
+            try (var zfs = newZipFileSystem(zpath, Collections.emptyMap())) {
+                for (Object[] e : entries) {
+                    checkRead(zfs.getPath((String)e[0]), (byte[])e[2]);
+                }
+            }
+            Files.deleteIfExists(zpath);
+
+        } finally {
+            Files.deleteIfExists(zpath);
+        }
+    }
+
     // test file stamp
     static void testTime(Path src) throws Exception {
         BasicFileAttributes attrs = Files
@@ -392,34 +578,35 @@
         Map<String, Object> env = new HashMap<String, Object>();
         env.put("create", "true");
         Path fsPath = getTempPath();
-        FileSystem fs = newZipFileSystem(fsPath, env);
+        try (FileSystem fs = newZipFileSystem(fsPath, env)) {
+            System.out.println("test copy with timestamps...");
+            // copyin
+            Path dst = getPathWithParents(fs, "me");
+            Files.copy(src, dst, COPY_ATTRIBUTES);
+            checkEqual(src, dst);
+            System.out.println("mtime: " + attrs.lastModifiedTime());
+            System.out.println("ctime: " + attrs.creationTime());
+            System.out.println("atime: " + attrs.lastAccessTime());
+            System.out.println(" ==============>");
+            BasicFileAttributes dstAttrs = Files
+                            .getFileAttributeView(dst, BasicFileAttributeView.class)
+                            .readAttributes();
+            System.out.println("mtime: " + dstAttrs.lastModifiedTime());
+            System.out.println("ctime: " + dstAttrs.creationTime());
+            System.out.println("atime: " + dstAttrs.lastAccessTime());
 
-        System.out.println("test copy with timestamps...");
-        // copyin
-        Path dst = getPathWithParents(fs, "me");
-        Files.copy(src, dst, COPY_ATTRIBUTES);
-        checkEqual(src, dst);
-        System.out.println("mtime: " + attrs.lastModifiedTime());
-        System.out.println("ctime: " + attrs.creationTime());
-        System.out.println("atime: " + attrs.lastAccessTime());
-        System.out.println(" ==============>");
-        BasicFileAttributes dstAttrs = Files
-                        .getFileAttributeView(dst, BasicFileAttributeView.class)
-                        .readAttributes();
-        System.out.println("mtime: " + dstAttrs.lastModifiedTime());
-        System.out.println("ctime: " + dstAttrs.creationTime());
-        System.out.println("atime: " + dstAttrs.lastAccessTime());
-
-        // 1-second granularity
-        if (attrs.lastModifiedTime().to(TimeUnit.SECONDS) !=
-            dstAttrs.lastModifiedTime().to(TimeUnit.SECONDS) ||
-            attrs.lastAccessTime().to(TimeUnit.SECONDS) !=
-            dstAttrs.lastAccessTime().to(TimeUnit.SECONDS) ||
-            attrs.creationTime().to(TimeUnit.SECONDS) !=
-            dstAttrs.creationTime().to(TimeUnit.SECONDS)) {
-            throw new RuntimeException("Timestamp Copy Failed!");
+            // 1-second granularity
+            if (attrs.lastModifiedTime().to(TimeUnit.SECONDS) !=
+                dstAttrs.lastModifiedTime().to(TimeUnit.SECONDS) ||
+                attrs.lastAccessTime().to(TimeUnit.SECONDS) !=
+                dstAttrs.lastAccessTime().to(TimeUnit.SECONDS) ||
+                attrs.creationTime().to(TimeUnit.SECONDS) !=
+                dstAttrs.creationTime().to(TimeUnit.SECONDS)) {
+                throw new RuntimeException("Timestamp Copy Failed!");
+            }
+        } finally {
+            Files.delete(fsPath);
         }
-        Files.delete(fsPath);
     }
 
     static void test8069211() throws Exception {
@@ -624,8 +811,8 @@
     // check the content of two paths are equal
     private static void checkEqual(Path src, Path dst) throws IOException
     {
-        //System.out.printf("checking <%s> vs <%s>...%n",
-        //                  src.toString(), dst.toString());
+        System.out.printf("checking <%s> vs <%s>...%n",
+                          src.toString(), dst.toString());
 
         //streams
         byte[] bufSrc = new byte[8192];
@@ -702,6 +889,21 @@
                                   chDst.toString(), chDst.size(), chDst.position());
                 throw new RuntimeException("CHECK FAILED!");
             }
+
+            // Check position(x) + read() at the specific pos/len
+            for (int i = 0; i < 10; i++) {
+                int pos = rdm.nextInt((int)chSrc.size());
+                int limit = rdm.nextInt(1024);
+                if (chSrc.position(pos).position() != chDst.position(pos).position()) {
+                    System.out.printf("dst/src.position(pos failed%n");
+                }
+                bbSrc.clear().limit(limit);
+                bbDst.clear().limit(limit);
+                if (chSrc.read(bbSrc) != chDst.read(bbDst) ||
+                    !bbSrc.flip().equals(bbDst.flip())) {
+                    System.out.printf("dst/src.read() failed%n");
+                }
+            }
         } catch (IOException x) {
             x.printStackTrace();
         }
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 jdk.testlibrary;
-
-import java.io.FileNotFoundException;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-/**
- * @deprecated This class is deprecated. Use the one from
- *             {@code <root>/test/lib/jdk/test/lib}
- */
-@Deprecated
-public final class JDKToolFinder {
-
-    private JDKToolFinder() {
-    }
-
-    /**
-     * Returns the full path to an executable in jdk/bin based on System
-     * property {@code test.jdk} or {@code compile.jdk} (both are set by the jtreg test suite)
-     *
-     * @return Full path to an executable in jdk/bin
-     */
-    public static String getJDKTool(String tool) {
-
-        // First try to find the executable in test.jdk
-        try {
-            return getTool(tool, "test.jdk");
-        } catch (FileNotFoundException e) {
-
-        }
-
-        // Now see if it's available in compile.jdk
-        try {
-            return getTool(tool, "compile.jdk");
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException("Failed to find " + tool +
-                    ", looked in test.jdk (" + System.getProperty("test.jdk") +
-                    ") and compile.jdk (" + System.getProperty("compile.jdk") + ")");
-        }
-    }
-
-    /**
-     * Returns the full path to an executable in jdk/bin based on System
-     * property {@code compile.jdk}
-     *
-     * @return Full path to an executable in jdk/bin
-     */
-    public static String getCompileJDKTool(String tool) {
-        try {
-            return getTool(tool, "compile.jdk");
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    /**
-     * Returns the full path to an executable in jdk/bin based on System
-     * property {@code test.jdk}
-     *
-     * @return Full path to an executable in jdk/bin
-     */
-    public static String getTestJDKTool(String tool) {
-        try {
-            return getTool(tool, "test.jdk");
-        } catch (FileNotFoundException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    private static String getTool(String tool, String property) throws FileNotFoundException {
-        String jdkPath = System.getProperty(property);
-
-        if (jdkPath == null) {
-            throw new RuntimeException(
-                    "System property '" + property + "' not set. This property is normally set by jtreg. "
-                    + "When running test separately, set this property using '-D" + property + "=/path/to/jdk'.");
-        }
-
-        Path toolName = Paths.get("bin", tool + (isWindows() ? ".exe" : ""));
-
-        Path jdkTool = Paths.get(jdkPath, toolName.toString());
-        if (!jdkTool.toFile().exists()) {
-            throw new FileNotFoundException("Could not find file " + jdkTool.toAbsolutePath());
-        }
-
-        return jdkTool.toAbsolutePath().toString();
-    }
-
-    private static boolean isWindows() {
-        return System.getProperty("os.name").toLowerCase().startsWith("win");
-    }
-}
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/JDKToolLauncher.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 jdk.testlibrary;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A utility for constructing command lines for starting JDK tool processes.
- *
- * The JDKToolLauncher can in particular be combined with a
- * java.lang.ProcessBuilder to easily run a JDK tool. For example, the following
- * code run {@code jmap -heap} against a process with GC logging turned on for
- * the {@code jmap} process:
- *
- * <pre>
- * {@code
- * JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
- *                                       .addVMArg("-Xlog:gc*=debug")
- *                                       .addToolArg("-heap")
- *                                       .addToolArg(pid);
- * ProcessBuilder pb = new ProcessBuilder(jmap.getCommand());
- * Process p = pb.start();
- * }
- * </pre>
- * @deprecated This class is deprecated. Use the one from
- *             {@code <root>/test/lib/jdk/test/lib}
- */
-@Deprecated
-public class JDKToolLauncher {
-    private final String executable;
-    private final List<String> vmArgs = new ArrayList<String>();
-    private final List<String> toolArgs = new ArrayList<String>();
-
-    private JDKToolLauncher(String tool, boolean useCompilerJDK) {
-        if (useCompilerJDK) {
-            executable = JDKToolFinder.getJDKTool(tool);
-        } else {
-            executable = JDKToolFinder.getTestJDKTool(tool);
-        }
-    }
-
-    /**
-     * Creates a new JDKToolLauncher for the specified tool. Using tools path
-     * from the compiler JDK.
-     *
-     * @param tool
-     *            The name of the tool
-     * @return A new JDKToolLauncher
-     */
-    public static JDKToolLauncher create(String tool) {
-        return new JDKToolLauncher(tool, true);
-    }
-
-    /**
-     * Creates a new JDKToolLauncher for the specified tool in the Tested JDK.
-     *
-     * @param tool
-     *            The name of the tool
-     *
-     * @return A new JDKToolLauncher
-     */
-    public static JDKToolLauncher createUsingTestJDK(String tool) {
-        return new JDKToolLauncher(tool, false);
-    }
-
-    /**
-     * Adds an argument to the JVM running the tool.
-     *
-     * The JVM arguments are passed to the underlying JVM running the tool.
-     * Arguments will automatically be prepended with "-J".
-     *
-     * Any platform specific arguments required for running the tool are
-     * automatically added.
-     *
-     *
-     * @param arg
-     *            The argument to VM running the tool
-     * @return The JDKToolLauncher instance
-     */
-    public JDKToolLauncher addVMArg(String arg) {
-        vmArgs.add(arg);
-        return this;
-    }
-
-    /**
-     * Adds an argument to the tool.
-     *
-     * @param arg
-     *            The argument to the tool
-     * @return The JDKToolLauncher instance
-     */
-    public JDKToolLauncher addToolArg(String arg) {
-        toolArgs.add(arg);
-        return this;
-    }
-
-    /**
-     * Returns the command that can be used for running the tool.
-     *
-     * @return An array whose elements are the arguments of the command.
-     */
-    public String[] getCommand() {
-        List<String> command = new ArrayList<String>();
-        command.add(executable);
-        // Add -J in front of all vmArgs
-        for (String arg : vmArgs) {
-            command.add("-J" + arg);
-        }
-        command.addAll(toolArgs);
-        return command.toArray(new String[command.size()]);
-    }
-}
--- a/test/jdk/lib/testlibrary/jdk/testlibrary/Utils.java	Tue Sep 18 16:32:39 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,295 +0,0 @@
-/*
- * 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
- * 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 jdk.testlibrary;
-
-import static jdk.testlibrary.Asserts.assertTrue;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.UnknownHostException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import java.util.concurrent.TimeUnit;
-import java.util.function.BooleanSupplier;
-import java.util.function.Function;
-
-/**
- * Common library for various test helper functions.
- *
- * @deprecated This class is deprecated. Use the one from
- *             {@code <root>/test/lib/jdk/test/lib}
- */
-@Deprecated
-public final class Utils {
-
-    /**
-     * Returns the sequence used by operating system to separate lines.
-     */
-    public static final String NEW_LINE = System.getProperty("line.separator");
-
-    /**
-     * Returns the value of 'test.vm.opts'system property.
-     */
-    public static final String VM_OPTIONS = System.getProperty("test.vm.opts", "").trim();
-
-    /**
-     * Returns the value of 'test.java.opts'system property.
-     */
-    public static final String JAVA_OPTIONS = System.getProperty("test.java.opts", "").trim();
-
-    /**
-    * Returns the value of 'test.timeout.factor' system property
-    * converted to {@code double}.
-    */
-    public static final double TIMEOUT_FACTOR;
-    static {
-        String toFactor = System.getProperty("test.timeout.factor", "1.0");
-        TIMEOUT_FACTOR = Double.parseDouble(toFactor);
-    }
-
-    /**
-    * Returns the value of JTREG default test timeout in milliseconds
-    * converted to {@code long}.
-    */
-    public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
-
-    private Utils() {
-        // Private constructor to prevent class instantiation
-    }
-
-    /**
-     * Returns the list of VM options.
-     *
-     * @return List of VM options
-     */
-    public static List<String> getVmOptions() {
-        return Arrays.asList(safeSplitString(VM_OPTIONS));
-    }
-
-    /**
-     * Returns the list of VM options with -J prefix.
-     *
-     * @return The list of VM options with -J prefix
-     */
-    public static List<String> getForwardVmOptions() {
-        String[] opts = safeSplitString(VM_OPTIONS);
-        for (int i = 0; i < opts.length; i++) {
-            opts[i] = "-J" + opts[i];
-        }
-        return Arrays.asList(opts);
-    }
-
-    /**
-     * Returns the default JTReg arguments for a jvm running a test.
-     * This is the combination of JTReg arguments test.vm.opts and test.java.opts.
-     * @return An array of options, or an empty array if no opptions.
-     */
-    public static String[] getTestJavaOpts() {
-        List<String> opts = new ArrayList<String>();
-        Collections.addAll(opts, safeSplitString(VM_OPTIONS));
-        Collections.addAll(opts, safeSplitString(JAVA_OPTIONS));
-        return opts.toArray(new String[0]);
-    }
-
-    /**
-     * Combines given arguments with default JTReg arguments for a jvm running a test.
-     * This is the combination of JTReg arguments test.vm.opts and test.java.opts
-     * @return The combination of JTReg test java options and user args.
-     */
-    public static String[] addTestJavaOpts(String... userArgs) {
-        List<String> opts = new ArrayList<String>();
-        Collections.addAll(opts, getTestJavaOpts());
-        Collections.addAll(opts, userArgs);
-        return opts.toArray(new String[0]);
-    }
-
-    /**
-     * Removes any options specifying which GC to use, for example "-XX:+UseG1GC".
-     * Removes any options matching: -XX:(+/-)Use*GC
-     * Used when a test need to set its own GC version. Then any
-     * GC specified by the framework must first be removed.
-     * @return A copy of given opts with all GC options removed.
-     */
-    private static final Pattern useGcPattern = Pattern.compile(
-            "(?:\\-XX\\:[\\+\\-]Use.+GC)"
-            + "|(?:\\-Xconcgc)");
-    public static List<String> removeGcOpts(List<String> opts) {
-        List<String> optsWithoutGC = new ArrayList<String>();
-        for (String opt : opts) {
-            if (useGcPattern.matcher(opt).matches()) {
-                System.out.println("removeGcOpts: removed " + opt);
-            } else {
-                optsWithoutGC.add(opt);
-            }
-        }
-        return optsWithoutGC;
-    }
-
-    /**
-     * Splits a string by white space.
-     * Works like String.split(), but returns an empty array
-     * if the string is null or empty.
-     */
-    private static String[] safeSplitString(String s) {
-        if (s == null || s.trim().isEmpty()) {
-            return new String[] {};
-        }
-        return s.trim().split("\\s+");
-    }
-
-    /**
-     * @return The full command line for the ProcessBuilder.
-     */
-    public static String getCommandLine(ProcessBuilder pb) {
-        StringBuilder cmd = new StringBuilder();
-        for (String s : pb.command()) {
-            cmd.append(s).append(" ");
-        }
-        return cmd.toString();
-    }
-
-    /**
-     * Returns the free port on the local host.
-     *
-     * @return The port number
-     * @throws IOException if an I/O error occurs when opening the socket
-     */
-    public static int getFreePort() throws IOException {
-        try (ServerSocket serverSocket =
-                new ServerSocket(0, 5, InetAddress.getLoopbackAddress());) {
-            return serverSocket.getLocalPort();
-        }
-    }
-
-    /**
-     * Returns the name of the local host.
-     *
-     * @return The host name
-     * @throws UnknownHostException if IP address of a host could not be determined
-     */
-    public static String getHostname() throws UnknownHostException {
-        InetAddress inetAddress = InetAddress.getLocalHost();
-        String hostName = inetAddress.getHostName();
-
-        assertTrue((hostName != null && !hostName.isEmpty()),
-                "Cannot get hostname");
-
-        return hostName;
-    }
-
-    /**
-     * Adjusts the provided timeout value for the TIMEOUT_FACTOR
-     * @param tOut the timeout value to be adjusted
-     * @return The timeout value adjusted for the value of "test.timeout.factor"
-     *         system property
-     */
-    public static long adjustTimeout(long tOut) {
-        return Math.round(tOut * Utils.TIMEOUT_FACTOR);
-    }
-
-    /**
-     * Wait for condition to be true
-     *
-     * @param condition, a condition to wait for
-     */
-    public static final void waitForCondition(BooleanSupplier condition) {
-        waitForCondition(condition, -1L, 100L);
-    }
-
-    /**
-     * Wait until timeout for condition to be true
-     *
-     * @param condition, a condition to wait for
-     * @param timeout a time in milliseconds to wait for condition to be true
-     * specifying -1 will wait forever
-     * @return condition value, to determine if wait was successfull
-     */
-    public static final boolean waitForCondition(BooleanSupplier condition,
-            long timeout) {
-        return waitForCondition(condition, timeout, 100L);
-    }
-
-    /**
-     * Wait until timeout for condition to be true for specified time
-     *
-     * @param condition, a condition to wait for
-     * @param timeout a time in milliseconds to wait for condition to be true,
-     * specifying -1 will wait forever
-     * @param sleepTime a time to sleep value in milliseconds
-     * @return condition value, to determine if wait was successfull
-     */
-    public static final boolean waitForCondition(BooleanSupplier condition,
-            long timeout, long sleepTime) {
-        long startTime = System.currentTimeMillis();
-        while (!(condition.getAsBoolean() || (timeout != -1L
-                && ((System.currentTimeMillis() - startTime) > timeout)))) {
-            try {
-                Thread.sleep(sleepTime);
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-                throw new Error(e);
-            }
-        }
-        return condition.getAsBoolean();
-    }
-
-    /**
-     * Interface same as java.lang.Runnable but with
-     * method {@code run()} able to throw any Throwable.
-     */
-    public static interface ThrowingRunnable {
-        void run() throws Throwable;
-    }
-
-    /**
-     * Filters out an exception that may be thrown by the given
-     * test according to the given filter.
-     *
-     * @param test - method that is invoked and checked for exception.
-     * @param filter - function that checks if the thrown exception matches
-     *                 criteria given in the filter's implementation.
-     * @return - exception that matches the filter if it has been thrown or
-     *           {@code null} otherwise.
-     * @throws Throwable - if test has thrown an exception that does not
-     *                     match the filter.
-     */
-    public static Throwable filterException(ThrowingRunnable test,
-            Function<Throwable, Boolean> filter) throws Throwable {
-        try {
-            test.run();
-        } catch (Throwable t) {
-            if (filter.apply(t)) {
-                return t;
-            } else {
-                throw t;
-            }
-        }
-        return null;
-    }
-}
--- a/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,6 +32,7 @@
 import java.util.Date;
 import java.util.Locale;
 import javax.swing.JFormattedTextField;
+import javax.swing.UIManager;
 
 import static org.jemmy2ext.JemmyExt.*;
 
@@ -69,9 +70,9 @@
 @Listeners(GuiTestListener.class)
 public class TextFieldDemoTest {
 
-    @Test
-    public void test() throws Exception {
-
+    @Test(dataProvider = "availableLookAndFeels", dataProviderClass = TestHelpers.class)
+    public void test(String lookAndFeel) throws Exception {
+        UIManager.setLookAndFeel(lookAndFeel);
         new ClassReference(TextFieldDemo.class.getCanonicalName()).startApplication();
 
         JFrameOperator frame = new JFrameOperator(DEMO_TITLE);
@@ -144,11 +145,12 @@
         });
 
         // Check non-matching passwords
+        final Color backgroundColor = UIManager.getColor("TextField.background");
         password2.typeText("passwereertegrs");
         password1.waitState(new ComponentChooser() {
             public boolean checkComponent(Component comp) {
-                return password1.getBackground().equals(Color.white) &&
-                       password2.getBackground().equals(Color.white);
+                return password1.getBackground().equals(backgroundColor) &&
+                       password2.getBackground().equals(backgroundColor);
             }
             public String getDescription() {
                 return "Passwords not to match";
--- a/test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java	Tue Sep 18 16:41:24 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2017, 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
@@ -27,7 +27,7 @@
 import java.util.List;
 
 import jdk.testlibrary.Asserts;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import jdk.test.lib.apps.LingeredApp;
 import sun.jvmstat.monitor.MonitorException;
 import sun.jvmstat.monitor.MonitoredHost;
--- a/test/jdk/sun/management/jdp/DynamicLauncher.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jdp/DynamicLauncher.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,7 +24,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 import java.util.UUID;
 
--- a/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 import java.io.IOException;
 import java.net.ServerSocket;
--- a/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -161,10 +161,10 @@
     private int doTest() throws Exception {
 
         for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; ++i) {
-            final String pp = "-Dcom.sun.management.jmxremote.port=" + jdk.testlibrary.Utils.getFreePort();
+            final String pp = "-Dcom.sun.management.jmxremote.port=" + jdk.test.lib.Utils.getFreePort();
 
             List<String> command = new ArrayList<>();
-            command.addAll(jdk.testlibrary.Utils.getVmOptions());
+            command.addAll(jdk.test.lib.Utils.getVmOptions());
             command.add(mp);
             command.add(pp);
             command.add("-cp");
--- a/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -28,7 +28,7 @@
 import java.util.concurrent.atomic.AtomicReference;
 
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /**
  * @test
@@ -38,13 +38,12 @@
  *          TestManager will attempt a connection to the address obtained from
  *          both agent properties and jvmstat buffer.
  *
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
  *          jdk.attach
  *          jdk.management.agent/jdk.internal.agent
  *
- * @build jdk.testlibrary.* TestManager TestApplication
+ * @build TestManager TestApplication
  * @run main/othervm/timeout=300 LocalManagementTest
  */
 public class LocalManagementTest {
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -635,7 +635,7 @@
 
         for (int i = 0; i < MAX_GET_FREE_PORT_TRIES; i++) {
             try {
-                int port = jdk.testlibrary.Utils.getFreePort();
+                int port = jdk.test.lib.Utils.getFreePort();
                 final String path;
                 try {
                     path=(file==null)?null:file.getCanonicalPath();
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -27,9 +27,9 @@
 # @key intermittent
 # @summary Test RMI Bootstrap
 #
-# @library /lib/testlibrary
+# @library /test/lib
 #
-# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
+# @build TestLogger Utils RmiBootstrapTest
 # @run shell/timeout=300  RmiBootstrapTest.sh
 
 # Define the Java class test name
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 import java.io.BufferedReader;
 import java.io.BufferedWriter;
@@ -43,10 +43,9 @@
  * @summary Test that RMI registry uses SSL.
  * @author Luis-Miguel Alventosa, Taras Ledkov
  *
- * @library /lib/testlibrary
  * @library /test/lib
  *
- * @build jdk.testlibrary.* RmiRegistrySslTestApp
+ * @build RmiRegistrySslTestApp
  * @run main/timeout=300 RmiRegistrySslTest
  */
 public class RmiRegistrySslTest {
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTestApp.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTestApp.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -24,7 +24,7 @@
 import java.rmi.registry.LocateRegistry;
 import java.rmi.registry.Registry;
 import javax.rmi.ssl.SslRMIClientSocketFactory;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 
 public class RmiRegistrySslTestApp {
--- a/test/jdk/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -26,9 +26,9 @@
 # @bug     6528083
 # @summary Test RMI Bootstrap with SSL
 #
-# @library /lib/testlibrary
+# @library /test/lib
 #
-# @build jdk.testlibrary.* TestLogger Utils RmiBootstrapTest
+# @build TestLogger Utils RmiBootstrapTest
 # @run shell/timeout=300  RmiSslBootstrapTest.sh
 
 # Define the Java class test name
--- a/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -45,7 +45,7 @@
 import javax.net.ssl.SSLHandshakeException;
 
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import jdk.internal.agent.Agent;
 import jdk.internal.agent.AgentConfigurationError;
 import jdk.internal.agent.ConnectorAddressLink;
@@ -57,13 +57,12 @@
  * @summary Makes sure that enabling/disabling the management agent through JCMD
  *          achieves the desired results
  *
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
  *          java.rmi
  *          jdk.management.agent/jdk.internal.agent
  *
- * @build jdk.testlibrary.* JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd
+ * @build JMXStartStopTest PortAllocator TestApp ManagementAgentJcmd
  * @run main/othervm/timeout=600 -XX:+UsePerfData JMXStartStopTest
  */
 public class JMXStartStopTest {
--- a/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java	Tue Sep 18 16:41:24 2018 -0700
@@ -33,7 +33,7 @@
 import jdk.internal.agent.Agent;
 import jdk.internal.agent.AgentConfigurationError;
 
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.ProcessTools;
 
 /**
--- a/test/jdk/sun/net/InetAddress/nameservice/dns/CNameTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/net/InetAddress/nameservice/dns/CNameTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -38,7 +38,7 @@
  * @summary Test DNS provider's handling of CNAME records
  */
 public class CNameTest {
-    private static final String HOST = "www-proxy.us.oracle.com";
+    private static final String HOST = "www.w3c.org";
     private static final String POLICY = "grant {" + System.lineSeparator() +
             " permission java.net .SocketPermission \"${HOST}\", \"resolve\";" +
             System.lineSeparator() + "};";
--- a/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSDefaultProtocols.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSDefaultProtocols.java	Tue Sep 18 16:41:24 2018 -0700
@@ -191,33 +191,13 @@
             // Check SSLParameters of SSLSocket
             System.out.println();
             System.out.println("\tChecking SSLSocket of this SSLContext");
-            System.out.println("\tChecking SSLSocket.getSSLParameters()");
-            SocketFactory fac = context.getSocketFactory();
-            SSLSocket socket = (SSLSocket)fac.createSocket();
-            parameters = socket.getSSLParameters();
-
-            protocols = parameters.getProtocols();
-            failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
-            ciphers = parameters.getCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
-            protocols = socket.getEnabledProtocols();
-            failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
-            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
-            ciphers = socket.getEnabledCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
-            protocols = socket.getSupportedProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            System.out.println(
-                    "\tChecking SSLEngine.getSupportedCipherSuites()");
-            ciphers = socket.getSupportedCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
+            try {
+                context.getSocketFactory();
+                failed = true;
+                System.out.println("SSLSocket returned a socket for DTLS");
+            } catch (UnsupportedOperationException e) {
+                System.out.println("\t  " + e.getMessage());
+            }
 
             //
             // Check SSLServerSocket
@@ -225,33 +205,13 @@
             // Check SSLParameters of SSLServerSocket
             System.out.println();
             System.out.println("\tChecking SSLServerSocket of this SSLContext");
-            System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
-            SSLServerSocketFactory sf = context.getServerSocketFactory();
-            SSLServerSocket ssocket = (SSLServerSocket)sf.createServerSocket();
-            parameters = ssocket.getSSLParameters();
-
-            protocols = parameters.getProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            ciphers = parameters.getCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
-            protocols = ssocket.getEnabledProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
-            ciphers = ssocket.getEnabledCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
-            protocols = ssocket.getSupportedProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            System.out.println(
-                    "\tChecking SSLEngine.getSupportedCipherSuites()");
-            ciphers = ssocket.getSupportedCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
+            try {
+                context.getServerSocketFactory();
+                failed = true;
+                System.out.println("SSLServerSocket returned a socket for DTLS");
+            } catch (UnsupportedOperationException e) {
+                System.out.println("\t  " + e.getMessage());
+            }
         }
 
         if (failed) {
--- a/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSServerDefaultProtocols.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/CustomizedDTLSServerDefaultProtocols.java	Tue Sep 18 16:41:24 2018 -0700
@@ -31,6 +31,7 @@
  *      CustomizedDTLSServerDefaultProtocols
  */
 
+import java.lang.UnsupportedOperationException;
 import java.security.NoSuchAlgorithmException;
 import java.security.Security;
 import java.util.Arrays;
@@ -211,33 +212,13 @@
             // Check SSLParameters of SSLSocket
             System.out.println();
             System.out.println("\tChecking SSLSocket of this SSLContext");
-            System.out.println("\tChecking SSLSocket.getSSLParameters()");
-            SocketFactory fac = context.getSocketFactory();
-            SSLSocket socket = (SSLSocket) fac.createSocket();
-            parameters = socket.getSSLParameters();
-
-            protocols = parameters.getProtocols();
-            failed |= !checkProtocols(protocols, cv.clientEnabledProtocols);
-
-            ciphers = parameters.getCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLSocket.getEnabledProtocols()");
-            protocols = socket.getEnabledProtocols();
-            failed |= !checkProtocols(protocols, cv.clientEnabledProtocols);
-
-            System.out.println("\tChecking SSLSocket.getEnabledCipherSuites()");
-            ciphers = socket.getEnabledCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLSocket.getSupportedProtocols()");
-            protocols = socket.getSupportedProtocols();
-            failed |= !checkProtocols(protocols, supportedProtocols);
-
-            System.out.println(
-                    "\tChecking SSLSocket.getSupportedCipherSuites()");
-            ciphers = socket.getSupportedCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
+            try {
+                context.getSocketFactory();
+                failed = true;
+                System.out.println("SSLSocket returned a socket for DTLS");
+            } catch (UnsupportedOperationException e) {
+                System.out.println("\t  " + e.getMessage());
+            }
 
             //
             // Check SSLServerSocket
@@ -245,33 +226,13 @@
             // Check SSLParameters of SSLServerSocket
             System.out.println();
             System.out.println("\tChecking SSLServerSocket of this SSLContext");
-            System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
-            SSLServerSocketFactory sf = context.getServerSocketFactory();
-            SSLServerSocket ssocket = (SSLServerSocket) sf.createServerSocket();
-            parameters = ssocket.getSSLParameters();
-
-            protocols = parameters.getProtocols();
-            failed |= !checkProtocols(protocols, cv.serverEnabledProtocols);
-
-            ciphers = parameters.getCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
-            protocols = ssocket.getEnabledProtocols();
-            failed |= !checkProtocols(protocols, cv.serverEnabledProtocols);
-
-            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
-            ciphers = ssocket.getEnabledCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
-            protocols = ssocket.getSupportedProtocols();
-            failed |= !checkProtocols(protocols, supportedProtocols);
-
-            System.out.println(
-                    "\tChecking SSLEngine.getSupportedCipherSuites()");
-            ciphers = ssocket.getSupportedCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
+            try {
+                context.getServerSocketFactory();
+                failed = true;
+                System.out.println("SSLServerSocket returned a socket for DTLS");
+            } catch (UnsupportedOperationException e) {
+                System.out.println("\t  " + e.getMessage());
+            }
 
             if (failed) {
                 throw new Exception("Run into problems, see log for more details");
--- a/test/jdk/sun/security/ssl/SSLContextImpl/DefaultDTLSEnabledProtocols.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/security/ssl/SSLContextImpl/DefaultDTLSEnabledProtocols.java	Tue Sep 18 16:41:24 2018 -0700
@@ -188,33 +188,13 @@
             // Check SSLParameters of SSLSocket
             System.out.println();
             System.out.println("\tChecking SSLSocket of this SSLContext");
-            System.out.println("\tChecking SSLSocket.getSSLParameters()");
-            SocketFactory fac = context.getSocketFactory();
-            SSLSocket socket = (SSLSocket)fac.createSocket();
-            parameters = socket.getSSLParameters();
-
-            protocols = parameters.getProtocols();
-            failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
-            ciphers = parameters.getCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
-            protocols = socket.getEnabledProtocols();
-            failed |= !checkProtocols(protocols, cv.enabledProtocols);
-
-            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
-            ciphers = socket.getEnabledCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
-            protocols = socket.getSupportedProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            System.out.println(
-                    "\tChecking SSLEngine.getSupportedCipherSuites()");
-            ciphers = socket.getSupportedCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
+            try {
+                context.getSocketFactory();
+                failed = true;
+                System.out.println("SSLSocket returned a socket for DTLS");
+            } catch (UnsupportedOperationException e) {
+                System.out.println("\t  " + e.getMessage());
+            }
 
             //
             // Check SSLServerSocket
@@ -222,33 +202,13 @@
             // Check SSLParameters of SSLServerSocket
             System.out.println();
             System.out.println("\tChecking SSLServerSocket of this SSLContext");
-            System.out.println("\tChecking SSLServerSocket.getSSLParameters()");
-            SSLServerSocketFactory sf = context.getServerSocketFactory();
-            SSLServerSocket ssocket = (SSLServerSocket)sf.createServerSocket();
-            parameters = ssocket.getSSLParameters();
-
-            protocols = parameters.getProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            ciphers = parameters.getCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getEnabledProtocols()");
-            protocols = ssocket.getEnabledProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            System.out.println("\tChecking SSLEngine.getEnabledCipherSuites()");
-            ciphers = ssocket.getEnabledCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
-
-            System.out.println("\tChecking SSLEngine.getSupportedProtocols()");
-            protocols = ssocket.getSupportedProtocols();
-            failed |= !checkProtocols(protocols, cv.supportedProtocols);
-
-            System.out.println(
-                    "\tChecking SSLEngine.getSupportedCipherSuites()");
-            ciphers = ssocket.getSupportedCipherSuites();
-            failed |= !checkCipherSuites(ciphers);
+            try {
+                context.getServerSocketFactory();
+                failed = true;
+                System.out.println("SSLServerSocket returned a socket for DTLS");
+            } catch (UnsupportedOperationException e) {
+                System.out.println("\t  " + e.getMessage());
+            }
         }
 
         if (failed) {
--- a/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8164879
- * @library /lib/testlibrary ../../
+ * @library ../../
  * @library /test/lib
  * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
  * start a new handshake sequence to renegotiate the symmetric key with an
@@ -56,7 +56,7 @@
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 public class SSLEngineKeyLimit {
 
--- a/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,7 +24,7 @@
 /*
  * @test
  * @bug 8164879
- * @library /lib/testlibrary ../../
+ * @library ../../
  * @library /test/lib
  * @modules java.base/sun.security.util
  * @summary Verify AES/GCM's limits set in the jdk.tls.keyLimits property
@@ -58,7 +58,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import sun.security.util.HexDumpEncoder;
 
 public class SSLSocketKeyLimit {
--- a/test/jdk/sun/security/tools/jarsigner/Warning.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/security/tools/jarsigner/Warning.java	Tue Sep 18 16:41:24 2018 -0700
@@ -21,7 +21,7 @@
  * questions.
  */
 
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.util.JarUtils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
--- a/test/jdk/sun/tools/jcmd/JcmdBase.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jcmd/JcmdBase.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,7 +25,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.test.lib.JDKToolLauncher;
 
 /**
  * Helper class for starting jcmd process.
--- a/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java	Tue Sep 18 16:41:24 2018 -0700
@@ -30,7 +30,7 @@
 import java.util.List;
 
 import jdk.test.lib.process.OutputAnalyzer;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * @test
--- a/test/jdk/sun/tools/jcmd/TestJcmdSanity.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jcmd/TestJcmdSanity.java	Tue Sep 18 16:41:24 2018 -0700
@@ -32,7 +32,7 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /*
  * @test
--- a/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,9 +25,7 @@
  * @test
  * @summary Basic test for jhsdb launcher
  * @library /test/lib
- * @library /lib/testlibrary
  * @requires vm.hasSAandCanAttach
- * @build jdk.testlibrary.*
  * @build jdk.test.lib.apps.*
  * @run main BasicLauncherTest
  */
@@ -44,8 +42,8 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.apps.LingeredApp;
 import jdk.test.lib.Platform;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
 
 public class BasicLauncherTest {
 
--- a/test/jdk/sun/tools/jhsdb/HeapDumpTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jhsdb/HeapDumpTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -39,12 +39,12 @@
 import java.util.List;
 import java.util.Arrays;
 
+import jdk.test.lib.Platform;
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.apps.LingeredApp;
-import jdk.test.lib.Platform;
 import jdk.test.lib.hprof.parser.HprofReader;
-import jdk.testlibrary.JDKToolLauncher;
 
 public class HeapDumpTest {
 
--- a/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -29,7 +29,7 @@
 import java.util.Map;
 
 import jdk.test.lib.apps.LingeredApp;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import jdk.test.lib.Platform;
 
 /**
@@ -39,7 +39,6 @@
  *
  * @requires vm.hasSAandCanAttach
  * @library /test/lib
- * @library /lib/testlibrary
  * @modules java.management
  *          jdk.hotspot.agent/sun.jvm.hotspot
  *
--- a/test/jdk/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -33,8 +33,8 @@
 import java.util.logging.Logger;
 
 import jdk.test.lib.apps.LingeredApp;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.Utils;
 
 public class TmtoolTestScenario {
 
--- a/test/jdk/sun/tools/jinfo/BasicJInfoTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jinfo/BasicJInfoTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,16 +23,14 @@
 
 import java.util.Arrays;
 
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolLauncher;
 
 /*
  * @test
  * @summary Unit test for jinfo utility
- * @library /lib/testlibrary
  * @library /test/lib
- * @build jdk.testlibrary.*
  * @run main BasicJInfoTest
  */
 public class BasicJInfoTest {
--- a/test/jdk/sun/tools/jmap/BasicJMapTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jmap/BasicJMapTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,10 +27,10 @@
 import java.io.File;
 import java.util.Arrays;
 
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.hprof.HprofParser;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolLauncher;
 
 /*
  * @test
--- a/test/jdk/sun/tools/jps/JpsHelper.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jps/JpsHelper.java	Tue Sep 18 16:41:24 2018 -0700
@@ -35,11 +35,11 @@
 import java.util.Arrays;
 import java.util.List;
 
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 import jdk.testlibrary.Asserts;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 
 /**
  * The helper class for running jps utility and verifying output from it
--- a/test/jdk/sun/tools/jstack/BasicJStackTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jstack/BasicJStackTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,14 +25,12 @@
 
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.test.lib.JDKToolLauncher;
 
 /*
  * @test
  * @summary Unit test for jstack utility
- * @library /lib/testlibrary
  * @library /test/lib
- * @build jdk.testlibrary.*
  * @run main BasicJStackTest
  */
 public class BasicJStackTest {
--- a/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -31,16 +31,14 @@
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
-import jdk.testlibrary.Utils;
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.test.lib.Utils;
+import jdk.test.lib.JDKToolLauncher;
 
 /**
  * @test
  * @summary Test deadlock detection
  * @requires vm.hasSAandCanAttach
  * @library /test/lib
- * @library /lib/testlibrary
- * @build jdk.testlibrary.*
  * @build jdk.test.lib.apps.* jdk.test.lib.Platform
  * @build DeadlockDetectionTest
  * @run main DeadlockDetectionTest
--- a/test/jdk/sun/tools/jstat/JStatInterval.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jstat/JStatInterval.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,18 +24,17 @@
 /**
  * @test
  * @bug 8035668
- * @library /lib/testlibrary
  * @library /test/lib
  * @summary Test checks case when target application finishes execution and jstat didn't complete work.
             jstat is started with interval = 100 (jstat -compiler 100) and monitored application finishes
             after 500ms. This shouldn't cause crash or hang in target application or in jstat.
  * @modules java.management
- * @build jdk.testlibrary.* JStatInterval
+ * @build JStatInterval
  * @run main JStatInterval
  */
 
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.ProcessTools;
-import jdk.testlibrary.JDKToolLauncher;
 
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
--- a/test/jdk/sun/tools/jstat/jstatClassloadOutput1.sh	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jstat/jstatClassloadOutput1.sh	Tue Sep 18 16:41:24 2018 -0700
@@ -22,7 +22,7 @@
 #
 
 # @test
-# @bug 6959965 
+# @bug 6959965
 # @run shell jstatClassloadOutput1.sh
 # @summary Test that output of 'jstat -classload 0' has expected line counts
 
--- a/test/jdk/sun/tools/jstatd/JstatGCUtilParser.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jstatd/JstatGCUtilParser.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 import java.util.Arrays;
 
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
 import static jdk.testlibrary.Asserts.*;
 import java.text.NumberFormat;
 
--- a/test/jdk/sun/tools/jstatd/JstatdTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jstatd/JstatdTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -30,8 +30,8 @@
 
 import jdk.test.lib.thread.ProcessThread;
 import static jdk.testlibrary.Asserts.*;
-import jdk.testlibrary.JDKToolLauncher;
-import jdk.testlibrary.Utils;
+import jdk.test.lib.Utils;
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
--- a/test/jdk/sun/tools/jstatd/TestJstatdUsage.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/sun/tools/jstatd/TestJstatdUsage.java	Tue Sep 18 16:41:24 2018 -0700
@@ -21,17 +21,15 @@
  * questions.
  */
 
-import jdk.testlibrary.JDKToolLauncher;
+import jdk.test.lib.JDKToolLauncher;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
 /*
  * @test
  * @bug 4990825
- * @library /lib/testlibrary
  * @library /test/lib
  * @modules java.management
- * @build jdk.testlibrary.*
  * @run main TestJstatdUsage
  */
 public class TestJstatdUsage {
--- a/test/jdk/tools/jar/compat/CLICompatibility.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/tools/jar/compat/CLICompatibility.java	Tue Sep 18 16:41:24 2018 -0700
@@ -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
@@ -36,7 +36,7 @@
 import java.util.stream.Stream;
 
 import jdk.test.lib.util.FileUtils;
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.JDKToolFinder;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
@@ -52,7 +52,7 @@
  * @library /lib/testlibrary /test/lib
  * @build jdk.test.lib.Platform
  *        jdk.test.lib.util.FileUtils
- *        jdk.testlibrary.JDKToolFinder
+ *        jdk.test.lib.JDKToolFinder
  * @run testng CLICompatibility
  * @summary Basic test for compatibility of CLI options
  */
--- a/test/jdk/tools/jar/modularJar/Basic.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/tools/jar/modularJar/Basic.java	Tue Sep 18 16:41:24 2018 -0700
@@ -36,7 +36,7 @@
 import java.util.stream.Stream;
 
 import jdk.test.lib.util.FileUtils;
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.JDKToolFinder;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
@@ -47,12 +47,12 @@
 /*
  * @test
  * @bug 8167328 8171830 8165640 8174248 8176772 8196748 8191533
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
  *          jdk.jartool
  * @build jdk.test.lib.Platform
  *        jdk.test.lib.util.FileUtils
- *        jdk.testlibrary.JDKToolFinder
+ *        jdk.test.lib.JDKToolFinder
  * @compile Basic.java
  * @run testng Basic
  * @summary Tests for plain Modular jars & Multi-Release Modular jars
--- a/test/jdk/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jdk/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java	Tue Sep 18 16:41:24 2018 -0700
@@ -25,7 +25,7 @@
  * @test
  * @bug 8157068 8177844
  * @summary Patch java.base and user module with ModuleHashes attribute
- * @library /lib/testlibrary /test/lib
+ * @library /test/lib
  * @modules jdk.compiler
  * @build jdk.test.lib.compiler.CompilerUtils
  *        jdk.test.lib.util.FileUtils
@@ -43,7 +43,7 @@
 
 import jdk.test.lib.compiler.CompilerUtils;
 import jdk.test.lib.util.FileUtils;
-import jdk.testlibrary.JDKToolFinder;
+import jdk.test.lib.JDKToolFinder;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
--- a/test/jtreg-ext/requires/VMProps.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/jtreg-ext/requires/VMProps.java	Tue Sep 18 16:41:24 2018 -0700
@@ -84,7 +84,7 @@
         map.put("vm.hasJFR", vmHasJFR());
         map.put("vm.cpu.features", cpuFeatures());
         map.put("vm.rtm.cpu", vmRTMCPU());
-        map.put("vm.rtm.os", vmRTMOS());
+        map.put("vm.rtm.compiler", vmRTMCompiler());
         map.put("vm.aot", vmAOT());
         // vm.cds is true if the VM is compiled with cds support.
         map.put("vm.cds", vmCDS());
@@ -131,8 +131,6 @@
         }
     }
 
-
-
     /**
      * @return VM type value extracted from the "java.vm.name" property.
      */
@@ -301,24 +299,16 @@
     }
 
     /**
-     * @return true if VM runs RTM supported OS and false otherwise.
+     * @return true if compiler in use supports RTM and false otherwise.
      */
-    protected String vmRTMOS() {
-        boolean isRTMOS = true;
+    protected String vmRTMCompiler() {
+        boolean isRTMCompiler = false;
 
-        if (Platform.isAix()) {
-            // Actually, this works since AIX 7.1.3.30, but os.version property
-            // is set to 7.1.
-            isRTMOS = (Platform.getOsVersionMajor()  > 7) ||
-                      (Platform.getOsVersionMajor() == 7 && Platform.getOsVersionMinor() > 1);
-
-        } else if (Platform.isLinux()) {
-            if (Platform.isPPC()) {
-                isRTMOS = (Platform.getOsVersionMajor()  > 4) ||
-                          (Platform.getOsVersionMajor() == 4 && Platform.getOsVersionMinor() > 1);
-            }
+        if (Compiler.isC2Enabled() &&
+            (Platform.isX86() || Platform.isX64() || Platform.isPPC())) {
+            isRTMCompiler = true;
         }
-        return "" + isRTMOS;
+        return "" + isRTMCompiler;
     }
 
     /**
--- a/test/langtools/jdk/jshell/ToolLocalSimpleTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/langtools/jdk/jshell/ToolLocalSimpleTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -85,4 +85,9 @@
         );
     }
 
+    @Test
+    public void testRawString() {
+        // can't set --enable-preview for local, ignore
+    }
+
 }
--- a/test/langtools/jdk/jshell/ToolSimpleTest.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/langtools/jdk/jshell/ToolSimpleTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801
+ * @bug 8153716 8143955 8151754 8150382 8153920 8156910 8131024 8160089 8153897 8167128 8154513 8170015 8170368 8172102 8172103  8165405 8173073 8173848 8174041 8173916 8174028 8174262 8174797 8177079 8180508 8177466 8172154 8192979 8191842 8198573 8198801 8210596
  * @summary Simple jshell tool tests
  * @modules jdk.compiler/com.sun.tools.javac.api
  *          jdk.compiler/com.sun.tools.javac.main
@@ -75,6 +75,22 @@
     }
 
     @Test
+    public void testRawString() {
+         test(false, new String[]{"--enable-preview", "--no-startup"},
+                 (a) -> assertCommand(a, "String s = `abc`", "s ==> \"abc\""),
+                 (a) -> assertCommand(a, "String a = `abc", ""),
+                 (a) -> assertCommand(a, "def`", "a ==> \"abc\\ndef\""),
+                 (a) -> assertCommand(a, "String bj = ``Hi, `Bob` and ```Jim```.``", "bj ==> \"Hi, `Bob` and ```Jim```.\""),
+                 (a) -> assertCommand(a, "String hw = ````````````", ""),
+                 (a) -> assertCommand(a, "Hello, world", ""),
+                 (a) -> assertCommand(a, "````````````;", "hw ==> \"\\nHello, world\\n\""),
+                 (a) -> assertCommand(a, "String uc = `\\u000d\\u000a`", "uc ==> \"\\\\u000d\\\\u000a\""),
+                 (a) -> assertCommand(a, "String es = `\\(.\\)\\1`", "es ==> \"\\\\(.\\\\)\\\\1\""),
+                 (a) -> assertCommand(a, "String end = `abc`+`def`+`ghi`", "end ==> \"abcdefghi\"")
+        );
+    }
+
+    @Test
     public void testLessThan() {
         test(
                 (a) -> assertCommand(a, "45", "$1 ==> 45"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/AvoidNPEAtClassReader/AvoidNPEAtClassReaderTest.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,42 @@
+/*
+ * 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 8207160
+ * @summary ClassReader::adjustMethodParams can potentially return null if the args list is empty
+ * @compile pkg/Outer.jasm pkg/Outer$Inner.jasm AvoidNPEAtClassReaderTest.java
+ */
+
+import pkg.*;
+
+/** this test is checking that javac doesn't fail with NPE when reading inner classes with constructors
+ *  that doesn't have as a parameter a reference to the outer class. Such constructors were generated by
+ *  versions of javac previous to JDK7.
+ */
+
+public class AvoidNPEAtClassReaderTest {
+    public void bar(Outer outer) {
+        Object stuff = outer.foo();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/AvoidNPEAtClassReader/pkg/Outer$Inner.jasm	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,42 @@
+/*
+ * 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  pkg;
+
+super public final class Outer$Inner
+	version 56:0
+{
+
+final synthetic Field this$0:"Lpkg/Outer;";
+
+public Method "<init>":"()V"
+	stack 1 locals 1
+{
+		aload_0;
+		invokespecial	Method java/lang/Object."<init>":"()V";
+		return;
+}
+
+public final InnerClass Inner=class Outer$Inner of class Outer;
+
+} // end Class Outer$Inner
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/AvoidNPEAtClassReader/pkg/Outer.jasm	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,48 @@
+/*
+ * 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  pkg;
+
+super public class Outer
+	version 56:0
+{
+
+
+public Method "<init>":"()V"
+	stack 1 locals 1
+{
+		aload_0;
+		invokespecial	Method java/lang/Object."<init>":"()V";
+		return;
+}
+
+public Method foo:"()Lpkg/Outer$Inner;"
+	stack 1 locals 1
+{
+		aconst_null;
+		areturn;
+}
+
+public final InnerClass Inner=class Outer$Inner of class Outer;
+
+} // end Class Outer
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/RawStringLiteralLang.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,101 @@
+/*
+ * 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
+ * @summary Unit tests for Raw String Literal language changes
+ * @compile --enable-preview -source 12 -encoding utf8 RawStringLiteralLang.java
+ * @run main/othervm --enable-preview RawStringLiteralLang
+ */
+
+public class RawStringLiteralLang {
+    public static void main(String... args) {
+        test1();
+        test2();
+    }
+
+    /*
+     * Test raw string functionality.
+     */
+    static void test1() {
+        EQ(`abc`, "abc");
+        EQ(`can't`, "can\'t");
+        EQ(``can`t``, "can`t");
+        EQ(`can\\'t`, "can\\\\'t");
+        EQ(``can\\`t``, "can\\\\`t");
+        EQ(`\t`, "\\t");
+        EQ(`•`, "\u2022");
+
+        LENGTH("abc``def", 8);
+        EQ("abc`\u0020`def", "abc` `def");
+    }
+
+    /*
+     * Test multi-line string functionality.
+     */
+    static void test2() {
+        EQ(`abc
+def
+ghi`, "abc\ndef\nghi");
+        EQ(`abc
+def
+ghi
+`, "abc\ndef\nghi\n");
+        EQ(`
+abc
+def
+ghi`, "\nabc\ndef\nghi");
+        EQ(`
+abc
+def
+ghi
+`, "\nabc\ndef\nghi\n");
+    }
+
+    /*
+     * Raise an exception if the string is not the expected length.
+     */
+    static void LENGTH(String rawString, int length) {
+        if (rawString == null || rawString.length() != length) {
+            System.err.println("Failed LENGTH");
+            System.err.println(rawString + " " + length);
+            throw new RuntimeException("Failed LENGTH");
+        }
+    }
+
+    /*
+     * Raise an exception if the two input strings are not equal.
+     */
+    static void EQ(String input, String expected) {
+        if (input == null || expected == null || !expected.equals(input)) {
+            System.err.println("Failed EQ");
+            System.err.println();
+            System.err.println("Input:");
+            System.err.println(input.replaceAll(" ", "."));
+            System.err.println();
+            System.err.println("Expected:");
+            System.err.println(expected.replaceAll(" ", "."));
+            throw new RuntimeException();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/RawStringLiteralLangAPI.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,169 @@
+/*
+ * 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
+ * @summary Unit tests for Raw String Literal language changes
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.ToolBox toolbox.JavacTask
+ * @run main RawStringLiteralLangAPI
+ */
+
+import toolbox.JavacTask;
+import toolbox.JavaTask;
+import toolbox.Task;
+import toolbox.ToolBox;
+
+public class RawStringLiteralLangAPI {
+    private static ToolBox TOOLBOX = new ToolBox();
+
+    public static void main(String... args) {
+        test1();
+        test2();
+        test3();
+        test4();
+    }
+
+    /*
+     * Check that correct/incorrect syntax is properly detected
+     */
+    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) {
+            String code =
+                    "public class RawStringLiteralTest {\n" +
+                            "    public static void main(String... args) {\n" +
+                            "        String xxx = " +
+                            "`".repeat(i) + a + "`".repeat(j) + b + "`".repeat(k) + ";\n" +
+                            "    }\n" +
+                            "}\n";
+            if (i == k && j != i) {
+                compPass(code);
+            } else {
+                compFail(code);
+            }
+        }}}}}
+    }
+
+    /*
+     * Check that misuse of \u0060 is properly detected
+     */
+    static void test2() {
+        compFail("public class BadDelimiter {\n" +
+                "    public static void main(String... args) {\n" +
+                "        String xxx = \\u0060`abc`;\n" +
+                "    }\n" +
+                "}\n");
+    }
+
+    /*
+     * Check edge cases of raw string literal as last token
+     */
+    static void test3() {
+        compFail("public class RawStringLiteralTest {\n" +
+                "    public static void main(String... args) {\n" +
+                "        String xxx = `abc`");
+        compFail("public class RawStringLiteralTest {\n" +
+                "    public static void main(String... args) {\n" +
+                "        String xxx = `abc");
+        compFail("public class RawStringLiteralTest {\n" +
+                "    public static void main(String... args) {\n" +
+                "        String xxx = `abc\u0000");
+    }
+
+
+    /*
+     * Check line terminator translation
+     */
+    static void test4() {
+        String[] terminators = new String[] { "\n", "\r\n", "\r" };
+        for (String terminator : terminators) {
+            String code = "public class LineTerminatorTest {" + terminator +
+                          "    public static void main(String... args) {" + terminator +
+                          "        String s =" + terminator +
+                          "`" + terminator +
+                          "abc" + terminator +
+                          "`;" + terminator +
+                          "        System.out.println(s.equals(\"\\nabc\\n\"));" + terminator +
+                          "    }" + terminator +
+                          "}" + terminator;
+            new JavacTask(TOOLBOX)
+                    .sources(code)
+                    .classpath(".")
+                    .options("--enable-preview", "-source", "12")
+                    .run();
+            String output = new JavaTask(TOOLBOX)
+                    .vmOptions("--enable-preview")
+                    .classpath(".")
+                    .classArgs("LineTerminatorTest")
+                    .run()
+                    .writeAll()
+                    .getOutput(Task.OutputKind.STDOUT);
+
+            if (!output.contains("true")) {
+                throw new RuntimeException("Error detected");
+            }
+        }
+    }
+
+    /*
+     * Test source for successful compile.
+     */
+    static void compPass(String source) {
+        String output = new JavacTask(TOOLBOX)
+                .sources(source)
+                .classpath(".")
+                .options("--enable-preview", "-source", "12", "-encoding", "utf8")
+                .run()
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (output.contains("compiler.err")) {
+            throw new RuntimeException("Error detected");
+        }
+    }
+
+    /*
+     * Test source for unsuccessful compile and specific error.
+     */
+    static void compFail(String source)  {
+        String errors = new JavacTask(TOOLBOX)
+                .sources(source)
+                .classpath(".")
+                .options("-XDrawDiagnostics", "--enable-preview", "-source", "12", "-encoding", "utf8")
+                .run(Task.Expect.FAIL)
+                .writeAll()
+                .getOutput(Task.OutputKind.DIRECT);
+
+        if (!errors.contains("compiler.err")) {
+            throw new RuntimeException("No error detected");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/cycle/T8193561.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8193561
+ * @summary Verify that there is no crash for default methods in mutually dependent interfaces
+ * @compile/fail/ref=T8193561.out -XDrawDiagnostics T8193561.java
+ */
+package p;
+
+interface T8193561 extends p.T8193561.I {
+
+    interface I  extends T8193561 {
+        default boolean m() {
+            return false;
+        }
+    }
+
+    default boolean m() {
+        return false;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/cycle/T8193561.out	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,2 @@
+T8193561.java:9:1: compiler.err.cyclic.inheritance: p.T8193561
+1 error
--- a/test/langtools/tools/javac/desugar/BoxingAndSuper.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/langtools/tools/javac/desugar/BoxingAndSuper.java	Tue Sep 18 16:41:24 2018 -0700
@@ -100,7 +100,7 @@
                 "p.Test.dump()java.lang.Integer\n" +
                 "{\n" +
                 "    return (let /*synthetic*/ final Integer $le0 = (Integer)super.i " +
-                            "in (let /*synthetic*/ final Integer $le1 = super.i = Integer.valueOf((int)(super.i.intValue() + 1)) " +
+                            "in (let super.i = Integer.valueOf((int)(super.i.intValue() + 1)); " +
                                 "in $le0));\n" +
                 "}\n");
         //qualified super, same package:
@@ -121,7 +121,7 @@
                 "p.Test.Inner.dump()java.lang.Integer\n" +
                 "{\n" +
                 "    return (let /*synthetic*/ final Integer $le0 = (Integer)Test.access$001(this$0) " +
-                            "in (let /*synthetic*/ final Integer $le1 = Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))) " +
+                            "in (let Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))); " +
                                 "in $le0));\n" +
                 "}\n" +
                 "p.Test.access$001(p.Test)java.lang.Integer\n" +
@@ -152,7 +152,7 @@
                 "p1.Test.dump()java.lang.Integer\n" +
                 "{\n" +
                 "    return (let /*synthetic*/ final Integer $le0 = (Integer)super.i " +
-                            "in (let /*synthetic*/ final Integer $le1 = super.i = Integer.valueOf((int)(super.i.intValue() + 1)) " +
+                            "in (let super.i = Integer.valueOf((int)(super.i.intValue() + 1)); " +
                                 "in $le0));\n" +
                 "}\n");
         //qualified super, different packages:
@@ -173,7 +173,7 @@
                 "p1.Test.Inner.dump()java.lang.Integer\n" +
                 "{\n" +
                 "    return (let /*synthetic*/ final Integer $le0 = (Integer)Test.access$001(this$0) " +
-                            "in (let /*synthetic*/ final Integer $le1 = Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))) " +
+                            "in (let Test.access$103(this$0, Integer.valueOf((int)(Test.access$201(this$0).intValue() + 1))); " +
                                 "in $le0));\n" +
                 "}\n" +
                 "p1.Test.access$001(p1.Test)java.lang.Integer\n" +
@@ -201,8 +201,8 @@
         String expected =
                 "Test.dump()void\n" +
                 "{\n" +
-                "    (let /*synthetic*/ final Integer $le0 = i in (let /*synthetic*/ final Integer $le1 = i = Integer.valueOf((int)(i.intValue() + 1)) in $le0));\n" +
-                "    (let /*synthetic*/ final Integer $le2 = (Integer)this.i in (let /*synthetic*/ final Integer $le3 = this.i = Integer.valueOf((int)(this.i.intValue() + 1)) in $le2));\n" +
+                "    (let /*synthetic*/ final Integer $le0 = i in (let i = Integer.valueOf((int)(i.intValue() + 1)); in $le0));\n" +
+                "    (let /*synthetic*/ final Integer $le1 = (Integer)this.i in (let this.i = Integer.valueOf((int)(this.i.intValue() + 1)); in $le1));\n" +
                 "}\n";
         runTest(code, expected);
         //qualified this:
@@ -219,8 +219,8 @@
                 "Test.Inner1.Inner2.dump()java.lang.Integer\n" +
                 "{\n" +
                 "    return (let /*synthetic*/ final Integer $le0 = (Integer)this$1.this$0.i" +
-                           " in (let /*synthetic*/ final Integer $le1 = this$1.this$0.i = " +
-                                "Integer.valueOf((int)(this$1.this$0.i.intValue() + 1)) " +
+                           " in (let this$1.this$0.i = " +
+                                "Integer.valueOf((int)(this$1.this$0.i.intValue() + 1)); " +
                                 "in $le0));\n" +
                 "}\n"
         );
@@ -329,7 +329,8 @@
                         LetExpr le = (LetExpr) tree;
 
                         for (JCStatement var : le.defs) {
-                            letExprRemap.put(((JCVariableDecl) var).name.toString(), "$le" + i++);
+                            if (var.hasTag(Tag.VARDEF))
+                                letExprRemap.put(((JCVariableDecl) var).name.toString(), "$le" + i++);
                         }
                     }
                     return super.visitOther(node, p);
--- a/test/langtools/tools/javac/diags/examples/IllegalChar.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/langtools/tools/javac/diags/examples/IllegalChar.java	Tue Sep 18 16:41:24 2018 -0700
@@ -24,5 +24,5 @@
 // key: compiler.err.illegal.char
 
 class IllegalChar {
-    int i = `;
+    int i = #;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/diags/examples/RawStringLiteral.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+// key: compiler.err.unicode.backtick
+// key: compiler.misc.feature.raw.string.literals
+// key: compiler.warn.preview.feature.use.plural
+// options: --enable-preview -source 12 -Xlint:preview
+
+class RawStringLiteral {
+    String m() {
+        return `abc` + \u0060`def`;
+    }
+}
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/methodReference/MethodRefStuck.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ *
+ * Please 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 8210483
+ * @summary AssertionError in DeferredAttr at setOverloadKind caused by JDK-8203679
+ * @compile/fail/ref=MethodRefStuck.out -XDrawDiagnostics MethodRefStuck.java
+ */
+
+import java.util.Optional;
+import java.util.stream.Stream;
+
+public abstract class MethodRefStuck {
+  public static void main(Stream<String> xs, Optional<String> x) {
+    xs.map(
+        c -> {
+          return new I(x.map(c::equals));
+        });
+  }
+
+  static class I {
+    I(boolean i) {}
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/lambda/methodReference/MethodRefStuck.out	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,2 @@
+MethodRefStuck.java:38:18: compiler.err.cant.apply.symbol: kindname.constructor, I, boolean, java.util.Optional<java.lang.Boolean>, kindname.class, MethodRefStuck.I, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: U, java.util.Optional<U>, boolean))
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/ClassAnnotations.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2018, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * @test
+ * @bug 8193037
+ * @summary ensure annotations on package-infos loaded from the classpath are reported on all
+ *     processing rounds
+ * @library /tools/javac/lib
+ * @modules java.compiler jdk.compiler
+ * @build Processor
+ * @compile package-info.java
+ * @compile -processor Processor ClassAnnotations.java
+ */
+package p;
+
+public class ClassAnnotations {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/Processor.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2018, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class Processor extends JavacTestingAbstractProcessor {
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        PackageElement p = processingEnv.getElementUtils().getPackageElement("p");
+        // Ensure that the annotations on the package-info for p are present during all annotation
+        // processing rounds.
+        if (p.getAnnotationMirrors().isEmpty()) {
+            throw new AssertionError("expected package annotations");
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/PackageInfo/ClassAnnotations/package-info.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2018, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+@Deprecated
+package p;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Overwrite.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2018, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+/**
+ * @test
+ * @bug 8193037
+ * @summary ensure package-infos are reset between annotation processing rounds
+ * @library /tools/javac/lib
+ * @modules java.compiler jdk.compiler
+ * @build Processor
+ * @compile package-info.java
+ * @compile -processor Processor Overwrite.java
+ */
+package p;
+
+public class Overwrite {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/Processor.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2018, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+import static java.nio.charset.StandardCharsets.UTF_8;
+
+import java.io.IOError;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Set;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.element.PackageElement;
+import javax.lang.model.element.TypeElement;
+
+@SupportedAnnotationTypes("*")
+public class Processor extends JavacTestingAbstractProcessor {
+
+    boolean first = true;
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
+        if (first) {
+            // Annotations are present on the initial package-info loaded from the classpath.
+            PackageElement p = processingEnv.getElementUtils().getPackageElement("p");
+            if (p.getAnnotationMirrors().isEmpty()) {
+                throw new AssertionError(
+                        "expected package annotations: " + p.getAnnotationMirrors());
+            }
+            // Overwrite the package-info with a new unannotated package-info.
+            try (OutputStream os =
+                    processingEnv
+                            .getFiler()
+                            .createSourceFile("p.package-info")
+                            .openOutputStream()) {
+                os.write("package p;".getBytes(UTF_8));
+            } catch (IOException e) {
+                throw new IOError(e);
+            }
+            first = false;
+        }
+        // The package-info's symbol should be reset between rounds, and when annotation
+        // processing is over the package-info should be unannotated.
+        PackageElement p = processingEnv.getElementUtils().getPackageElement("p");
+        if (roundEnv.processingOver()) {
+            if (!p.getAnnotationMirrors().isEmpty()) {
+                throw new AssertionError(
+                        "expected no package annotations: " + p.getAnnotationMirrors());
+            }
+        }
+        return false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/processing/PackageInfo/Overwrite/package-info.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2018, Google Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+@Deprecated
+package p;
--- a/test/langtools/tools/jdeps/MultiReleaseJar.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/langtools/tools/jdeps/MultiReleaseJar.java	Tue Sep 18 16:41:24 2018 -0700
@@ -27,7 +27,7 @@
  * @summary Tests for jdeps tool with multi-release jar files
  * @modules jdk.jdeps/com.sun.tools.jdeps
  * @library mrjar mrjar/base mrjar/9 mrjar/10 mrjar/v9 mrjar/v10
- * @build test.* p.* q.*
+ * @build test.* p.* q.* foo/*
  * @run testng MultiReleaseJar
  */
 
@@ -37,11 +37,9 @@
 import org.testng.annotations.Test;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.InputStream;
 import java.nio.file.Path;
 import java.nio.file.Paths;
-import java.util.concurrent.TimeUnit;
 import java.util.stream.Stream;
 
 public class MultiReleaseJar {
@@ -54,10 +52,10 @@
     public void initialize() throws Exception {
         String testClassPath = System.getProperty("test.class.path", "");
         mrjar = Stream.of(testClassPath.split(File.pathSeparator))
-                .map(Paths::get)
-                .filter(e -> e.endsWith("mrjar"))
-                .findAny()
-                .orElseThrow(() -> new InternalError("mrjar not found"));
+                      .map(Paths::get)
+                      .filter(e -> e.endsWith("mrjar"))
+                      .findAny()
+                      .orElseThrow(() -> new InternalError("mrjar not found"));
         testJdk = System.getProperty("test.jdk");
         fileSep = System.getProperty("file.separator");
         cmdPath = Paths.get(testJdk, "bin");
@@ -65,10 +63,16 @@
 
     @Test
     public void basic() throws Exception {
-        // build the jar file
+        // build Version.jar, Version_9.jar and main.jar
         Result r = run("jar -cf Version.jar -C base test --release 9 -C 9 test --release 10 -C 10 test");
         checkResult(r);
 
+        r = run("jar -cf Version_9.jar -C base test --release 9 -C 9 test");
+        checkResult(r);
+
+        r = run("jar -cf Main.jar test/Main.class");
+        checkResult(r);
+
         // try out a bunch of things
         r = run("jdeps --multi-release 9  -v missing.jar");
         checkResult(r, false, "Warning: Path does not exist: missing.jar");
@@ -78,31 +82,31 @@
 
         r = run("jdeps --multi-release base  -v Version.jar");
         checkResult(r, true,
-                "Version.jar ->",
-                "test.Version",
-                "test.Version"
+            "Version.jar ->",
+            "test.Version",
+            "test.Version"
         );
 
         r = run("jdeps --multi-release 9  -v Version.jar");
         checkResult(r, true,
-                "Version.jar ->",
-                "9/test.NonPublic",
-                "9/test.NonPublic",
-                "9/test.Version",
-                "9/test.Version",
-                "9/test.Version",
-                "9/test.Version"
+            "Version.jar ->",
+            "9/test.NonPublic",
+            "9/test.NonPublic",
+            "9/test.Version",
+            "9/test.Version",
+            "9/test.Version",
+            "9/test.Version"
         );
 
         r = run("jdeps --multi-release 10  -v Version.jar");
         checkResult(r, true,
-                "Version.jar ->",
-                "10/test.Version",
-                "10/test.Version",
-                "10/test.Version",
-                "10/test.Version",
-                "9/test.NonPublic",
-                "9/test.NonPublic"
+            "Version.jar ->",
+            "10/test.Version",
+            "10/test.Version",
+            "10/test.Version",
+            "10/test.Version",
+            "9/test.NonPublic",
+            "9/test.NonPublic"
         );
 
         r = run("jdeps --multi-release 8  -v Version.jar");
@@ -111,82 +115,90 @@
         r = run("jdeps --multi-release 9.1  -v Version.jar");
         checkResult(r, false, "Error: invalid argument for option: 9.1");
 
-        r = run("jdeps -v -R -cp Version.jar test/Main.class");
+        runJdeps("test/Main.class");
+        runJdeps("Main.jar");
+    }
+
+
+    private void runJdeps(String path) throws Exception {
+        Result r = run("jdeps -v -R -cp Version.jar " + path);
         checkResult(r, false, "--multi-release option is not set");
 
-        r = run("jdeps -v -R -cp Version.jar -multi-release 9 test/Main.class");
+        r = run("jdeps -v -R -cp Version.jar -multi-release 9 " + path);
         checkResult(r, false,
-                "Error: unknown option: -multi-release",
-                "Usage: jdeps <options> <path",
-                "use --help"
+            "Error: unknown option: -multi-release",
+            "Usage: jdeps <options> <path",
+            "use --help"
         );
 
-        r = run("jdeps -v -R -cp Version.jar --multi-release 9 test/Main.class");
+        r = run("jdeps -v -R -cp Version.jar --multi-release 9 " + path);
+
+        String name = path;
+        int index = path.lastIndexOf('/');
+        if (index >= 0) {
+            name = path.substring(index + 1, path.length());
+        }
         checkResult(r, true,
-                "Main.class ->",
-                "Main.class ->",
-                "test.Main",
-                "test.Main",
-                "test.Main",
-                "Version.jar ->",
-                "9/test.NonPublic",
-                "9/test.NonPublic",
-                "9/test.Version",
-                "9/test.Version",
-                "9/test.Version",
-                "9/test.Version"
+            name + " ->",
+            name + " ->",
+            "test.Main",
+            "test.Main",
+            "test.Main",
+            "Version.jar ->",
+            "9/test.NonPublic",
+            "9/test.NonPublic",
+            "9/test.Version",
+            "9/test.Version",
+            "9/test.Version",
+            "9/test.Version"
         );
 
-        r = run("jdeps -v -R -cp Version.jar --multi-release 10 test/Main.class");
+        r = run("jdeps -v -R -cp Version.jar --multi-release 10 " + path);
         checkResult(r, true,
-                "Main.class ->",
-                "Main.class ->",
-                "test.Main",
-                "test.Main",
-                "test.Main",
-                "Version.jar ->",
-                "10/test.Version",
-                "10/test.Version",
-                "10/test.Version",
-                "10/test.Version",
-                "9/test.NonPublic",
-                "9/test.NonPublic"
+            name + " ->",
+            name + " ->",
+            "test.Main",
+            "test.Main",
+            "test.Main",
+            "Version.jar ->",
+            "10/test.Version",
+            "10/test.Version",
+            "10/test.Version",
+            "10/test.Version",
+            "9/test.NonPublic",
+            "9/test.NonPublic"
         );
 
-        r = run("jdeps -v -R -cp Version.jar --multi-release base test/Main.class");
+        r = run("jdeps -v -R -cp Version.jar --multi-release base " + path);
         checkResult(r, true,
-                "Main.class ->",
-                "Main.class ->",
-                "test.Main",
-                "test.Main",
-                "test.Main",
-                "Version.jar ->",
-                "test.Version",
-                "test.Version"
+            name + " ->",
+            name + " ->",
+            "test.Main",
+            "test.Main",
+            "test.Main",
+            "Version.jar ->",
+            "test.Version",
+            "test.Version"
         );
 
-        r = run("jdeps -v -R -cp Version.jar --multi-release 9.1 test/Main.class");
+        r = run("jdeps -v -R -cp Version.jar --multi-release 9.1 " + path);
         checkResult(r, false, "Error: invalid argument for option: 9.1");
 
-        // Rebuild jar without version 10
-        r = run("jar -cf Version.jar -C base test --release 9 -C 9 test");
-        checkResult(r);
-
-        // but ask for version 10
-        r = run("jdeps -v -R -cp Version.jar --multi-release 10 test/Main.class");
+        // Version_9.jar does not have any version 10 entry
+        r = run("jdeps -v -R -cp Version_9.jar --multi-release 10 " + path);
         checkResult(r, true,
-                "Main.class ->",
-                "Main.class ->",
-                "test.Main",
-                "test.Main",
-                "test.Main",
-                "Version.jar ->",
-                "9/test.NonPublic",
-                "9/test.NonPublic",
-                "9/test.Version",
-                "9/test.Version",
-                "9/test.Version",
-                "9/test.Version"
+            name + " ->",
+            name + " ->",
+            "test.Main",
+            "test.Main",
+            "test.Main",
+            "Version_9.jar ->",
+            "9/test.NonPublic",
+            "9/test.NonPublic",
+            "9/test.Version",
+            "9/test.Version",
+            "9/test.Version",
+            "9/test.Version"
         );
     }
 
@@ -198,27 +210,72 @@
 
         r = run("jdeps -v -R -cp PQ.jar --multi-release base PQ.jar");
         checkResult(r, true,
-                "PQ.jar -> java.base",
-                "p.Foo"
+            "PQ.jar -> java.base",
+            "p.Foo"
         );
 
         r = run("jdeps -v -R -cp PQ.jar --multi-release 9 PQ.jar");
         checkResult(r, true,
-                "PQ.jar -> java.base",
-                "9/p.Foo",
-                "9/p.Foo",
-                "9/q.Bar"
+            "PQ.jar -> java.base",
+            "9/p.Foo",
+            "9/p.Foo",
+            "9/q.Bar"
         );
 
 
         r = run("jdeps -v -R -cp PQ.jar --multi-release 10 PQ.jar");
         checkResult(r, true,
-                "PQ.jar -> java.base",
-                "10/q.Bar",
-                "10/q.Bar",
-                "10/q.Gee",
-                "9/p.Foo",
-                "9/p.Foo"
+            "PQ.jar -> java.base",
+            "10/q.Bar",
+            "10/q.Bar",
+            "10/q.Gee",
+            "9/p.Foo",
+            "9/p.Foo"
+        );
+    }
+
+    @Test
+    public void modularJar() throws Exception {
+        Result r = run("jar -cf foo.jar -C base p");
+        checkResult(r);
+
+        Path foo = Paths.get(System.getProperty("test.classes")).resolve("modules").resolve("foo");
+        r = run("jar -uf foo.jar --release 9 -C " + foo.toString() + " module-info.class --release 10 -C v10 q");
+        checkResult(r);
+
+        r = run("jdeps -v --multi-release 10 --module-path foo.jar -m foo");
+        checkResult(r, true,
+            "foo",                   // module name
+            "foo.jar",                      // the path to foo.jar
+            "requires mandated java.base",  // module dependences
+            "foo -> java.base",
+            "10/q.Bar",
+            "10/q.Bar",
+            "10/q.Gee",
+            "p.Foo"
+        );
+
+        r = run("jdeps --multi-release 9 --module-path foo.jar Main.jar");
+        checkResult(r, true,
+            "Main.jar ->",
+            "test",
+            "foo",                          // module name
+            "foo.jar",                      // the path to foo.jar
+            "requires mandated java.base",  // module dependences
+            "foo -> java.base",
+            "p"
+        );
+
+        r = run("jdeps --multi-release 10 --module-path foo.jar Main.jar");
+        checkResult(r, true,
+            "Main.jar ->",
+            "test",
+            "foo",                          // module name
+            "foo.jar",                      // the path to foo.jar
+            "requires mandated java.base",  // module dependences
+            "foo -> java.base",
+            "p",
+            "q"
         );
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/jdeps/foo/module-info.java	Tue Sep 18 16:41:24 2018 -0700
@@ -0,0 +1,24 @@
+/*
+ * 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.
+ */
+module foo {
+}
--- a/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Tue Sep 18 16:41:24 2018 -0700
@@ -40,6 +40,8 @@
         "UseSharedSpaces: Unable to allocate region, range is not within java heap.";
     public static final String MSG_RANGE_ALREADT_IN_USE =
         "Unable to allocate region, java heap range is already in use.";
+    public static final String MSG_COMPRESSION_MUST_BE_USED =
+        "Unable to use shared archive: UseCompressedOops and UseCompressedClassPointers must be on for UseSharedSpaces.";
 
     public interface Checker {
         public void check(OutputAnalyzer output) throws Exception;
--- a/test/lib/sun/hotspot/WhiteBox.java	Tue Sep 18 16:32:39 2018 -0700
+++ b/test/lib/sun/hotspot/WhiteBox.java	Tue Sep 18 16:41:24 2018 -0700
@@ -103,6 +103,7 @@
     return isClassAlive0(name.replace('.', '/'));
   }
   private native boolean isClassAlive0(String name);
+  public  native int getSymbolRefcount(String name);
 
   private native boolean isMonitorInflated0(Object obj);
   public         boolean isMonitorInflated(Object obj) {