Merge JDK-8200758-branch
authorherrick
Mon, 17 Sep 2018 09:28:19 -0400
branchJDK-8200758-branch
changeset 56884 0b2da0fd5363
parent 56883 0d9b95700522 (current diff)
parent 51765 e10ade04afe5 (diff)
child 56885 4c56efca06ca
Merge
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	Sat Sep 08 09:38:06 2018 -0400
+++ b/.hgtags	Mon Sep 17 09:28:19 2018 -0400
@@ -511,3 +511,4 @@
 492b366f8e5784cc4927c2c98f9b8a3f16c067eb jdk-12+8
 31b159f30fb281016c5f0c103552809aeda84063 jdk-12+9
 8f594f75e0547d4ca16649cb3501659e3155e81b jdk-12+10
+f0f5d23449d31f1b3580c8a73313918cafeaefd7 jdk-12+11
--- a/make/Init.gmk	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/Init.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/Main.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/ToolsJdk.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/autoconf/flags-cflags.m4	Mon Sep 17 09:28:19 2018 -0400
@@ -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/spec.gmk.in	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/autoconf/spec.gmk.in	Mon Sep 17 09:28:19 2018 -0400
@@ -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/copy/Copy-java.base.gmk	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/copy/Copy-java.base.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/gensrc/GensrcCLDR.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/hotspot/lib/CompileDtraceLibraries.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/hotspot/lib/JvmOverrideFiles.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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
--- a/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/jdk/src/classes/build/tools/cldrconverter/CLDRConverter.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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/langtools/tools/propertiesparser/PropertiesParser.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/langtools/tools/propertiesparser/PropertiesParser.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/lib/CoreLibraries.gmk	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/lib/CoreLibraries.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -39,20 +39,15 @@
   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, \
@@ -64,10 +59,6 @@
       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), \
--- a/make/lib/Lib-java.base.gmk	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/lib/Lib-java.base.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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-jdk.hotspot.agent.gmk	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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_exceptions.sh.incl	Sat Sep 08 09:38:06 2018 -0400
+++ b/make/scripts/compare_exceptions.sh.incl	Mon Sep 17 09:28:19 2018 -0400
@@ -350,13 +350,11 @@
 
   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
+  ACCEPTED_DIS_DIFF="
+      ./lib/libfontmanager.so
+      ./lib/libsaproc.so
+      ./lib/server/libjvm.so
+  "
 
   SKIP_FULLDUMP_DIFF="true"
 
--- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64_trig.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/arm/arm.ad	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/arm/methodHandles_arm.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/arm/sharedRuntime_arm.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/assembler_ppc.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -521,6 +521,18 @@
     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),
+    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 +586,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 +594,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 +607,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 +619,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 +675,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 +2078,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 +2086,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 +2098,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 +2110,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 +2171,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 +2194,18 @@
   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 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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -769,7 +769,19 @@
 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::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 +845,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 +853,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 +865,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 +877,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 +939,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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/ppc.ad	Mon Sep 17 09:28:19 2018 -0400
@@ -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);
 
@@ -13989,6 +14005,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.
--- a/src/hotspot/cpu/ppc/register_definitions_ppc.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/register_definitions_ppc.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -32,4 +32,6 @@
 
 REGISTER_DEFINITION(FloatRegister, fnoreg);
 
+REGISTER_DEFINITION(VectorRegister, vnoreg);
+
 REGISTER_DEFINITION(VectorSRegister, vsnoreg);
--- a/src/hotspot/cpu/ppc/register_ppc.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/register_ppc.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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] = {
@@ -92,6 +87,12 @@
 
 // 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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/register_ppc.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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
@@ -515,11 +515,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 +596,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 +672,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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/ppc/vmreg_ppc.inline.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/s390/stubGenerator_s390.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/sparc/vtableStubs_sparc.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/interp_masm_x86.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_cos.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_exp.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_log.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_log10.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_sin.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/macroAssembler_x86_tan.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -1906,7 +1906,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
@@ -3848,7 +3848,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;
 
--- a/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/os/windows/include/jvm_md.h	Mon Sep 17 09:28:19 2018 -0400
@@ -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/share/aot/aotCodeHeap.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/aot/aotCodeHeap.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/aot/aotCodeHeap.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/aot/aotCompiledMethod.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/aot/aotLoader.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -101,15 +101,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.
  */
--- a/src/hotspot/share/aot/aotLoader.hpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/aot/aotLoader.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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
@@ -68,11 +68,6 @@
 
   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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/ci/ciMethodData.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/classLoaderData.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/classLoaderData.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/classLoaderData.inline.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/classLoaderStats.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/compactHashtable.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/compactHashtable.inline.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/javaClasses.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/verifier.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/classfile/verifier.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/g1/g1OopClosures.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/parallel/psCompactionManager.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/shared/c2/barrierSetC2.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/oopStorage.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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);
@@ -150,7 +150,7 @@
   // 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 +159,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 +211,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 +274,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 +288,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 +322,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 +334,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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -101,7 +101,7 @@
 
   void print_stats(const char* tag);
 
-  Thread* myThread();
+  Thread* thread();
 
   // statistics
 
@@ -192,15 +192,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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/shared/threadLocalAllocBuffer.inline.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/jfr/periodic/jfrPeriodic.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/memory/filemap.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/memory/filemap.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/memory/heapShared.inline.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/oops/instanceKlass.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/oops/klass.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/opto/graphKit.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/opto/graphKit.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/opto/graphKit.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/opto/library_call.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/opto/phaseX.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/opto/stringopts.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/jvmtiGetLoadedClasses.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/prims/jvmtiGetLoadedClasses.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/prims/jvmtiRawMonitor.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/prims/whitebox.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/runtime/arguments.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/runtime/globals.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/runtime/objectMonitor.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/runtime/objectMonitor.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/runtime/synchronizer.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/runtime/thread.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/hotspot/share/runtime/thread.hpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/ModuleLayer.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/ModuleLayer.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/Object.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/String.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/StringLatin1.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/StringUTF16.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/Thread.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/Thread.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/module/Configuration.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/lang/module/Configuration.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/net/CookieManager.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/net/CookieManager.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/net/HttpCookie.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/nio/file/Paths.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/security/Identity.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/security/Identity.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/Provider.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/security/Provider.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/security/Security.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/text/RuleBasedCollator.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/util/Random.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/util/StringJoiner.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/java/util/stream/DistinctOps.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/javax/crypto/CipherOutputStream.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/javax/net/ssl/SSLServerSocket.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/X509ExtendedKeyManager.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/javax/net/ssl/X509ExtendedKeyManager.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/sun/security/ssl/SupportedGroupsExtension.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/sun/security/ssl/SupportedGroupsExtension.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/classes/sun/util/cldr/CLDRTimeZoneNameProviderImpl.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/share/native/libzip/zip_util.c	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/solaris/native/libjvm_db/libjvm_db.h	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/solaris/native/libjvm_dtrace/jvm_dtrace.h	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/unix/classes/sun/net/www/protocol/file/Handler.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/unix/native/libjsig/jsig.c	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/windows/classes/sun/net/www/protocol/file/Handler.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/windows/native/libjava/TimeZone_md.c	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/windows/native/libjava/canonicalize_md.c	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.base/windows/native/libjava/io_util_md.h	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/java.naming/share/classes/com/sun/jndi/ldap/LdapClient.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/AOTCompiledClass.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Preview.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ArgumentAttr.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Lower.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavaTokenizer.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/UnicodeReader.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java	Mon Sep 17 09:28:19 2018 -0400
@@ -2217,7 +2217,8 @@
 
         public enum OverloadKind {
             OVERLOADED,
-            UNOVERLOADED
+            UNOVERLOADED,
+            ERROR
         }
 
         /**
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/utilities/ProgressiveHeapVisitor.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotResolvedObjectType.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalRuntimeMBean.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/module-info.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64Assembler.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.asm.amd64/src/org/graalvm/compiler/asm/amd64/AMD64BaseAssembler.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/CheckGraalInvariants.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/ea/EscapeAnalysisTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/CompilationWrapper.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core/src/org/graalvm/compiler/core/GraalCompilerOptions.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/DebugContextTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/DiagnosticsOutputDirectory.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug/src/org/graalvm/compiler/debug/PathUtilities.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CompilationWrapperTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/HotSpotGraalManagementTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotBackend.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalCompiler.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/HotSpotGraalRuntimeProvider.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/JVMCIVersionCheck.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/meta/HotSpotHostForeignCallsProvider.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/replacements/NewObjectSnippets.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/SnippetStub.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot/stubs/StubOptions.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BciBlockMapping.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.java/src/org/graalvm/compiler/java/BytecodeParser.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/GraphEncoder.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/StructuredGraph.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/InstanceOfNode.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/NewInstanceNode.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/StoreIndexedNode.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.options/src/org/graalvm/compiler/options/OptionsParser.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/inlining/InliningUtil.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases/src/org/graalvm/compiler/phases/tiers/PhaseContext.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.test/src/org/graalvm/compiler/replacements/test/PEGraphDecoderTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/CachingPEGraphDecoder.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/IntrinsicGraphBuilder.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/ReplacementsImpl.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/SnippetTemplate.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/nodes/MacroNode.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.graphio/src/org/graalvm/graphio/GraphOutput.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/search.js	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ClassFileReader.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/ProblemList.txt	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/TEST.ROOT	Mon Sep 17 09:28:19 2018 -0400
@@ -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 \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c2/TestUnreachableRegionDuringCCP.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMAbortThresholdOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMLockingThresholdOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMRetryCountOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMSpinLoopCountOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortRatio.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAbortThreshold.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMLockingThreshold.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMRetryCount.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMSpinLoopCount.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMDeopt.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMForStackLocks.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/locking/TestUseRTMXendForLockBusy.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/gc/g1/mixedgc/TestLogging.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/gc/g1/mixedgc/TestOldGenCollectionUsage.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/runtime/ClassUnload/UnloadTest.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/ClassUnload/UnloadTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/Dictionary/CleanProtectionDomain.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/Dictionary/ProtectionDomainCacheTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/LoadClass/LongBCP.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/CheckArchivedModuleApp.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/appcds/cacheObject/DifferentHeapSizes.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/runtime/testlibrary/ClassUnloadCommon.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/serviceability/sa/DeadlockDetectionTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/metaspace/stressHierarchy/common/PerformChecksHelper.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/stressHierarchy012/TestDescription.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/jdb/locals/locals002/locals002a.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/locals/locals002/locals002a.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/Allocate/alloc001/alloc001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/ClassPrepare/classprep001/classprep001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassPrepare/classprep001/classprep001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/CreateRawMonitor/crrawmon001/crrawmon001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/Deallocate/dealloc001/dealloc001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/Exception/exception001/exception001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Exception/exception001/exception001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ExceptionCatch/excatch001/excatch001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc001/fieldacc001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc002/fieldacc002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc003/fieldacc003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldAccess/fieldacc004/fieldacc004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod001/fieldmod001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FieldModification/fieldmod002/fieldmod002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/FramePop/framepop001/framepop001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop001/framepop001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/FramePop/framepop002/framepop002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/intrpthrd002/intrpthrd002.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/IsMethodSynthetic/issynth001/issynth001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/MethodEntry/mentry001/mentry001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodEntry/mentry001/mentry001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodEntry/mentry002/mentry002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit001/mexit001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/MethodExit/mexit002/mexit002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/NotifyFramePop/nframepop001/nframepop001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/PopFrame/popframe001/popframe001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/popframe006/popframe006.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/redefclass001/redefclass001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/redefclass031/redefclass031.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/RunAgentThread/agentthr001/agentthr001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/SetEventNotificationMode/setnotif001/setnotif001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/SetFieldAccessWatch/setfldw001/setfldw001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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,11 @@
 
     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 +204,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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,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);
         }
         err = jvmti->SetFieldAccessWatch(cls, watches[i].fid);
         if (err == JVMTI_ERROR_NONE) {
@@ -243,6 +229,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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,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);
         }
         err = jvmti->SetFieldModificationWatch(cls, watches[i].fid);
         if (err == JVMTI_ERROR_NONE) {
@@ -240,6 +224,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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,8 @@
         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 +285,4 @@
     return result;
 }
 
-#ifdef __cplusplus
 }
-#endif
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/StopThread/stopthrd006/stopthrd006.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/ThreadEnd/threadend001/threadend001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadEnd/threadend001/threadend001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/threadstart001/threadstart001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart001/threadstart001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/threadstart003/threadstart003.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ThreadStart/threadstart003/threadstart003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/jni_interception/JI03/ji03t001/ji03t001.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp	Mon Sep 17 09:28:19 2018 -0400
@@ -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/share/classload/GeneratingClassLoader.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/classload/GeneratingClassLoader.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/test/timeoutwatchdog/TimeoutHandler.java	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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/vm/share/gc/TriggerUnloadingByFillingHeap.java	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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/jdk/ProblemList-Xcomp.txt	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/build/releaseFile/CheckSource.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/jdi/BadHandshakeTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/jdi/BasicJDWPConnectionTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/jdi/DebuggerThreadTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/jdi/DoubleAgentTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/jdi/ExclusiveBind.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbCommand.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/jdi/lib/jdb/JdbTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/RunnerUtil.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/com/sun/tools/attach/StartManagementAgent.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/awt/datatransfer/ClipboardInterVMTest/ClipboardInterVMTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/forNameLeak/ClassForNameLeak.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/ClassLoader/getResource/GetResource.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/Base.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForImageTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/JDKLoggerForJDKTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/LoggerInImageTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForImageTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/NamedLoggerForJDKTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForImageTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/System/LoggerFinder/modules/UnnamedLoggerForJDKTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/Thread/ThreadStateController.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/instrument/PremainClass/NoPremainAgentTest.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/instrument/PremainClass/NoPremainAgentTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/instrument/PremainClass/PremainClassTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/instrument/PremainClass/ZeroArgPremainAgentTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/LFCaching/LambdaFormTestCase.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandles/CatchExceptionTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandlesAsCollectorTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandlesCastFailureTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandlesGeneralTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandlesInsertArgumentsTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandlesInvokersTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandlesPermuteArgumentsTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/MethodHandlesSpreadArgumentsTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/PermuteArgsTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/TestCatchExceptionWithVarargs.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/VarargsArrayTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/invoke/common/test/java/lang/invoke/lib/CodeCacheOverflowProcessor.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/lang/management/MemoryMXBean/RunUtil.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/net/CookieHandler/CookieManagerTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/net/MulticastSocket/MultiDead.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/security/Driver.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/net/httpclient/security/Driver.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/net/spi/URLStreamHandlerProvider/Basic.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/nio/channels/FileChannel/LoopingTruncate.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/nio/channels/Selector/SelectWithConsumer.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/nio/channels/Selector/Wakeup.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/EntryProtectionTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/KeytoolReaderP12Test.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/security/KeyStore/PKCS12/Utils.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/TimeZone/CLDRDisplayNamesTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/BlockingQueue/CancelledProducerConsumerLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/BlockingQueue/Interrupt.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/BlockingQueue/MultipleProducersSingleConsumerLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/BlockingQueue/ProducerConsumerLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/BlockingQueue/SingleProducerMultipleConsumerLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/CompletableFuture/Basic.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ConcurrentHashMap/MapLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ConcurrentQueues/ConcurrentQueueLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/CyclicBarrier/Basic.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/Exchanger/ExchangeLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ExecutorCompletionService/ExecutorCompletionServiceLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/Executors/AutoShutdown.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/FutureTask/BlockingTaskExecutor.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/FutureTask/CancelledFutureLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/FutureTask/DoneMeansDone.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/DelayOverflow.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCorePoolSize.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ScheduledThreadPoolExecutor/ZeroCoreThreads.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/CoreThreadTimeOut.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/Custom.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/FlakyThreadFactory.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/SelfInterrupt.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/ThreadRestarts.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/ThreadPoolExecutor/TimeOutShrink.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/forkjoin/SubmissionTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/Lock/CheckedLockLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/Lock/TimedAcquireLeak.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/LockOncePerThreadLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/SimpleReentrantLockLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantLock/TimeoutLockLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/Count.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/ReentrantReadWriteLock/MapLoops.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/concurrent/locks/StampedLock/Basic.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/java/util/zip/ZipFile/DeleteTempJar.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/management/monitor/GaugeMonitorDeadlockTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/management/monitor/StartStopTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/management/mxbean/MXBeanWeirdParamTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/management/remote/mandatory/connection/DefaultAgentFilterTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/management/remote/mandatory/loading/MethodResultTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/management/security/AuthorizationTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/management/security/SecurityTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ /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/xml/crypto/dsig/GenerationTests.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/javax/xml/crypto/dsig/GenerationTests.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/lib/testlibrary/jdk/testlibrary/JDKToolFinder.java	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ /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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sanity/client/SwingSet/src/TextFieldDemoTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/TestPollingInterval.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jdp/DynamicLauncher.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jdp/PortAlreadyInUseTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/AbstractFilePermissionTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/LocalManagementTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiBootstrapTest.sh	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiRegistrySslTestApp.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/bootstrap/RmiSslBootstrapTest.sh	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/startstop/JMXStartStopTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/management/jmxremote/startstop/ManagementAgentJcmd.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/security/ssl/SSLEngineImpl/SSLEngineKeyLimit.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/security/ssl/SSLSocketImpl/SSLSocketKeyLimit.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/security/tools/jarsigner/Warning.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jcmd/JcmdBase.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jcmd/TestJcmdDefaults.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jcmd/TestJcmdSanity.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/BasicLauncherTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/HeapDumpTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/heapconfig/JMapHeapConfigTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jhsdb/heapconfig/TmtoolTestScenario.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jinfo/BasicJInfoTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jmap/BasicJMapTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jps/JpsHelper.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jstack/BasicJStackTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jstack/DeadlockDetectionTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jstat/JStatInterval.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jstat/jstatClassloadOutput1.sh	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jstatd/JstatGCUtilParser.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jstatd/JstatdTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/sun/tools/jstatd/TestJstatdUsage.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/tools/jar/compat/CLICompatibility.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/tools/jar/modularJar/Basic.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jdk/tools/launcher/modules/patch/systemmodules/PatchSystemModules.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/jtreg-ext/requires/VMProps.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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;
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/AvoidNPEAtClassReader/AvoidNPEAtClassReaderTest.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -0,0 +1,2 @@
+T8193561.java:9:1: compiler.err.cyclic.inheritance: p.T8193561
+1 error
--- a/test/langtools/tools/javac/desugar/BoxingAndSuper.java	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/langtools/tools/javac/desugar/BoxingAndSuper.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/langtools/tools/javac/diags/examples/IllegalChar.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/langtools/tools/jdeps/MultiReleaseJar.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/lib/jdk/test/lib/cds/CDSTestUtils.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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	Sat Sep 08 09:38:06 2018 -0400
+++ b/test/lib/sun/hotspot/WhiteBox.java	Mon Sep 17 09:28:19 2018 -0400
@@ -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) {