Merge http-client-branch
authordfuchs
Tue, 03 Jul 2018 11:23:42 +0200
branchhttp-client-branch
changeset 56818 c76f4aa16140
parent 56817 167f07a3512d (current diff)
parent 50926 79baec7d831e (diff)
child 56819 4cd8d88dab38
Merge
test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/java.base/java/util/ServiceConfigurationError.java
--- a/.hgtags	Tue Jul 03 11:02:57 2018 +0200
+++ b/.hgtags	Tue Jul 03 11:23:42 2018 +0200
@@ -490,9 +490,6 @@
 02934b0d661b82b7fe1052a04998d2091352e08d jdk-11+16
 64e4b1686141e57a681936a8283983341484676e jdk-11+17
 e1b3def126240d5433902f3cb0e91a4c27f6db50 jdk-11+18
-fb8b3f4672774e15654958295558a1af1b576919 jdk-11+19
-fb8b3f4672774e15654958295558a1af1b576919 jdk-11+19
 36ca515343e00b021dcfc902e986d26ec994a2e5 jdk-11+19
-c9cd3ec6a0ebaf373b6ff0071c396cc657f7c4bd jdk-12+0
-c9cd3ec6a0ebaf373b6ff0071c396cc657f7c4bd jdk-12+0
 95aad0c785e497f1bade3955c4e4a677b629fa9d jdk-12+0
+9816d7cc655e53ba081f938b656e31971b8f097a jdk-11+20
--- a/make/Main.gmk	Tue Jul 03 11:02:57 2018 +0200
+++ b/make/Main.gmk	Tue Jul 03 11:23:42 2018 +0200
@@ -487,6 +487,14 @@
 	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregNativeJdk.gmk \
 	    test-image-jdk-jtreg-native)
 
+build-test-hotspot-jtreg-graal:
+	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregGraalUnit.gmk \
+	     build-test-hotspot-jtreg-graal)
+
+test-image-hotspot-jtreg-graal:
+	+($(CD) $(TOPDIR)/make/test && $(MAKE) $(MAKE_ARGS) -f JtregGraalUnit.gmk \
+	     test-image-hotspot-jtreg-graal)
+
 run-test:
 	+($(CD) $(TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f RunTests.gmk run-test TEST="$(TEST)")
 
@@ -523,6 +531,7 @@
     test-image-hotspot-jtreg-native build-test-jdk-jtreg-native \
     test-image-jdk-jtreg-native build-test-lib build-test-failure-handler \
     test-failure-handler test-image-failure-handler test-image-hotspot-gtest \
+    test-image-hotspot-jtreg-graal build-test-hotspot-jtreg-graal \
     run-test exploded-run-test
 
 ################################################################################
@@ -853,10 +862,14 @@
 
   build-test-jdk-jtreg-native: buildtools-jdk java.base-libs
 
+  build-test-hotspot-jtreg-graal: exploded-image-optimize
+
   test-image-hotspot-jtreg-native: build-test-hotspot-jtreg-native
 
   test-image-jdk-jtreg-native: build-test-jdk-jtreg-native
 
+  test-image-hotspot-jtreg-graal: build-test-hotspot-jtreg-graal
+
   test-image-hotspot-gtest: hotspot
 
   test-hotspot-internal: exploded-image
@@ -993,6 +1006,10 @@
 # If not already set, set the JVM specific targets to build the test image
 JVM_TEST_IMAGE_TARGETS ?= test-image-hotspot-jtreg-native test-image-hotspot-gtest
 
+ifeq ($(INCLUDE_GRAAL), true)
+  JVM_TEST_IMAGE_TARGETS += test-image-hotspot-jtreg-graal
+endif
+
 # This target builds the test image
 test-image: prepare-test-image \
     test-image-jdk-jtreg-native test-image-failure-handler \
--- a/make/RunTests.gmk	Tue Jul 03 11:02:57 2018 +0200
+++ b/make/RunTests.gmk	Tue Jul 03 11:23:42 2018 +0200
@@ -535,6 +535,8 @@
     $1_JTREG_BASIC_OPTIONS += -cpa:$$(JIB_JAR)
   endif
 
+  $1_JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
+
   ifneq ($$(JTREG_FAILURE_HANDLER_OPTIONS), )
     $1_JTREG_LAUNCHER_OPTIONS += -Djava.library.path="$(JTREG_FAILURE_HANDLER_DIR)"
   endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/autoconf/lib-tests.m4	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,57 @@
+#
+# 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.
+#
+
+###############################################################################
+#
+# Check for graalunit libs, needed for running graalunit tests.
+#
+AC_DEFUN_ONCE([LIB_TESTS_SETUP_GRAALUNIT],
+[
+  AC_ARG_WITH(graalunit-lib, [AS_HELP_STRING([--with-graalunit-lib],
+      [specify location of 3rd party libraries used by Graal unit tests])])
+
+  GRAALUNIT_LIB=
+  if test "x${with_graalunit_lib}" != x; then
+    AC_MSG_CHECKING([for graalunit libs])
+    if test "x${with_graalunit_lib}" = xno; then
+      AC_MSG_RESULT([disabled, graalunit tests can not be run])
+    elif test "x${with_graalunit_lib}" = xyes; then
+      AC_MSG_RESULT([not specified])
+      AC_MSG_ERROR([You must specify the path to 3rd party libraries used by Graal unit tests])
+    else
+      GRAALUNIT_LIB="${with_graalunit_lib}"
+      if test ! -d "${GRAALUNIT_LIB}"; then
+        AC_MSG_RESULT([no])
+        AC_MSG_ERROR([Could not find graalunit 3rd party libraries as specified. (${with_graalunit_lib})])
+      else
+        AC_MSG_RESULT([$GRAALUNIT_LIB])
+      fi
+    fi
+  fi
+
+  BASIC_FIXUP_PATH([GRAALUNIT_LIB])
+  AC_SUBST(GRAALUNIT_LIB)
+])
+
--- a/make/autoconf/libraries.m4	Tue Jul 03 11:02:57 2018 +0200
+++ b/make/autoconf/libraries.m4	Tue Jul 03 11:23:42 2018 +0200
@@ -32,6 +32,7 @@
 m4_include([lib-std.m4])
 m4_include([lib-x11.m4])
 m4_include([lib-fontconfig.m4])
+m4_include([lib-tests.m4])
 
 ################################################################################
 # Determine which libraries are needed for this configuration
@@ -101,6 +102,7 @@
   LIB_SETUP_BUNDLED_LIBS
   LIB_SETUP_MISC_LIBS
   LIB_SETUP_SOLARIS_STLPORT
+  LIB_TESTS_SETUP_GRAALUNIT
 
   if test "x$TOOLCHAIN_TYPE" = xsolstudio; then
     GLOBAL_LIBS="-lc"
--- a/make/autoconf/spec.gmk.in	Tue Jul 03 11:02:57 2018 +0200
+++ b/make/autoconf/spec.gmk.in	Tue Jul 03 11:23:42 2018 +0200
@@ -347,6 +347,7 @@
 LIBFFI_CFLAGS:=@LIBFFI_CFLAGS@
 ENABLE_LIBFFI_BUNDLING:=@ENABLE_LIBFFI_BUNDLING@
 LIBFFI_LIB_FILE:=@LIBFFI_LIB_FILE@
+GRAALUNIT_LIB := @GRAALUNIT_LIB@
 
 PACKAGE_PATH=@PACKAGE_PATH@
 
--- a/make/conf/jib-profiles.js	Tue Jul 03 11:02:57 2018 +0200
+++ b/make/conf/jib-profiles.js	Tue Jul 03 11:23:42 2018 +0200
@@ -378,7 +378,7 @@
         "linux-x64": {
             target_os: "linux",
             target_cpu: "x64",
-            dependencies: ["devkit", "autoconf", "graphviz", "pandoc"],
+            dependencies: ["devkit", "autoconf", "graphviz", "pandoc", "graalunit_lib"],
             configure_args: concat(common.configure_args_64bit,
                 "--enable-full-docs", "--with-zlib=system"),
             default_make_targets: ["docs-bundles"],
@@ -396,7 +396,7 @@
         "macosx-x64": {
             target_os: "macosx",
             target_cpu: "x64",
-            dependencies: ["devkit", "autoconf"],
+            dependencies: ["devkit", "autoconf", "graalunit_lib"],
             configure_args: concat(common.configure_args_64bit, "--with-zlib=system",
                 "--with-macosx-version-max=10.9.0"),
         },
@@ -420,7 +420,7 @@
         "windows-x64": {
             target_os: "windows",
             target_cpu: "x64",
-            dependencies: ["devkit", "autoconf"],
+            dependencies: ["devkit", "autoconf", "graalunit_lib"],
             configure_args: concat(common.configure_args_64bit),
         },
 
@@ -972,6 +972,14 @@
             configure_args: "",
         },
 
+        graalunit_lib: {
+            organization: common.organization,
+            ext: "zip",
+            revision: "619_Apr_12_2018",
+            module: "graalunit-lib",
+            configure_args: "--with-graalunit-lib=" + input.get("graalunit_lib", "install_path"),
+            environment_name: "GRAALUNIT_LIB"
+        },
     };
 
     // Need to add a value for the Visual Studio tools variable to make
--- a/make/data/publicsuffixlist/VERSION	Tue Jul 03 11:02:57 2018 +0200
+++ b/make/data/publicsuffixlist/VERSION	Tue Jul 03 11:23:42 2018 +0200
@@ -1,2 +1,2 @@
 Github: https://raw.githubusercontent.com/publicsuffix/list/2225db8d9f4a2a27ec697c883360632fa0c16261/public_suffix_list.dat
-Date: 2018-05-09
+Date: 2018-05-24
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/test/JtregGraalUnit.gmk	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,144 @@
+#
+# 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.
+#
+
+################################################################################
+# This file builds Graal component of the JTReg tests for Hotspot.
+# It also covers the test-image part, where the built files are copied to the
+# test image.
+################################################################################
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include SetupJavaCompilers.gmk
+
+TARGETS_BUILD :=
+TARGETS_IMAGE :=
+TARGETS_EXTRA_LIB :=
+
+ifeq ($(INCLUDE_GRAAL), true)
+  ifneq ($(GRAALUNIT_LIB), )
+    SRC_DIR := $(TOPDIR)/src/jdk.internal.vm.compiler/share/classes
+    TEST_DIR := $(TOPDIR)/test/hotspot/jtreg/compiler/graalunit
+    COMPILE_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/test/graalunit
+    LIB_OUTPUTDIR := $(TEST_IMAGE_DIR)/hotspot/jtreg/graal
+
+    ### Copy 3rd party libs
+    $(eval $(call SetupCopyFiles, COPY_GRAALUNIT_LIBS, \
+        FILES := $(wildcard $(GRAALUNIT_LIB)/*.jar), \
+        DEST := $(LIB_OUTPUTDIR), \
+    ))
+
+    TARGETS_EXTRA_LIB += $(COPY_GRAALUNIT_LIBS)
+
+    ### Compile and build graalunit tests
+    $(eval $(call SetupJavaCompilation, BUILD_VM_COMPILER_TESTS, \
+        SETUP := GENERATE_USINGJDKBYTECODE, \
+        SRC := \
+            $(SRC_DIR)/jdk.internal.vm.compiler.collections.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.api.directives.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.api.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.aarch64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.amd64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.sparc.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.asm.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.core.amd64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.core.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.debug.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.graph.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.amd64.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.lir.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.sparc.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.hotspot.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.lir.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.loop.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.nodes.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.options.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.phases.common.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.replacements.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.test/src \
+            $(SRC_DIR)/org.graalvm.util.test/src \
+            $(SRC_DIR)/org.graalvm.compiler.jtt/src \
+            $(SRC_DIR)/org.graalvm.compiler.lir.jtt/src \
+            , \
+        BIN := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests, \
+        JAR := $(COMPILE_OUTPUTDIR)/jdk.vm.compiler.tests.jar, \
+        CLASSPATH := \
+            $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.compiler \
+            $(JDK_OUTPUTDIR)/modules/jdk.internal.vm.ci \
+            $(LIB_OUTPUTDIR)/junit-4.12.jar \
+            $(LIB_OUTPUTDIR)/asm-5.0.4.jar \
+            $(LIB_OUTPUTDIR)/asm-tree-5.0.4.jar \
+            $(LIB_OUTPUTDIR)/java-allocation-instrumenter.jar \
+            $(LIB_OUTPUTDIR)/hamcrest-core-1.3.jar \
+            , \
+        ADD_JAVAC_FLAGS := \
+            -Xlint:none -processorpath \
+            $(BUILDTOOLS_OUTPUTDIR)/jdk.vm.compiler.replacements.verifier.jar \
+            --add-exports jdk.unsupported/sun.misc=ALL-UNNAMED \
+            , \
+    ))
+
+    TARGETS_BUILD += $(BUILD_VM_COMPILER_TESTS)
+
+
+    ### Compile and build mxtool
+    $(eval $(call SetupJavaCompilation, BUILD_MXTOOL, \
+        SETUP := GENERATE_USINGJDKBYTECODE, \
+        SRC := $(TEST_DIR)/com.oracle.mxtool.junit, \
+        BIN := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit, \
+        JAR := $(COMPILE_OUTPUTDIR)/com.oracle.mxtool.junit.jar, \
+        CLASSPATH := $(LIB_OUTPUTDIR)/junit-4.12.jar, \
+    ))
+
+    TARGETS_BUILD += $(BUILD_MXTOOL)
+
+
+    ################################################################################
+    # Targets for building test-image.
+    ################################################################################
+
+    # Copy to hotspot jtreg test image
+    $(eval $(call SetupCopyFiles, COPY_HOTSPOT_JTREG_GRAAL, \
+        SRC := $(COMPILE_OUTPUTDIR), \
+        DEST := $(LIB_OUTPUTDIR), \
+        FILES := jdk.vm.compiler.tests.jar com.oracle.mxtool.junit.jar, \
+    ))
+
+    TARGETS_IMAGE += $(COPY_HOTSPOT_JTREG_GRAAL)
+  else
+    $(info Skip building of Graal unit tests because 3rd party libraries directory is not specified)
+  endif
+endif
+
+$(TARGETS_BUILD): $(TARGETS_EXTRA_LIB)
+build-test-hotspot-jtreg-graal: $(TARGETS_BUILD)
+test-image-hotspot-jtreg-graal: $(TARGETS_IMAGE)
+
+all: build-test-hotspot-jtreg-graal
+test-image: test-image-hotspot-jtreg-graal
+
+.PHONY: default all build-test-hotspot-jtreg-graal test-image-hotspot-jtreg-graal test-image
--- a/src/hotspot/share/compiler/compileBroker.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/compiler/compileBroker.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -1638,12 +1638,6 @@
  * out to be a problem.
  */
 void CompileBroker::shutdown_compiler_runtime(AbstractCompiler* comp, CompilerThread* thread) {
-  // Free buffer blob, if allocated
-  if (thread->get_buffer_blob() != NULL) {
-    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-    CodeCache::free(thread->get_buffer_blob());
-  }
-
   if (comp->should_perform_shutdown()) {
     // There are two reasons for shutting down the compiler
     // 1) compiler runtime initialization failed
--- a/src/hotspot/share/gc/shared/referenceProcessor.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/gc/shared/referenceProcessor.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -1033,7 +1033,7 @@
   // The last ref must have its discovered field pointing to itself.
   oop next_discovered = (current_head != NULL) ? current_head : obj;
 
-  oop retest = RawAccess<>::oop_atomic_cmpxchg(next_discovered, discovered_addr, oop(NULL));
+  oop retest = HeapAccess<AS_NO_KEEPALIVE>::oop_atomic_cmpxchg(next_discovered, discovered_addr, oop(NULL));
 
   if (retest == NULL) {
     // This thread just won the right to enqueue the object.
--- a/src/hotspot/share/opto/gcm.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/opto/gcm.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -683,7 +683,7 @@
     Block* store_block = get_block_for_node(store);
     assert(store_block != NULL, "unused killing projections skipped above");
 
-    if (store->is_Phi() && store->in(0)->is_Loop()) {
+    if (store->is_Phi()) {
       // Loop-phis need to raise load before input. (Other phis are treated
       // as store below.)
       //
--- a/src/hotspot/share/opto/ifnode.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/opto/ifnode.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -1490,7 +1490,8 @@
   // be skipped. For example, range check predicate has two checks
   // for lower and upper bounds.
   ProjNode* unc_proj = proj_out(1 - prev_dom->as_Proj()->_con)->as_Proj();
-  if (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL) {
+  if (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL ||
+      unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_profile_predicate) != NULL) {
     prev_dom = idom;
   }
 
--- a/src/hotspot/share/opto/loopPredicate.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/opto/loopPredicate.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -1056,7 +1056,9 @@
           stack.push(in, 1);
           break;
         } else if (in->is_IfProj() &&
-                   in->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none)) {
+                   in->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none) &&
+                   (in->in(0)->Opcode() == Op_If ||
+                    in->in(0)->Opcode() == Op_RangeCheck)) {
           if (pf.to(in) * loop_trip_cnt >= 1) {
             stack.push(in, 1);
           }
@@ -1281,7 +1283,7 @@
     Node* n = skip_loop_predicates(entry);
     // Check if predicates were already added to the profile predicate
     // block
-    if (n != entry->in(0)->in(0)) {
+    if (n != entry->in(0)->in(0) || n->outcnt() != 1) {
       has_profile_predicates = true;
     }
     entry = n;
--- a/src/hotspot/share/opto/loopnode.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/opto/loopnode.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -4224,34 +4224,34 @@
   // which can inhibit range check elimination.
   if (least != early) {
     Node* ctrl_out = least->unique_ctrl_out();
-    if (ctrl_out && ctrl_out->is_CountedLoop() &&
+    if (ctrl_out && ctrl_out->is_Loop() &&
         least == ctrl_out->in(LoopNode::EntryControl)) {
+      // Move the node above predicates as far up as possible so a
+      // following pass of loop predication doesn't hoist a predicate
+      // that depends on it above that node.
       Node* new_ctrl = least;
-      // Move the node above predicates so a following pass of loop
-      // predication doesn't hoist a predicate that depends on it
-      // above that node.
-      if (find_predicate_insertion_point(new_ctrl, Deoptimization::Reason_loop_limit_check) != NULL) {
-        new_ctrl = new_ctrl->in(0)->in(0);
-        assert(is_dominator(early, new_ctrl), "least != early so we can move up the dominator tree");
-      }
-      if (find_predicate_insertion_point(new_ctrl, Deoptimization::Reason_profile_predicate) != NULL) {
+      for (;;) {
+        if (!new_ctrl->is_Proj()) {
+          break;
+        }
+        CallStaticJavaNode* call = new_ctrl->as_Proj()->is_uncommon_trap_if_pattern(Deoptimization::Reason_none);
+        if (call == NULL) {
+          break;
+        }
+        int req = call->uncommon_trap_request();
+        Deoptimization::DeoptReason trap_reason = Deoptimization::trap_request_reason(req);
+        if (trap_reason != Deoptimization::Reason_loop_limit_check &&
+            trap_reason != Deoptimization::Reason_predicate &&
+            trap_reason != Deoptimization::Reason_profile_predicate) {
+          break;
+        }
         Node* c = new_ctrl->in(0)->in(0);
-        assert(is_dominator(early, c), "least != early so we can move up the dominator tree");
+        if (is_dominator(c, early) && c != early) {
+          break;
+        }
         new_ctrl = c;
       }
-      if (find_predicate_insertion_point(new_ctrl, Deoptimization::Reason_predicate) != NULL) {
-        Node* c = new_ctrl->in(0)->in(0);
-        assert(is_dominator(early, c), "least != early so we can move up the dominator tree");
-        new_ctrl = c;
-      }
-      if (new_ctrl != ctrl_out) {
-        least = new_ctrl;
-      } else if (ctrl_out->is_CountedLoop() || ctrl_out->is_OuterStripMinedLoop()) {
-        Node* least_dom = idom(least);
-        if (get_loop(least_dom)->is_member(get_loop(least))) {
-          least = least_dom;
-        }
-      }
+      least = new_ctrl;
     }
   }
 
--- a/src/hotspot/share/opto/loopopts.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/opto/loopopts.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -257,6 +257,7 @@
   ProjNode* unc_proj = iff->as_If()->proj_out(1 - dp_proj->_con)->as_Proj();
   if (exclude_loop_predicate &&
       (unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_predicate) != NULL ||
+       unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_profile_predicate) != NULL ||
        unc_proj->is_uncommon_trap_proj(Deoptimization::Reason_range_check) != NULL)) {
     // If this is a range check (IfNode::is_range_check), do not
     // reorder because Compile::allow_range_check_smearing might have
--- a/src/hotspot/share/opto/memnode.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/opto/memnode.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -518,8 +518,7 @@
       if (ac->is_clonebasic()) {
         intptr_t offset;
         AllocateNode* alloc = AllocateNode::Ideal_allocation(ac->in(ArrayCopyNode::Dest), phase, offset);
-        assert(alloc != NULL && (!ReduceBulkZeroing || alloc->initialization()->is_complete_with_arraycopy()), "broken allocation");
-        if (alloc == ld_alloc) {
+        if (alloc != NULL && alloc == ld_alloc) {
           return ac;
         }
       }
--- a/src/hotspot/share/runtime/handshake.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/runtime/handshake.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -297,12 +297,12 @@
 
 void HandshakeState::set_operation(JavaThread* target, HandshakeOperation* op) {
   _operation = op;
-  SafepointMechanism::arm_local_poll(target);
+  SafepointMechanism::arm_local_poll_release(target);
 }
 
 void HandshakeState::clear_handshake(JavaThread* target) {
   _operation = NULL;
-  SafepointMechanism::disarm_local_poll(target);
+  SafepointMechanism::disarm_local_poll_release(target);
 }
 
 void HandshakeState::process_self_inner(JavaThread* thread) {
--- a/src/hotspot/share/runtime/safepoint.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/runtime/safepoint.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -243,9 +243,10 @@
     if (SafepointMechanism::uses_thread_local_poll()) {
       // Arming the per thread poll while having _state != _not_synchronized means safepointing
       log_trace(safepoint)("Setting thread local yield flag for threads");
+      OrderAccess::storestore(); // storestore, global state -> local state
       for (JavaThreadIteratorWithHandle jtiwh; JavaThread *cur = jtiwh.next(); ) {
         // Make sure the threads start polling, it is time to yield.
-        SafepointMechanism::arm_local_poll(cur); // release store, global state -> local state
+        SafepointMechanism::arm_local_poll(cur);
       }
     }
     OrderAccess::fence(); // storestore|storeload, global state -> local state
@@ -546,7 +547,7 @@
         for (; JavaThread *current = jtiwh.next(); ) {
           ThreadSafepointState* cur_state = current->safepoint_state();
           cur_state->restart(); // TSS _running
-          SafepointMechanism::disarm_local_poll(current); // release store, local state -> polling page
+          SafepointMechanism::disarm_local_poll(current);
         }
         log_info(safepoint)("Leaving safepoint region");
       } else {
--- a/src/hotspot/share/runtime/safepointMechanism.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/runtime/safepointMechanism.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -79,9 +79,13 @@
   // Blocks a thread until safepoint is completed
   static inline void block_if_requested(JavaThread* thread);
 
+  // Caller is responsible for using a memory barrier if needed.
   static inline void arm_local_poll(JavaThread* thread);
   static inline void disarm_local_poll(JavaThread* thread);
 
+  static inline void arm_local_poll_release(JavaThread* thread);
+  static inline void disarm_local_poll_release(JavaThread* thread);
+
   // Setup the selected safepoint mechanism
   static void initialize();
   static void initialize_header(JavaThread* thread);
--- a/src/hotspot/share/runtime/safepointMechanism.inline.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/runtime/safepointMechanism.inline.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -87,4 +87,12 @@
   thread->set_polling_page(poll_disarmed_value());
 }
 
+void SafepointMechanism::arm_local_poll_release(JavaThread* thread) {
+  thread->set_polling_page_release(poll_armed_value());
+}
+
+void SafepointMechanism::disarm_local_poll_release(JavaThread* thread) {
+  thread->set_polling_page_release(poll_disarmed_value());
+}
+
 #endif // SHARE_VM_RUNTIME_SAFEPOINTMECHANISM_INLINE_HPP
--- a/src/hotspot/share/runtime/thread.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/runtime/thread.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -3298,6 +3298,11 @@
 }
 
 CompilerThread::~CompilerThread() {
+  // Free buffer blob, if allocated
+  if (get_buffer_blob() != NULL) {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    CodeCache::free(get_buffer_blob());
+  }
   // Delete objects which were allocated on heap.
   delete _counters;
 }
--- a/src/hotspot/share/runtime/thread.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/runtime/thread.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -1207,6 +1207,7 @@
   bool do_not_unlock_if_synchronized()             { return _do_not_unlock_if_synchronized; }
   void set_do_not_unlock_if_synchronized(bool val) { _do_not_unlock_if_synchronized = val; }
 
+  inline void set_polling_page_release(void* poll_value);
   inline void set_polling_page(void* poll_value);
   inline volatile void* get_polling_page();
 
--- a/src/hotspot/share/runtime/thread.inline.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/runtime/thread.inline.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -170,8 +170,13 @@
 
 // The release make sure this store is done after storing the handshake
 // operation or global state
+inline void JavaThread::set_polling_page_release(void* poll_value) {
+  OrderAccess::release_store(polling_page_addr(), poll_value);
+}
+
+// Caller is responsible for using a memory barrier if needed.
 inline void JavaThread::set_polling_page(void* poll_value) {
-  OrderAccess::release_store(polling_page_addr(), poll_value);
+  *polling_page_addr() = poll_value;
 }
 
 // The aqcquire make sure reading of polling page is done before
--- a/src/hotspot/share/services/mallocSiteTable.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/services/mallocSiteTable.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -42,7 +42,7 @@
 
  public:
   MallocSite() :
-    AllocationSite<MemoryCounter>(NativeCallStack::EMPTY_STACK), _flags(mtNone) {}
+    AllocationSite<MemoryCounter>(NativeCallStack::empty_stack()), _flags(mtNone) {}
 
   MallocSite(const NativeCallStack& stack, MEMFLAGS flags) :
     AllocationSite<MemoryCounter>(stack), _flags(flags) {}
--- a/src/hotspot/share/services/memTracker.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/services/memTracker.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -31,8 +31,8 @@
 
 #if !INCLUDE_NMT
 
-#define CURRENT_PC   NativeCallStack::EMPTY_STACK
-#define CALLER_PC    NativeCallStack::EMPTY_STACK
+#define CURRENT_PC   NativeCallStack::empty_stack()
+#define CALLER_PC    NativeCallStack::empty_stack()
 
 class Tracker : public StackObj {
  public:
@@ -86,9 +86,9 @@
 extern volatile bool NMT_stack_walkable;
 
 #define CURRENT_PC ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ? \
-                    NativeCallStack(0, true) : NativeCallStack::EMPTY_STACK)
+                    NativeCallStack(0, true) : NativeCallStack::empty_stack())
 #define CALLER_PC  ((MemTracker::tracking_level() == NMT_detail && NMT_stack_walkable) ?  \
-                    NativeCallStack(1, true) : NativeCallStack::EMPTY_STACK)
+                    NativeCallStack(1, true) : NativeCallStack::empty_stack())
 
 class MemBaseline;
 class Mutex;
--- a/src/hotspot/share/services/virtualMemoryTracker.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/services/virtualMemoryTracker.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -302,7 +302,7 @@
 
 
   ReservedMemoryRegion(address base, size_t size) :
-    VirtualMemoryRegion(base, size), _stack(NativeCallStack::EMPTY_STACK), _flag(mtNone) { }
+    VirtualMemoryRegion(base, size), _stack(NativeCallStack::empty_stack()), _flag(mtNone) { }
 
   // Copy constructor
   ReservedMemoryRegion(const ReservedMemoryRegion& rr) :
--- a/src/hotspot/share/utilities/nativeCallStack.cpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/utilities/nativeCallStack.cpp	Tue Jul 03 11:23:42 2018 +0200
@@ -28,7 +28,7 @@
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/nativeCallStack.hpp"
 
-const NativeCallStack NativeCallStack::EMPTY_STACK(0, false);
+NativeCallStack NativeCallStack::EMPTY_STACK(0, false);
 
 NativeCallStack::NativeCallStack(int toSkip, bool fillStack) :
   _hash_value(0) {
@@ -126,4 +126,3 @@
     }
   }
 }
-
--- a/src/hotspot/share/utilities/nativeCallStack.hpp	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/hotspot/share/utilities/nativeCallStack.hpp	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,18 +51,23 @@
  * 2. The class is strict stack object, no heap or virtual memory can be allocated
  *    from it.
  */
+class MemTracker;
+
 class NativeCallStack : public StackObj {
- public:
-  static const NativeCallStack EMPTY_STACK;
+  friend class MemTracker;
 
- private:
+private:
   address       _stack[NMT_TrackingStackDepth];
   unsigned int  _hash_value;
 
- public:
+  static NativeCallStack EMPTY_STACK;
+public:
   NativeCallStack(int toSkip = 0, bool fillStack = false);
   NativeCallStack(address* pc, int frameCount);
 
+  static inline const NativeCallStack& empty_stack() {
+    return EMPTY_STACK;
+  }
 
   // if it is an empty stack
   inline bool is_empty() const {
--- a/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java	Tue Jul 03 11:23:42 2018 +0200
@@ -100,7 +100,7 @@
     private static void checkKeyAlgo(Key key, String expectedAlg)
             throws InvalidKeyException {
         String keyAlg = key.getAlgorithm();
-        if (!(keyAlg.equalsIgnoreCase(expectedAlg))) {
+        if (keyAlg == null || !(keyAlg.equalsIgnoreCase(expectedAlg))) {
             throw new InvalidKeyException("Expected a " + expectedAlg
                     + " key, but got " + keyAlg);
         }
@@ -123,8 +123,7 @@
             return (RSAKey)key;
         } else {
             try {
-                String keyAlgo = key.getAlgorithm();
-                KeyType type = KeyType.lookup(keyAlgo);
+                KeyType type = KeyType.lookup(key.getAlgorithm());
                 RSAKeyFactory kf = RSAKeyFactory.getInstance(type);
                 return (RSAKey) kf.engineTranslateKey(key);
             } catch (ProviderException e) {
@@ -268,8 +267,7 @@
                 throw new InvalidKeyException("Invalid key", e);
             }
         } else if ("X.509".equals(key.getFormat())) {
-            byte[] encoded = key.getEncoded();
-            RSAPublicKey translated = new RSAPublicKeyImpl(encoded);
+            RSAPublicKey translated = new RSAPublicKeyImpl(key.getEncoded());
             // ensure the key algorithm matches the current KeyFactory instance
             checkKeyAlgo(translated, type.keyAlgo());
             return translated;
@@ -313,8 +311,8 @@
                 throw new InvalidKeyException("Invalid key", e);
             }
         } else if ("PKCS#8".equals(key.getFormat())) {
-            byte[] encoded = key.getEncoded();
-            RSAPrivateKey translated = RSAPrivateCrtKeyImpl.newKey(encoded);
+            RSAPrivateKey translated =
+                RSAPrivateCrtKeyImpl.newKey(key.getEncoded());
             // ensure the key algorithm matches the current KeyFactory instance
             checkKeyAlgo(translated, type.keyAlgo());
             return translated;
--- a/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java	Tue Jul 03 11:23:42 2018 +0200
@@ -123,6 +123,10 @@
      * Construct a key from its encoding. Called from newKey above.
      */
     RSAPrivateCrtKeyImpl(byte[] encoded) throws InvalidKeyException {
+        if (encoded == null || encoded.length == 0) {
+            throw new InvalidKeyException("Missing key encoding");
+        }
+
         decode(encoded);
         RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), e);
         try {
--- a/src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.base/share/classes/sun/security/rsa/RSAPublicKeyImpl.java	Tue Jul 03 11:23:42 2018 +0200
@@ -116,6 +116,9 @@
      * Construct a key from its encoding. Used by RSAKeyFactory.
      */
     RSAPublicKeyImpl(byte[] encoded) throws InvalidKeyException {
+        if (encoded == null || encoded.length == 0) {
+            throw new InvalidKeyException("Missing key encoding");
+        }
         decode(encoded); // this sets n and e value
         RSAKeyFactory.checkRSAProviderKeyLengths(n.bitLength(), e);
         checkExponentRange(n, e);
--- a/src/java.base/share/classes/sun/security/rsa/RSAUtil.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.base/share/classes/sun/security/rsa/RSAUtil.java	Tue Jul 03 11:23:42 2018 +0200
@@ -52,7 +52,11 @@
         public String keyAlgo() {
             return algo;
         }
-        public static KeyType lookup(String name) {
+        public static KeyType lookup(String name)
+                throws InvalidKeyException, ProviderException {
+            if (name == null) {
+                throw new InvalidKeyException("Null key algorithm");
+            }
             for (KeyType kt : KeyType.values()) {
                 if (kt.keyAlgo().equalsIgnoreCase(name)) {
                     return kt;
@@ -133,21 +137,24 @@
             throws ProviderException {
         if (params == null) return null;
 
-        String algName = params.getAlgorithm();
-        KeyType type = KeyType.lookup(algName);
-        Class<? extends AlgorithmParameterSpec> specCls;
-        switch (type) {
-            case RSA:
-                throw new ProviderException("No params accepted for " +
-                    type.keyAlgo());
-            case PSS:
-                specCls = PSSParameterSpec.class;
-                break;
-            default:
-                throw new ProviderException("Unsupported RSA algorithm: " + algName);
-        }
         try {
+            String algName = params.getAlgorithm();
+            KeyType type = KeyType.lookup(algName);
+            Class<? extends AlgorithmParameterSpec> specCls;
+            switch (type) {
+                case RSA:
+                    throw new ProviderException("No params accepted for " +
+                        type.keyAlgo());
+                case PSS:
+                    specCls = PSSParameterSpec.class;
+                    break;
+                default:
+                    throw new ProviderException("Unsupported RSA algorithm: " + algName);
+            }
             return params.getParameterSpec(specCls);
+        } catch (ProviderException pe) {
+            // pass it up
+            throw pe;
         } catch (Exception e) {
             throw new ProviderException(e);
         }
--- a/src/java.base/share/legal/public_suffix.md	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.base/share/legal/public_suffix.md	Tue Jul 03 11:23:42 2018 +0200
@@ -1,7 +1,7 @@
 ## Mozilla Public Suffix List
 
 ### Public Suffix Notice
-<pre>
+```
 You are receiving a copy of the Mozilla Public Suffix List in the following
 file: <java-home>/lib/security/public_suffix_list.dat. The terms of the
 Oracle license do NOT apply to this file; it is licensed under the
@@ -11,17 +11,17 @@
 
 The Source Code of this file is available under the
 Mozilla Public License, v. 2.0 and is located at
-https://github.com/publicsuffix/list/blob/03089bfe4aa5b7a2e291f33e07a28d20f875cb83/public_suffix_list.dat
+https://raw.githubusercontent.com/publicsuffix/list/2225db8d9f4a2a27ec697c883360632fa0c16261/public_suffix_list.dat.
 If a copy of the MPL was not distributed with this file, you can obtain one
-at http://mozilla.org/MPL/2.0/.
+at https://mozilla.org/MPL/2.0/.
 
 Software distributed under the License is distributed on an "AS IS" basis,
 WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 for the specific language governing rights and limitations under the License. 
-</pre>
+```
 
 ### MPL v2.0
-<pre>
+```
 Mozilla Public License Version 2.0
 ==================================
 
@@ -381,7 +381,7 @@
 
   This Source Code Form is subject to the terms of the Mozilla Public
   License, v. 2.0. If a copy of the MPL was not distributed with this
-  file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  file, You can obtain one at https://mozilla.org/MPL/2.0/.
 
 If it is not possible or desirable to put the notice in a particular
 file, then You may include the notice in a location (such as a LICENSE
@@ -396,4 +396,4 @@
   This Source Code Form is "Incompatible With Secondary Licenses", as
   defined by the Mozilla Public License, v. 2.0.
 
-</pre>
+```
--- a/src/java.base/windows/native/libjava/io_util_md.c	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.base/windows/native/libjava/io_util_md.c	Tue Jul 03 11:23:42 2018 +0200
@@ -458,19 +458,20 @@
     return 0;
 }
 
-
-int
+jint
 handleSetLength(FD fd, jlong length) {
     HANDLE h = (HANDLE)fd;
-    long high = (long)(length >> 32);
-    DWORD ret;
+    FILE_END_OF_FILE_INFO eofInfo;
 
-    if (h == (HANDLE)(-1)) return -1;
-    ret = SetFilePointer(h, (long)(length), &high, FILE_BEGIN);
-    if (ret == 0xFFFFFFFF && GetLastError() != NO_ERROR) {
+    eofInfo.EndOfFile.QuadPart = length;
+
+    if (h == INVALID_HANDLE_VALUE) {
         return -1;
     }
-    if (SetEndOfFile(h) == FALSE) return -1;
+    if (!SetFileInformationByHandle(h, FileEndOfFileInfo, &eofInfo,
+            sizeof(FILE_END_OF_FILE_INFO))) {
+        return -1;
+    }
     return 0;
 }
 
--- a/src/java.base/windows/native/libjava/io_util_md.h	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.base/windows/native/libjava/io_util_md.h	Tue Jul 03 11:23:42 2018 +0200
@@ -43,7 +43,7 @@
 int currentDirLength(const WCHAR* path, int pathlen);
 int handleAvailable(FD fd, jlong *pbytes);
 int handleSync(FD fd);
-int handleSetLength(FD fd, jlong length);
+jint handleSetLength(FD fd, jlong length);
 jlong handleGetLength(FD fd);
 JNIEXPORT jint handleRead(FD fd, void *buf, jint len);
 jint handleWrite(FD fd, const void *buf, jint len);
--- a/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -3320,7 +3320,7 @@
             } else if (name == "indexForNullComponent") {
                 isRunsDirty = true;
                 updateHtmlViews((Integer) e.getNewValue(), true);
-            } else if (name == "font") {
+            } else if (name == "font" || SwingUtilities2.isScaleChanged(e)) {
                 calculatedBaseline = false;
             }
         }
--- a/src/java.desktop/share/classes/java/awt/Component.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/java/awt/Component.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,67 +22,98 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package java.awt;
 
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.util.Objects;
-import java.util.Vector;
-import java.util.Locale;
-import java.util.EventListener;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.Collections;
+import java.applet.Applet;
+import java.awt.dnd.DropTarget;
+import java.awt.event.ActionEvent;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.ComponentEvent;
+import java.awt.event.ComponentListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
+import java.awt.event.HierarchyBoundsListener;
+import java.awt.event.HierarchyEvent;
+import java.awt.event.HierarchyListener;
+import java.awt.event.InputEvent;
+import java.awt.event.InputMethodEvent;
+import java.awt.event.InputMethodListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.KeyListener;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.awt.event.MouseWheelEvent;
+import java.awt.event.MouseWheelListener;
+import java.awt.event.PaintEvent;
+import java.awt.event.TextEvent;
+import java.awt.im.InputContext;
+import java.awt.im.InputMethodRequests;
+import java.awt.image.BufferStrategy;
+import java.awt.image.ColorModel;
+import java.awt.image.ImageObserver;
+import java.awt.image.ImageProducer;
+import java.awt.image.VolatileImage;
 import java.awt.peer.ComponentPeer;
 import java.awt.peer.ContainerPeer;
 import java.awt.peer.LightweightPeer;
-import java.awt.image.BufferStrategy;
-import java.awt.image.ImageObserver;
-import java.awt.image.ImageProducer;
-import java.awt.image.ColorModel;
-import java.awt.image.VolatileImage;
-import java.awt.event.*;
-import java.io.Serializable;
-import java.io.ObjectOutputStream;
-import java.io.ObjectInputStream;
-import java.io.IOException;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeSupport;
 import java.beans.Transient;
-import java.awt.im.InputContext;
-import java.awt.im.InputMethodRequests;
-import java.awt.dnd.DropTarget;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.security.AccessControlContext;
 import java.security.AccessController;
-import java.security.AccessControlContext;
-import javax.accessibility.*;
-import java.applet.Applet;
+import java.util.Collections;
+import java.util.EventListener;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.Vector;
+
+import javax.accessibility.Accessible;
+import javax.accessibility.AccessibleComponent;
+import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
+import javax.accessibility.AccessibleSelection;
+import javax.accessibility.AccessibleState;
+import javax.accessibility.AccessibleStateSet;
 import javax.swing.JComponent;
 import javax.swing.JRootPane;
 
-import sun.awt.ComponentFactory;
-import sun.security.action.GetPropertyAction;
+import sun.awt.AWTAccessor;
 import sun.awt.AppContext;
-import sun.awt.AWTAccessor;
+import sun.awt.ComponentFactory;
 import sun.awt.ConstrainableGraphics;
+import sun.awt.EmbeddedFrame;
+import sun.awt.RequestFocusController;
 import sun.awt.SubRegionShowable;
 import sun.awt.SunToolkit;
-import sun.awt.EmbeddedFrame;
 import sun.awt.dnd.SunDropTargetEvent;
 import sun.awt.im.CompositionArea;
+import sun.awt.image.VSyncedBSManager;
 import sun.font.FontManager;
 import sun.font.FontManagerFactory;
 import sun.font.SunFontManager;
 import sun.java2d.SunGraphics2D;
+import sun.java2d.SunGraphicsEnvironment;
 import sun.java2d.pipe.Region;
-import sun.awt.image.VSyncedBSManager;
 import sun.java2d.pipe.hw.ExtendedBufferCapabilities;
-import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.*;
-import sun.awt.RequestFocusController;
-import sun.java2d.SunGraphicsEnvironment;
+import sun.security.action.GetPropertyAction;
 import sun.swing.SwingAccessor;
 import sun.util.logging.PlatformLogger;
 
+import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_DEFAULT;
+import static sun.java2d.pipe.hw.ExtendedBufferCapabilities.VSyncType.VSYNC_ON;
+
 /**
  * A <em>component</em> is an object having a graphical representation
  * that can be displayed on the screen and that can interact with the
@@ -1129,24 +1160,31 @@
         }
     }
 
-    boolean updateGraphicsData(GraphicsConfiguration gc) {
+    final boolean updateGraphicsData(GraphicsConfiguration gc) {
+        GraphicsConfiguration oldConfig = graphicsConfig;
+        // First, update own graphics configuration
+        boolean ret = updateSelfGraphicsData(gc);
+        // Second, update children graphics configurations
+        ret |= updateChildGraphicsData(gc);
+        // Third, fire PropertyChange if needed
+        if (oldConfig != gc) {
+            /*
+             * If component is moved from one screen to another screen or shown
+             * for the first time graphicsConfiguration property is fired to
+             * enable the component to recalculate any rendering data, if needed
+             */
+            firePropertyChange("graphicsConfiguration", oldConfig, gc);
+        }
+        return ret;
+    }
+
+    private boolean updateSelfGraphicsData(GraphicsConfiguration gc) {
         checkTreeLock();
-
         if (graphicsConfig == gc) {
             return false;
         }
-        GraphicsConfiguration oldConfig = graphicsConfig;
         graphicsConfig = gc;
 
-        /*
-         * If component is moved from one screen to another sceeen
-         * graphicsConfiguration property is fired to enable the component
-         * to recalculate any rendering data, if needed
-         */
-        if (oldConfig != null && gc != null) {
-            firePropertyChange("graphicsConfiguration", oldConfig, gc);
-        }
-
         ComponentPeer peer = this.peer;
         if (peer != null) {
             return peer.updateGraphicsData(gc);
@@ -1154,6 +1192,10 @@
         return false;
     }
 
+    boolean updateChildGraphicsData(GraphicsConfiguration gc) {
+        return false;
+    }
+
     /**
      * Checks that this component's {@code GraphicsDevice}
      * {@code idString} matches the string argument.
--- a/src/java.desktop/share/classes/java/awt/Container.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/java/awt/Container.java	Tue Jul 03 11:23:42 2018 +0200
@@ -22,6 +22,7 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
+
 package java.awt;
 
 import java.awt.dnd.DropTarget;
@@ -1172,10 +1173,10 @@
     }
 
     @Override
-    boolean updateGraphicsData(GraphicsConfiguration gc) {
+    final boolean updateChildGraphicsData(GraphicsConfiguration gc) {
         checkTreeLock();
 
-        boolean ret = super.updateGraphicsData(gc);
+        boolean ret = false;
 
         for (Component comp : component) {
             if (comp != null) {
--- a/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/DefaultListCellRenderer.java	Tue Jul 03 11:23:42 2018 +0200
@@ -35,7 +35,7 @@
 
 import java.io.Serializable;
 import sun.swing.DefaultLookup;
-
+import sun.swing.SwingUtilities2;
 
 /**
  * Renders an item in a list.
@@ -259,9 +259,10 @@
     protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
         // Strings get interned...
         if (propertyName == "text"
-                || ((propertyName == "font" || propertyName == "foreground")
-                    && oldValue != newValue
-                    && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
+            || ((SwingUtilities2.isScaleChanged(propertyName, oldValue, newValue)
+                    || propertyName == "font" || propertyName == "foreground")
+                && oldValue != newValue
+                && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
 
             super.firePropertyChange(propertyName, oldValue, newValue);
         }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicButtonListener.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,9 +75,8 @@
         else if(prop == AbstractButton.CONTENT_AREA_FILLED_CHANGED_PROPERTY) {
             checkOpacity((AbstractButton) e.getSource() );
         }
-        else if(prop == AbstractButton.TEXT_CHANGED_PROPERTY ||
-                "font" == prop || "foreground" == prop ||
-                "ancestor" == prop || "graphicsConfiguration" == prop) {
+        else if(prop == AbstractButton.TEXT_CHANGED_PROPERTY || "font" == prop
+                || "foreground" == prop || SwingUtilities2.isScaleChanged(e)) {
             AbstractButton b = (AbstractButton) e.getSource();
             BasicHTML.updateRenderer(b, b.getText());
         }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicComboBoxUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@
 import java.beans.PropertyChangeEvent;
 import sun.awt.AppContext;
 import sun.swing.DefaultLookup;
+import sun.swing.SwingUtilities2;
 import sun.swing.UIAction;
 
 /**
@@ -1809,6 +1810,10 @@
                     isMinimumSizeDirty = true;
                     isDisplaySizeDirty = true;
                     comboBox.validate();
+                } else if (SwingUtilities2.isScaleChanged(e)) {
+                    isMinimumSizeDirty = true;
+                    isDisplaySizeDirty = true;
+                    comboBox.validate();
                 }
                 else if ( propertyName == JComponent.TOOL_TIP_TEXT_KEY ) {
                     updateToolTipTextForChildren();
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicLabelUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -477,8 +477,8 @@
 
     public void propertyChange(PropertyChangeEvent e) {
         String name = e.getPropertyName();
-        if (name == "text" || "font" == name || "foreground" == name ||
-            "ancestor" == name || "graphicsConfiguration" == name) {
+        if (name == "text" || "font" == name || "foreground" == name
+                || SwingUtilities2.isScaleChanged(e)) {
             // remove the old html view client property if one
             // existed, and install a new one if the text installed
             // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicListUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -2656,7 +2656,8 @@
                 updateLayoutStateNeeded |= cellRendererChanged;
                 redrawList();
             }
-            else if (propertyName == "font") {
+            else if (propertyName == "font"
+                    || SwingUtilities2.isScaleChanged(e)) {
                 updateLayoutStateNeeded |= fontChanged;
                 redrawList();
             }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicMenuItemUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1145,9 +1145,8 @@
             if (name == "labelFor" || name == "displayedMnemonic" ||
                 name == "accelerator") {
                 updateAcceleratorBinding();
-            } else if (name == "text" || "font" == name ||
-                       "foreground" == name ||
-                       "ancestor" == name || "graphicsConfiguration" == name) {
+            } else if (name == "text" || "font" == name || "foreground" == name
+                    || SwingUtilities2.isScaleChanged(e)) {
                 // remove the old html view client property if one
                 // existed, and install a new one if the text installed
                 // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicSliderUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 import javax.swing.event.*;
 import javax.swing.plaf.*;
 import sun.swing.DefaultLookup;
+import sun.swing.SwingUtilities2;
 import sun.swing.UIAction;
 
 
@@ -1829,6 +1830,7 @@
                     propertyName == "paintTicks" ||
                     propertyName == "paintTrack" ||
                     propertyName == "font" ||
+                    SwingUtilities2.isScaleChanged(e) ||
                     propertyName == "paintLabels" ||
                     propertyName == "Slider.paintThumbArrowShape") {
                 checkedLabelBaselines = false;
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -4008,7 +4008,7 @@
             } else if (name == "indexForNullComponent") {
                 isRunsDirty = true;
                 updateHtmlViews((Integer)e.getNewValue(), true);
-            } else if (name == "font") {
+            } else if (name == "font" || SwingUtilities2.isScaleChanged(e)) {
                 calculatedBaseline = false;
             }
         }
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicToolTipUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, 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
@@ -260,9 +260,8 @@
                                  PropertyChangeListener {
         public void propertyChange(PropertyChangeEvent e) {
             String name = e.getPropertyName();
-            if (name.equals("tiptext") || "font".equals(name) ||
-                "foreground".equals(name) ||
-                "ancestor" == name || "graphicsConfiguration" == name) {
+            if (name.equals("tiptext") || "foreground".equals(name)
+                || "font".equals(name) || SwingUtilities2.isScaleChanged(e)) {
                 // remove the old html view client property if one
                 // existed, and install a new one if the text installed
                 // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTreeUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -3843,7 +3843,8 @@
                 else if(changeName == JTree.SELECTION_MODEL_PROPERTY) {
                     setSelectionModel(tree.getSelectionModel());
                 }
-                else if(changeName == "font") {
+                else if(changeName == "font"
+                        || SwingUtilities2.isScaleChanged(event)) {
                     completeEditing();
                     if(treeState != null)
                         treeState.invalidateSizes();
--- a/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthToolTipUI.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
 import javax.swing.plaf.ComponentUI;
 import javax.swing.text.View;
 
+import sun.swing.SwingUtilities2;
 
 /**
  * Provides the Synth L&amp;F UI delegate for
@@ -226,9 +227,8 @@
             updateStyle((JToolTip)e.getSource());
         }
         String name = e.getPropertyName();
-        if (name.equals("tiptext") || "font".equals(name) ||
-                "foreground".equals(name) ||
-                "ancestor" == name || "graphicsConfiguration" == name) {
+        if (name.equals("tiptext") || SwingUtilities2.isScaleChanged(e)
+                || "foreground".equals(name) || "font".equals(name)) {
             // remove the old html view client property if one
             // existed, and install a new one if the text installed
             // into the JLabel is html source.
--- a/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/table/DefaultTableCellRenderer.java	Tue Jul 03 11:23:42 2018 +0200
@@ -34,7 +34,7 @@
 
 import java.io.Serializable;
 import sun.swing.DefaultLookup;
-
+import sun.swing.SwingUtilities2;
 
 /**
  * The standard class for rendering (displaying) individual cells
@@ -345,11 +345,12 @@
     protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
         // Strings get interned...
         if (propertyName=="text"
-                || propertyName == "labelFor"
-                || propertyName == "displayedMnemonic"
-                || ((propertyName == "font" || propertyName == "foreground")
-                    && oldValue != newValue
-                    && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
+            || propertyName == "labelFor"
+            || propertyName == "displayedMnemonic"
+            || ((SwingUtilities2.isScaleChanged(propertyName, oldValue, newValue)
+                    || propertyName == "font" || propertyName == "foreground")
+                && oldValue != newValue
+                && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
 
             super.firePropertyChange(propertyName, oldValue, newValue);
         }
--- a/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/javax/swing/tree/DefaultTreeCellRenderer.java	Tue Jul 03 11:23:42 2018 +0200
@@ -43,6 +43,7 @@
 import javax.swing.UIManager;
 import javax.swing.border.EmptyBorder;
 import sun.swing.DefaultLookup;
+import sun.swing.SwingUtilities2;
 
 /**
  * Displays an entry in a tree.
@@ -690,9 +691,10 @@
     protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
         // Strings get interned...
         if (propertyName == "text"
-                || ((propertyName == "font" || propertyName == "foreground")
-                    && oldValue != newValue
-                    && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
+            || ((SwingUtilities2.isScaleChanged(propertyName, oldValue, newValue)
+                    || propertyName == "font" || propertyName == "foreground")
+                && oldValue != newValue
+                && getClientProperty(javax.swing.plaf.basic.BasicHTML.propertyKey) != null)) {
 
             super.firePropertyChange(propertyName, oldValue, newValue);
         }
--- a/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.desktop/share/classes/sun/swing/SwingUtilities2.java	Tue Jul 03 11:23:42 2018 +0200
@@ -25,47 +25,94 @@
 
 package sun.swing;
 
-import java.lang.reflect.*;
-import java.awt.*;
-import static java.awt.RenderingHints.*;
-import java.awt.event.*;
-import java.awt.font.*;
+import java.awt.AWTEvent;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Container;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.FocusTraversalPolicy;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.GraphicsConfiguration;
+import java.awt.GraphicsEnvironment;
+import java.awt.Point;
+import java.awt.PrintGraphics;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.Toolkit;
+import java.awt.event.InputEvent;
+import java.awt.event.KeyEvent;
+import java.awt.event.MouseEvent;
+import java.awt.font.FontRenderContext;
+import java.awt.font.GlyphVector;
+import java.awt.font.LineBreakMeasurer;
+import java.awt.font.TextAttribute;
+import java.awt.font.TextHitInfo;
+import java.awt.font.TextLayout;
+import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
-import java.awt.geom.AffineTransform;
+import java.awt.print.PrinterGraphics;
+import java.beans.PropertyChangeEvent;
+import java.io.BufferedInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.text.AttributedCharacterIterator;
+import java.text.AttributedString;
+import java.text.BreakIterator;
+import java.text.CharacterIterator;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+import java.util.concurrent.Future;
+import java.util.concurrent.FutureTask;
+
+import javax.swing.JComponent;
+import javax.swing.JList;
+import javax.swing.JTable;
+import javax.swing.ListCellRenderer;
+import javax.swing.ListSelectionModel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIDefaults;
+import javax.swing.UIManager;
+import javax.swing.event.TreeModelEvent;
+import javax.swing.table.TableCellRenderer;
+import javax.swing.table.TableColumnModel;
+import javax.swing.text.DefaultCaret;
+import javax.swing.text.DefaultHighlighter;
+import javax.swing.text.Highlighter;
+import javax.swing.text.JTextComponent;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+import sun.awt.AWTAccessor;
+import sun.awt.AWTPermissions;
+import sun.awt.AppContext;
+import sun.awt.SunToolkit;
+import sun.font.FontDesignMetrics;
+import sun.font.FontUtilities;
+import sun.java2d.SunGraphicsEnvironment;
+import sun.print.ProxyPrintGraphics;
+
+import static java.awt.RenderingHints.KEY_TEXT_ANTIALIASING;
+import static java.awt.RenderingHints.KEY_TEXT_LCD_CONTRAST;
+import static java.awt.RenderingHints.VALUE_FRACTIONALMETRICS_DEFAULT;
+import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_DEFAULT;
+import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HBGR;
+import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB;
+import static java.awt.RenderingHints.VALUE_TEXT_ANTIALIAS_OFF;
 import static java.awt.geom.AffineTransform.TYPE_FLIP;
 import static java.awt.geom.AffineTransform.TYPE_MASK_SCALE;
 import static java.awt.geom.AffineTransform.TYPE_TRANSLATION;
-import java.awt.print.PrinterGraphics;
-import java.text.BreakIterator;
-import java.text.CharacterIterator;
-import java.text.AttributedCharacterIterator;
-import java.text.AttributedString;
-
-import javax.swing.*;
-import javax.swing.event.TreeModelEvent;
-import javax.swing.text.Highlighter;
-import javax.swing.text.JTextComponent;
-import javax.swing.text.DefaultHighlighter;
-import javax.swing.text.DefaultCaret;
-import javax.swing.table.TableCellRenderer;
-import javax.swing.table.TableColumnModel;
-import javax.swing.tree.TreeModel;
-import javax.swing.tree.TreePath;
-
-import sun.java2d.pipe.Region;
-import sun.print.ProxyPrintGraphics;
-import sun.awt.*;
-import java.io.*;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.util.*;
-import sun.font.FontDesignMetrics;
-import sun.font.FontUtilities;
-import sun.java2d.SunGraphicsEnvironment;
-
-import java.util.concurrent.Callable;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
 
 /**
  * A collection of utility methods for Swing.
@@ -2256,4 +2303,40 @@
     public interface RepaintListener {
         void repaintPerformed(JComponent c, int x, int y, int w, int h);
     }
+
+    /**
+     * Returns whether or not the scale used by {@code GraphicsConfiguration}
+     * was changed.
+     *
+     * @param  ev a {@code PropertyChangeEvent}
+     * @return whether or not the scale was changed
+     * @since 11
+     */
+    public static boolean isScaleChanged(final PropertyChangeEvent ev) {
+        return isScaleChanged(ev.getPropertyName(), ev.getOldValue(),
+                              ev.getNewValue());
+    }
+
+    /**
+     * Returns whether or not the scale used by {@code GraphicsConfiguration}
+     * was changed.
+     *
+     * @param  name the name of the property
+     * @param  oldValue the old value of the property
+     * @param  newValue the new value of the property
+     * @return whether or not the scale was changed
+     * @since 11
+     */
+    public static boolean isScaleChanged(final String name,
+                                         final Object oldValue,
+                                         final Object newValue) {
+        if (oldValue == newValue || !"graphicsConfiguration".equals(name)) {
+            return false;
+        }
+        var newGC = (GraphicsConfiguration) oldValue;
+        var oldGC = (GraphicsConfiguration) newValue;
+        var newTx = newGC != null ? newGC.getDefaultTransform() : null;
+        var oldTx = oldGC != null ? oldGC.getDefaultTransform() : null;
+        return !Objects.equals(newTx, oldTx);
+    }
 }
--- a/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/java.xml/share/classes/javax/xml/stream/XMLStreamReader.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -197,7 +197,6 @@
    *  with  two separate events: START_ELEMENT, END_ELEMENT - This preserves
    *   parsing equivalency of empty element to {@code <tag></tag>}.
    *
-   * This method will throw an IllegalStateException if it is called after hasNext() returns false.
    * @see javax.xml.stream.events.XMLEvent
    * @return the integer code corresponding to the current parse event
    * @throws java.util.NoSuchElementException if this is called when hasNext() returns false
--- a/src/jdk.internal.vm.compiler/share/classes/module-info.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/jdk.internal.vm.compiler/share/classes/module-info.java	Tue Jul 03 11:23:42 2018 +0200
@@ -32,6 +32,7 @@
 
     uses org.graalvm.compiler.code.DisassemblerProvider;
     uses org.graalvm.compiler.core.match.MatchStatementSet;
+    uses org.graalvm.compiler.debug.DebugHandlersFactory;
     uses org.graalvm.compiler.debug.TTYStreamProvider;
     uses org.graalvm.compiler.hotspot.CompilerConfigurationFactory;
     uses org.graalvm.compiler.hotspot.HotSpotBackendFactory;
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/CSVUtilTest.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/CSVUtilTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -117,8 +117,8 @@
             CSVUtil.Escape.println(new PrintStream(outputStream), format, toObjectArray(args));
             // get the actual string
             String printedStream = new String(outputStream.toByteArray(), StandardCharsets.UTF_8);
-            // remove newline
-            assertEquals(expected, printedStream.substring(0, printedStream.length() - 1));
+            // add newline to the expected string
+            assertEquals(expected + System.lineSeparator(), printedStream);
         }
 
         private static Object[] toObjectArray(String args) {
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/VersionsTest.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.debug.test/src/org/graalvm/compiler/debug/test/VersionsTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -27,6 +27,8 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.nio.file.FileVisitResult;
 import java.nio.file.FileVisitor;
 import java.nio.file.Files;
@@ -80,15 +82,15 @@
     }
 
     @Test
-    public void emptyProperties() {
-        Path root = Paths.get("file:/");
+    public void emptyProperties() throws URISyntaxException {
+        Path root = Paths.get(new URI("file:/"));
         Versions v = new Versions(root);
         assertEmpty(v.withVersions(null));
     }
 
     @Test
-    public void emptyWithNullProperties() {
-        Path root = Paths.get("file:/");
+    public void emptyWithNullProperties() throws URISyntaxException {
+        Path root = Paths.get(new URI("file:/"));
         Versions v = new Versions(root);
         assertEmpty(v.withVersions(null));
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot.test/src/org/graalvm/compiler/hotspot/test/CheckGraalIntrinsics.java	Tue Jul 03 11:23:42 2018 +0200
@@ -371,6 +371,7 @@
         if (isJDK11OrHigher()) {
             // Relevant for Java flight recorder
             add(toBeInvestigated,
+                            "java/util/Base64$Encoder.encodeBlock([BII[BIZ)V",
                             "jdk/jfr/internal/JVM.getEventWriter()Ljava/lang/Object;");
         }
 
--- a/test/TestCommon.gmk	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/TestCommon.gmk	Tue Jul 03 11:23:42 2018 +0200
@@ -448,6 +448,9 @@
 ifneq ($(VS120COMNTOOLS), )
   JTREG_BASIC_OPTIONS += -e:VS120COMNTOOLS="$(shell $(GETMIXEDPATH) "$(patsubst %\,%,$(VS120COMNTOOLS))")"
 endif
+
+JTREG_BASIC_OPTIONS += -e:TEST_IMAGE_GRAAL_DIR=${TEST_IMAGE_DIR}/hotspot/jtreg/graal
+
 # Set other vm and test options
 JTREG_TEST_OPTIONS += $(JAVA_ARGS:%=-javaoptions:%) $(JAVA_VM_ARGS:%=-vmoption:%)
 ifneq ($(JIB_JAR), )
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Tue Jul 03 11:23:42 2018 +0200
@@ -121,10 +121,6 @@
 vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001/TestDescription.java                              8203174   generic-all
 vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002/TestDescription.java                              8203174   generic-all
 vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance003/TestDescription.java                              8203174   generic-all
-vmTestbase/nsk/jdi/EventRequestManager/methodExitRequests/methexitreq002/TestDescription.java             8203174   generic-all
-vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest001/TestDescription.java  8203174   generic-all
-vmTestbase/nsk/jdi/MonitorContendedEnteredRequest/MonitorContendedEnteredRequest002/TestDescription.java  8203174   generic-all
-vmTestbase/nsk/jdi/MonitorWaitedRequest/addClassExclusionFilter/TestDescription.java                      8203174   generic-all
 vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java          8203174   generic-all
 vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java                                 8203174   generic-all
 vmTestbase/nsk/jdi/ReferenceType/instances/instances003/instances003.java                                 8203174   generic-all
@@ -153,8 +149,6 @@
 vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/TestDescription.java     8195674   generic-all
 vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn002/TestDescription.java     8195674   generic-all
 
-vmTestbase/nsk/jvmti/AttachOnDemand/attach024/TestDescription.java                 8195630   generic-all
-
 vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/TestDescription.java       8202342   generic-all
 
 vmTestbase/nsk/jvmti/scenarios/hotswap/HS102/hs102t002/TestDescription.java        8204506   macosx-all
@@ -171,3 +165,19 @@
 compiler/stable/TestStableShort.java                             8204347   generic-all
 compiler/stable/TestStableUByte.java                             8204347   generic-all
 compiler/stable/TestStableUShort.java                            8204347   generic-all
+
+# Graal unit tests
+org.graalvm.compiler.core.test.CheckGraalInvariants                              8205081
+org.graalvm.compiler.core.test.inlining.PolymorphicInliningTest                  8205081
+org.graalvm.compiler.core.test.OptionsVerifierTest                               8205081
+org.graalvm.compiler.core.test.ProfilingInfoTest                                 8205081
+org.graalvm.compiler.hotspot.test.CompilationWrapperTest                         8205081
+org.graalvm.compiler.hotspot.test.HsErrLogTest                                   8205081
+org.graalvm.compiler.hotspot.test.OptionsInFileTest                              8205081
+org.graalvm.compiler.replacements.test.classfile.ClassfileBytecodeProviderTest   8205081
+org.graalvm.compiler.replacements.test.classfile.RedefineIntrinsicTest           8205081
+
+org.graalvm.compiler.core.test.deopt.CompiledMethodTest          8202955
+org.graalvm.compiler.core.test.CountedLoopTest                   8199885
+org.graalvm.compiler.debug.test.DebugContextTest                 8203504
+org.graalvm.compiler.core.test.VerifyDebugUsageTest              8205078
--- a/test/hotspot/jtreg/TEST.groups	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/TEST.groups	Tue Jul 03 11:23:42 2018 +0200
@@ -76,7 +76,8 @@
 hotspot_not_fast_compiler = \
   :hotspot_compiler \
   -:tier1_compiler \
-  -:hotspot_slow_compiler
+  -:hotspot_slow_compiler \
+  -compiler/graalunit
 
 hotspot_slow_compiler = \
   compiler/codegen/aes \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/ApiDirectivesTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.api.directives.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/ApiTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.api.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/AsmAarch64Test.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.asm.aarch64.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/AsmAmd64Test.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.asm.amd64.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/AsmSparcTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.asm.sparc.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CollectionsTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix jdk.internal.vm.compiler.collections.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CoreAmd64Test.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.core.amd64.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CoreSparcTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ * @requires vm.simpleArch == "sparcv9"
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.core.sparc.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/CoreTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.core.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/DebugTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.debug.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/GraphTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ * @requires vm.graal.enabled
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.graph.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/HotspotAmd64Test.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.hotspot.amd64.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/HotspotLirTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.hotspot.lir.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/HotspotTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.hotspot.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/Jtt.MicroTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.micro -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttBackendTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.backend -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttBytecodeTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.bytecode -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttExceptTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.except -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttHotpathTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.hotpath -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttHotspotTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.hotspot -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttJdkTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.jdk -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangALTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.[a-lA-L] -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangMTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.[mM] -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLangNZTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.lang.[n-zN-Z] -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttLoopTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.loop -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttOptimizeTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.optimize -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttReflectAETest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.reflect.[a-eA-E] -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttReflectFTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.reflect.[fF] -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttReflectGZTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.reflect.[g-zG-Z] -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/JttThreadsTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.jtt.threads -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/LirJttTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.lir.jtt -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/LoopTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.loop.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/NodesTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ * @requires vm.graal.enabled
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.nodes.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/OptionsTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.options.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/PhasesCommonTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.phases.common.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/README.md	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,36 @@
+This directory contains jtreg tests which are wrapper tests to execute Graal unit tests similar way they are run in Graal project.
+The tests use compiler.graalunit.common.GraalUnitTestLauncher helper class to run Graal unit tests where the set of tests to execute
+is specified by '-prefix' argument. GraalUnitTestLauncher launches ported com.oracle.mxtool.junit.MxJUnitWrapper to run Graal unit
+tests as it is done by "mx unittest" command from Graal project.
+
+All compiler/graalunit/*.java tests were automatically generated by generateTests.sh script which reads
+"testName -> testPrefix [requiresStatement]" mapping from TestPackages.txt file and generates corresponding <testName>Test.java
+tests. The mapping takes into account tests execution time to avoid very long test runs.
+
+Graal unit tests depends on following external jar files:
+ asm-5.0.4.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/asm-5.0.4.jar
+
+ asm-tree-5.0.4.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/asm-tree-5.0.4.jar
+
+ junit-4.12.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/junit-4.12.jar
+
+ hamcrest-core-1.3.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/graal-external-deps/hamcrest-core-1.3.jar
+
+ java-allocation-instrumenter.jar:
+ https://lafo.ssw.uni-linz.ac.at/pub/java-allocation-instrumenter/java-allocation-instrumenter-8f0db117e64e.jar
+
+Before running the tests you need to download these jars from above locations in build/<platform>/images/test/hotspot/jtreg/graal/
+directory. Then you can pass it to jtreg as java option by using "-vmoptions:-Dgraalunit.libs="  or as environment variable
+by using "-e:TEST_IMAGE_GRAAL_DIR=..."
+
+Example:
+> jtreg -vt -jdk:<TESTED_JDK> -vmoptions:"-vmoptions:-Dgraalunit.libs=build/<platform>/images/test/hotspot/jtreg/graal"
+        compiler/graalunit/UtilTest.java
+
+To run Graal unit tests in Graal as JIT mode pass additional -vmoptions to jtreg:
+ -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+TieredCompilation -XX:+UseJVMCICompiler -Djvmci.Compiler=graal
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/ReplacementsTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.compiler.replacements.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/TestPackages.txt	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+Collections   jdk.internal.vm.compiler.collections.test
+ApiDirectives org.graalvm.compiler.api.directives.test
+Api           org.graalvm.compiler.api.test
+AsmAarch64    org.graalvm.compiler.asm.aarch64.test
+AsmAmd64      org.graalvm.compiler.asm.amd64.test
+AsmSparc      org.graalvm.compiler.asm.sparc.test
+CoreAmd64     org.graalvm.compiler.core.amd64.test
+CoreSparc     org.graalvm.compiler.core.sparc.test @requires vm.simpleArch == "sparcv9"
+Core          org.graalvm.compiler.core.test
+Debug         org.graalvm.compiler.debug.test
+Graph         org.graalvm.compiler.graph.test      @requires vm.graal.enabled
+HotspotAmd64  org.graalvm.compiler.hotspot.amd64.test
+HotspotLir    org.graalvm.compiler.hotspot.lir.test
+Hotspot       org.graalvm.compiler.hotspot.test
+Loop          org.graalvm.compiler.loop.test
+Nodes         org.graalvm.compiler.nodes.test      @requires vm.graal.enabled
+Options       org.graalvm.compiler.options.test
+PhasesCommon  org.graalvm.compiler.phases.common.test
+Replacements  org.graalvm.compiler.replacements.test
+Util          org.graalvm.util.test
+JttBackend    org.graalvm.compiler.jtt.backend
+JttBytecode   org.graalvm.compiler.jtt.bytecode
+JttExcept     org.graalvm.compiler.jtt.except
+JttHotpath    org.graalvm.compiler.jtt.hotpath
+JttHotspot    org.graalvm.compiler.jtt.hotspot
+JttJdk        org.graalvm.compiler.jtt.jdk
+JttLangAL     org.graalvm.compiler.jtt.lang.[a-lA-L]
+JttLangM      org.graalvm.compiler.jtt.lang.[mM]
+JttLangNZ     org.graalvm.compiler.jtt.lang.[n-zN-Z]
+JttLoop       org.graalvm.compiler.jtt.loop
+Jtt.Micro     org.graalvm.compiler.jtt.micro
+JttOptimize   org.graalvm.compiler.jtt.optimize
+JttReflectAE  org.graalvm.compiler.jtt.reflect.[a-eA-E]
+JttReflectF   org.graalvm.compiler.jtt.reflect.[fF]
+JttReflectGZ  org.graalvm.compiler.jtt.reflect.[g-zG-Z]
+JttThreads    org.graalvm.compiler.jtt.threads
+LirJtt        org.graalvm.compiler.lir.jtt
+Lir           org.graalvm.compiler.lir.test
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/UtilTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary
+ * @requires vm.opt.final.EnableJVMCI == true
+ *
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix org.graalvm.util.test -exclude ExcludeList.txt
+ */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/AnsiTerminalDecorator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+/**
+ * Color support for JUnit test output using ANSI escapes codes.
+ */
+class AnsiTerminalDecorator extends MxRunListenerDecorator {
+
+    /** Foreground black. */
+    public static final String BLACK = "\u001b[30m";
+    /** Foreground red. */
+    public static final String RED = "\u001b[31m";
+    /** Foreground green. */
+    public static final String GREEN = "\u001b[32m";
+    /** Foreground yellow. */
+    public static final String YELLOW = "\u001b[33m";
+    /** Foreground blue. */
+    public static final String BLUE = "\u001b[34m";
+    /** Foreground magenta. */
+    public static final String MAGENTA = "\u001b[35m";
+    /** Foreground cyan. */
+    public static final String CYAN = "\u001b[36m";
+    /** Foreground white. */
+    public static final String WHITE = "\u001b[37m";
+
+    /** Foreground bold black. */
+    public static final String BOLD_BLACK = "\u001b[30;1m";
+    /** Foreground bold red. */
+    public static final String BOLD_RED = "\u001b[31;1m";
+    /** Foreground bold green. */
+    public static final String BOLD_GREEN = "\u001b[32;1m";
+    /** Foreground bold yellow. */
+    public static final String BOLD_YELLOW = "\u001b[33;1m";
+    /** Foreground bold blue. */
+    public static final String BOLD_BLUE = "\u001b[34;1m";
+    /** Foreground bold magenta. */
+    public static final String BOLD_MAGENTA = "\u001b[35;1m";
+    /** Foreground bold cyan. */
+    public static final String BOLD_CYAN = "\u001b[36;1m";
+    /** Foreground bold white. */
+    public static final String BOLD_WHITE = "\u001b[37;1m";
+
+    /** Background black. */
+    public static final String BG_BLACK = "\u001b[40m";
+    /** Background red. */
+    public static final String BG_RED = "\u001b[41m";
+    /** Background green. */
+    public static final String BG_GREEN = "\u001b[42m";
+    /** Background yellow. */
+    public static final String BG_YELLOW = "\u001b[43m";
+    /** Background blue. */
+    public static final String BG_BLUE = "\u001b[44m";
+    /** Background magenta. */
+    public static final String BG_MAGENTA = "\u001b[45m";
+    /** Background cyan. */
+    public static final String BG_CYAN = "\u001b[46m";
+    /** Background white. */
+    public static final String BG_WHITE = "\u001b[47m";
+
+    /** Reset. */
+    public static final String RESET = "\u001b[0m";
+    /** Underline. */
+    public static final String UNDERLINED = "\u001b[4m";
+
+    AnsiTerminalDecorator(MxRunListener l) {
+        super(l);
+    }
+
+    @Override
+    public void testSucceeded(Description description) {
+        getWriter().print(GREEN);
+        super.testSucceeded(description);
+        getWriter().print(RESET);
+    }
+
+    @Override
+    public void testAssumptionFailure(Failure failure) {
+        getWriter().print(BLUE);
+        super.testAssumptionFailure(failure);
+        getWriter().print(RESET);
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        getWriter().print(RED);
+        super.testFailed(failure);
+        getWriter().print(RESET);
+    }
+
+    @Override
+    public void testIgnored(Description description) {
+        getWriter().print(MAGENTA);
+        super.testIgnored(description);
+        getWriter().print(RESET);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/EagerStackTraceDecorator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import org.junit.runner.notification.*;
+
+class EagerStackTraceDecorator extends MxRunListenerDecorator {
+
+    EagerStackTraceDecorator(MxRunListener l) {
+        super(l);
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        super.testFailed(failure);
+        getWriter().println();
+        getWriter().println(failure.getTestHeader());
+        getWriter().print(failure.getTrace());
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/FindClassesByAnnotatedMethods.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,341 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+
+/**
+ * Finds classes in given jar files that contain methods annotated by a given set of annotations.
+ */
+public class FindClassesByAnnotatedMethods {
+
+    /**
+     * Finds classes in a given set of jar files that contain at least one method with an annotation
+     * from a given set of annotations. The qualified name and containing jar file (separated by a
+     * space) is written to {@link System#out} for each matching class.
+     *
+     * @param args jar file names, annotations and snippets patterns. Annotations are those starting
+     *            with "@" and can be either qualified or unqualified annotation class names,
+     *            snippets patterns are those starting with {@code "snippetsPattern:"} and the rest
+     *            are jar file names
+     */
+    public static void main(String... args) throws Throwable {
+        Set<String> qualifiedAnnotations = new HashSet<>();
+        Set<String> unqualifiedAnnotations = new HashSet<>();
+        for (String arg : args) {
+            if (isAnnotationArg(arg)) {
+                String annotation = arg.substring(1);
+                int lastDot = annotation.lastIndexOf('.');
+                if (lastDot != -1) {
+                    qualifiedAnnotations.add(annotation);
+                } else {
+                    String unqualifed = annotation.substring(lastDot + 1);
+                    unqualifiedAnnotations.add(unqualifed);
+                }
+            }
+        }
+
+        for (String jarFilePath : args) {
+            if (isSnippetArg(jarFilePath) || isAnnotationArg(jarFilePath)) {
+                continue;
+            }
+            JarFile jarFile = new JarFile(jarFilePath);
+            Enumeration<JarEntry> e = jarFile.entries();
+            int unsupportedClasses = 0;
+            System.out.print(jarFilePath);
+            while (e.hasMoreElements()) {
+                JarEntry je = e.nextElement();
+                if (je.isDirectory() || !je.getName().endsWith(".class")) {
+                    continue;
+                }
+                Set<String> methodAnnotationTypes = new HashSet<>();
+                DataInputStream stream = new DataInputStream(new BufferedInputStream(jarFile.getInputStream(je), (int) je.getSize()));
+                boolean isSupported = true;
+                try {
+                    readClassfile(stream, methodAnnotationTypes);
+                } catch (UnsupportedClassVersionError ucve) {
+                    isSupported = false;
+                    unsupportedClasses++;
+                }
+                String className = je.getName().substring(0, je.getName().length() - ".class".length()).replaceAll("/", ".");
+                if (!isSupported) {
+                    System.out.print(" !" + className);
+                }
+                for (String annotationType : methodAnnotationTypes) {
+                    if (!qualifiedAnnotations.isEmpty()) {
+                        if (qualifiedAnnotations.contains(annotationType)) {
+                            System.out.print(" " + className);
+                        }
+                    }
+                    if (!unqualifiedAnnotations.isEmpty()) {
+                        final int lastDot = annotationType.lastIndexOf('.');
+                        if (lastDot != -1) {
+                            String simpleName = annotationType.substring(lastDot + 1);
+                            int lastDollar = simpleName.lastIndexOf('$');
+                            if (lastDollar != -1) {
+                                simpleName = simpleName.substring(lastDollar + 1);
+                            }
+                            if (unqualifiedAnnotations.contains(simpleName)) {
+                                System.out.print(" " + className);
+                            }
+                        }
+                    }
+                }
+            }
+            if (unsupportedClasses != 0) {
+                System.err.printf("Warning: %d classes in %s skipped as their class file version is not supported by %s%n", unsupportedClasses, jarFilePath,
+                                FindClassesByAnnotatedMethods.class.getSimpleName());
+            }
+            System.out.println();
+        }
+    }
+
+    private static boolean isAnnotationArg(String arg) {
+        return arg.charAt(0) == '@';
+    }
+
+    private static boolean isSnippetArg(String arg) {
+        return arg.startsWith("snippetsPattern:");
+    }
+
+    /*
+     * Small bytecode parser that extract annotations.
+     */
+    private static final int MAJOR_VERSION_JAVA7 = 51;
+    private static final int MAJOR_VERSION_OFFSET = 44;
+    private static final byte CONSTANT_Utf8 = 1;
+    private static final byte CONSTANT_Integer = 3;
+    private static final byte CONSTANT_Float = 4;
+    private static final byte CONSTANT_Long = 5;
+    private static final byte CONSTANT_Double = 6;
+    private static final byte CONSTANT_Class = 7;
+    private static final byte CONSTANT_Fieldref = 9;
+    private static final byte CONSTANT_String = 8;
+    private static final byte CONSTANT_Methodref = 10;
+    private static final byte CONSTANT_InterfaceMethodref = 11;
+    private static final byte CONSTANT_NameAndType = 12;
+    private static final byte CONSTANT_MethodHandle = 15;
+    private static final byte CONSTANT_MethodType = 16;
+    private static final byte CONSTANT_Dynamic = 17;
+    private static final byte CONSTANT_InvokeDynamic = 18;
+
+    private static void readClassfile(DataInputStream stream, Collection<String> methodAnnotationTypes) throws IOException {
+        // magic
+        int magic = stream.readInt();
+        assert magic == 0xCAFEBABE;
+
+        int minor = stream.readUnsignedShort();
+        int major = stream.readUnsignedShort();
+        if (major < MAJOR_VERSION_JAVA7) {
+            throw new UnsupportedClassVersionError("Unsupported class file version: " + major + "." + minor);
+        }
+        // Starting with JDK8, ignore a classfile that has a newer format than the current JDK.
+        String javaVersion = System.getProperties().get("java.specification.version").toString();
+        int majorJavaVersion;
+        if (javaVersion.startsWith("1.")) {
+            javaVersion = javaVersion.substring(2);
+            majorJavaVersion = Integer.parseInt(javaVersion);
+        } else {
+            majorJavaVersion = Integer.parseInt(javaVersion);
+        }
+        if (major > MAJOR_VERSION_OFFSET + majorJavaVersion) {
+            throw new UnsupportedClassVersionError("Unsupported class file version: " + major + "." + minor);
+        }
+
+        String[] cp = readConstantPool(stream, major, minor);
+
+        // access_flags, this_class, super_class
+        stream.skipBytes(6);
+
+        // interfaces
+        stream.skipBytes(stream.readUnsignedShort() * 2);
+
+        // fields
+        skipFields(stream);
+
+        // methods
+        readMethods(stream, cp, methodAnnotationTypes);
+    }
+
+    private static void skipFully(DataInputStream stream, int n) throws IOException {
+        long skipped = 0;
+        do {
+            long s = stream.skip(n - skipped);
+            skipped += s;
+            if (s == 0 && skipped != n) {
+                // Check for EOF (i.e., truncated class file)
+                if (stream.read() == -1) {
+                    throw new IOException("truncated stream");
+                }
+                skipped++;
+            }
+        } while (skipped != n);
+    }
+
+    private static String[] readConstantPool(DataInputStream stream, int major, int minor) throws IOException {
+        int count = stream.readUnsignedShort();
+        String[] cp = new String[count];
+
+        int i = 1;
+        while (i < count) {
+            byte tag = stream.readByte();
+            switch (tag) {
+                case CONSTANT_Class:
+                case CONSTANT_String:
+                case CONSTANT_MethodType: {
+                    skipFully(stream, 2);
+                    break;
+                }
+                case CONSTANT_InterfaceMethodref:
+                case CONSTANT_Methodref:
+                case CONSTANT_Fieldref:
+                case CONSTANT_NameAndType:
+                case CONSTANT_Float:
+                case CONSTANT_Integer:
+                case CONSTANT_Dynamic:
+                case CONSTANT_InvokeDynamic: {
+                    skipFully(stream, 4);
+                    break;
+                }
+                case CONSTANT_Long:
+                case CONSTANT_Double: {
+                    skipFully(stream, 8);
+                    break;
+                }
+                case CONSTANT_Utf8: {
+                    cp[i] = stream.readUTF();
+                    break;
+                }
+                case CONSTANT_MethodHandle: {
+                    skipFully(stream, 3);
+                    break;
+                }
+                default: {
+                    throw new InternalError(String.format("Invalid constant pool tag: " + tag + ". Maybe %s needs updating for changes introduced by class file version %d.%d?",
+                                    FindClassesByAnnotatedMethods.class, major, minor));
+                }
+            }
+            if ((tag == CONSTANT_Double) || (tag == CONSTANT_Long)) {
+                i += 2;
+            } else {
+                i += 1;
+            }
+        }
+        return cp;
+    }
+
+    private static void skipAttributes(DataInputStream stream) throws IOException {
+        int attributesCount;
+        attributesCount = stream.readUnsignedShort();
+        for (int i = 0; i < attributesCount; i++) {
+            stream.skipBytes(2); // name_index
+            int attributeLength = stream.readInt();
+            skipFully(stream, attributeLength);
+        }
+    }
+
+    private static void readMethodAttributes(DataInputStream stream, String[] cp, Collection<String> methodAnnotationTypes) throws IOException {
+        int attributesCount;
+        attributesCount = stream.readUnsignedShort();
+        for (int i = 0; i < attributesCount; i++) {
+            String attributeName = cp[stream.readUnsignedShort()];
+            int attributeLength = stream.readInt();
+
+            if (attributeName.equals("RuntimeVisibleAnnotations")) {
+                int numAnnotations = stream.readUnsignedShort();
+                for (int a = 0; a != numAnnotations; a++) {
+                    readAnnotation(stream, cp, methodAnnotationTypes);
+                }
+            } else {
+                skipFully(stream, attributeLength);
+            }
+        }
+    }
+
+    private static void readAnnotation(DataInputStream stream, String[] cp, Collection<String> methodAnnotationTypes) throws IOException {
+        int typeIndex = stream.readUnsignedShort();
+        int pairs = stream.readUnsignedShort();
+        String type = cp[typeIndex];
+        String className = type.substring(1, type.length() - 1).replace('/', '.');
+        methodAnnotationTypes.add(className);
+        readAnnotationElements(stream, cp, pairs, true, methodAnnotationTypes);
+    }
+
+    private static void readAnnotationElements(DataInputStream stream, String[] cp, int pairs, boolean withElementName, Collection<String> methodAnnotationTypes) throws IOException {
+        for (int p = 0; p < pairs; p++) {
+            if (withElementName) {
+                skipFully(stream, 2);
+            }
+            int tag = stream.readByte();
+            switch (tag) {
+                case 'B':
+                case 'C':
+                case 'D':
+                case 'F':
+                case 'I':
+                case 'J':
+                case 'S':
+                case 'Z':
+                case 's':
+                case 'c':
+                    skipFully(stream, 2);
+                    break;
+                case 'e':
+                    skipFully(stream, 4);
+                    break;
+                case '@':
+                    readAnnotation(stream, cp, methodAnnotationTypes);
+                    break;
+                case '[': {
+                    int numValues = stream.readUnsignedShort();
+                    readAnnotationElements(stream, cp, numValues, false, methodAnnotationTypes);
+                    break;
+                }
+            }
+        }
+    }
+
+    private static void skipFields(DataInputStream stream) throws IOException {
+        int count = stream.readUnsignedShort();
+        for (int i = 0; i < count; i++) {
+            stream.skipBytes(6); // access_flags, name_index, descriptor_index
+            skipAttributes(stream);
+        }
+    }
+
+    private static void readMethods(DataInputStream stream, String[] cp, Collection<String> methodAnnotationTypes) throws IOException {
+        int count = stream.readUnsignedShort();
+        for (int i = 0; i < count; i++) {
+            skipFully(stream, 6); // access_flags, name_index, descriptor_index
+            readMethodAttributes(stream, cp, methodAnnotationTypes);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/GCAfterTestDecorator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import org.junit.runner.*;
+
+class GCAfterTestDecorator extends MxRunListenerDecorator {
+
+    GCAfterTestDecorator(MxRunListener l) {
+        super(l);
+    }
+
+    @Override
+    public void testFinished(Description description) {
+        System.gc();
+        super.testFinished(description);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/JLModule.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Set;
+
+/**
+ * Facade for the {@code java.lang.Module} class introduced in JDK9 that allows tests to be
+ * developed against JDK8 but use module logic if deployed on JDK9.
+ */
+class JLModule {
+
+    private final Object realModule;
+
+    JLModule(Object module) {
+        this.realModule = module;
+    }
+
+    private static final Class<?> moduleClass;
+    private static final Class<?> layerClass;
+
+    private static final Method bootMethod;
+    private static final Method modulesMethod;
+    private static final Method getModuleMethod;
+    private static final Method getUnnamedModuleMethod;
+    private static final Method getNameMethod;
+    private static final Method getPackagesMethod;
+    private static final Method isExportedMethod;
+    private static final Method isExported2Method;
+    private static final Method addExportsMethod;
+    private static final Method addOpensMethod;
+    static {
+        try {
+            moduleClass = findModuleClass();
+            Class<?> modulesClass = Class.forName("jdk.internal.module.Modules");
+            layerClass = findModuleLayerClass();
+            bootMethod = layerClass.getMethod("boot");
+            modulesMethod = layerClass.getMethod("modules");
+            getModuleMethod = Class.class.getMethod("getModule");
+            getUnnamedModuleMethod = ClassLoader.class.getMethod("getUnnamedModule");
+            getNameMethod = moduleClass.getMethod("getName");
+            getPackagesMethod = moduleClass.getMethod("getPackages");
+            isExportedMethod = moduleClass.getMethod("isExported", String.class);
+            isExported2Method = moduleClass.getMethod("isExported", String.class, moduleClass);
+            addExportsMethod = modulesClass.getDeclaredMethod("addExports", moduleClass, String.class, moduleClass);
+            addOpensMethod = getDeclaredMethodOptional(modulesClass, "addOpens", moduleClass, String.class, moduleClass);
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    // API change http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/afedee84773e.
+    protected static Class<?> findModuleClass() throws ClassNotFoundException {
+        try {
+            return Class.forName("java.lang.Module");
+        } catch (ClassNotFoundException e) {
+            return Class.forName("java.lang.reflect.Module");
+        }
+    }
+
+    // API change http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/afedee84773e.
+    protected static Class<?> findModuleLayerClass() throws ClassNotFoundException {
+        try {
+            return Class.forName("java.lang.ModuleLayer");
+        } catch (ClassNotFoundException e) {
+            return Class.forName("java.lang.reflect.Layer");
+        }
+    }
+
+    private static Method getDeclaredMethodOptional(Class<?> declaringClass, String name, Class<?>... parameterTypes) {
+        try {
+            return declaringClass.getDeclaredMethod(name, parameterTypes);
+        } catch (NoSuchMethodException e) {
+            return null;
+        }
+    }
+
+    public static JLModule fromClass(Class<?> cls) {
+        try {
+            return new JLModule(getModuleMethod.invoke(cls));
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public static JLModule find(String name) {
+        try {
+            Object bootLayer = bootMethod.invoke(null);
+            Set<Object> modules = (Set<Object>) modulesMethod.invoke(bootLayer);
+            for (Object m : modules) {
+                JLModule module = new JLModule(m);
+                String mname = module.getName();
+                if (mname.equals(name)) {
+                    return module;
+                }
+            }
+        } catch (Exception e) {
+            throw new InternalError(e);
+        }
+        return null;
+    }
+
+    public static JLModule getUnnamedModuleFor(ClassLoader cl) {
+        try {
+            return new JLModule(getUnnamedModuleMethod.invoke(cl));
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    public String getName() {
+        try {
+            return (String) getNameMethod.invoke(realModule);
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    /**
+     * Exports all packages in this module to a given module.
+     */
+    public void exportAllPackagesTo(JLModule module) {
+        if (this != module) {
+            for (String pkg : getPackages()) {
+                // Export all JVMCI packages dynamically instead
+                // of requiring a long list of -XaddExports
+                // options on the JVM command line.
+                if (!isExported(pkg, module)) {
+                    addExports(pkg, module);
+                    addOpens(pkg, module);
+                }
+            }
+        }
+    }
+
+    @SuppressWarnings("unchecked")
+    public Iterable<String> getPackages() {
+        try {
+            // API change http://hg.openjdk.java.net/jdk9/dev/hotspot/rev/afedee84773e#l1.15
+            Object res = getPackagesMethod.invoke(realModule);
+            if (res instanceof String[]) {
+                return Arrays.asList((String[]) res);
+            }
+            return (Set<String>) res;
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    public boolean isExported(String pn) {
+        try {
+            return (Boolean) isExportedMethod.invoke(realModule, pn);
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    public boolean isExported(String pn, JLModule other) {
+        try {
+            return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    public void addExports(String pn, JLModule other) {
+        try {
+            addExportsMethod.invoke(null, realModule, pn, other.realModule);
+        } catch (Exception e) {
+            throw new AssertionError(e);
+        }
+    }
+
+    public void addOpens(String pn, JLModule other) {
+        if (addOpensMethod != null) {
+            try {
+                addOpensMethod.invoke(null, realModule, pn, other.realModule);
+            } catch (Exception e) {
+                throw new AssertionError(e);
+            }
+        }
+    }
+
+    @Override
+    public String toString() {
+        return realModule.toString();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxJUnitRequest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
+import org.junit.runner.Description;
+import org.junit.runner.Request;
+import org.junit.runner.notification.Failure;
+
+public final class MxJUnitRequest {
+
+    private final Request request;
+
+    final Set<Class<?>> classes;
+    final String methodName;
+
+    final List<Failure> missingClasses;
+
+    private MxJUnitRequest(Request request, Set<Class<?>> classes, String methodName, List<Failure> missingClasses) {
+        this.request = request;
+        this.classes = classes;
+        this.methodName = methodName;
+        this.missingClasses = missingClasses;
+    }
+
+    public Request getRequest() {
+        return request;
+    }
+
+    public static final class BuilderException extends Exception {
+
+        private static final long serialVersionUID = 1L;
+
+        private BuilderException(String msg) {
+            super(msg);
+        }
+    }
+
+    public static class Builder {
+
+        private final Set<Class<?>> classes = new LinkedHashSet<>();
+        private String methodName = null;
+        private final List<Failure> missingClasses = new ArrayList<>();
+
+        protected Class<?> resolveClass(String name) throws ClassNotFoundException {
+            return Class.forName(name, false, Builder.class.getClassLoader());
+        }
+
+        public void addTestSpec(String arg) throws BuilderException {
+            String className;
+            /*
+             * Entries of the form class#method are handled specially. Only one can be specified on
+             * the command line as there's no obvious way to build a runner for multiple ones.
+             */
+            if (methodName != null) {
+                throw new BuilderException("Only a single class and method can be specified: " + arg);
+            } else if (arg.contains("#")) {
+                String[] pair = arg.split("#");
+                if (pair.length != 2) {
+                    throw new BuilderException("Malformed class and method request: " + arg);
+                } else if (!classes.isEmpty()) {
+                    throw new BuilderException("Only a single class and method can be specified: " + arg);
+                } else {
+                    methodName = pair[1];
+                    className = pair[0];
+                }
+            } else {
+                className = arg;
+            }
+            try {
+                Class<?> cls = resolveClass(className);
+                if ((cls.getModifiers() & Modifier.ABSTRACT) == 0) {
+                    classes.add(cls);
+                }
+            } catch (ClassNotFoundException e) {
+                Description description = Description.createSuiteDescription(className);
+                Failure failure = new Failure(description, e);
+                missingClasses.add(failure);
+            }
+        }
+
+        public MxJUnitRequest build() {
+            Request request;
+            if (methodName == null) {
+                request = Request.classes(classes.toArray(new Class<?>[0]));
+            } else {
+                request = Request.method(classes.iterator().next(), methodName);
+            }
+            return new MxJUnitRequest(request, classes, methodName, missingClasses);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxJUnitWrapper.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,484 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.ServiceLoader;
+import java.util.Set;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.junit.internal.JUnitSystem;
+import org.junit.internal.RealSystem;
+import org.junit.runner.Description;
+import org.junit.runner.JUnitCore;
+import org.junit.runner.Request;
+import org.junit.runner.Result;
+import org.junit.runner.Runner;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+import org.junit.runner.notification.RunNotifier;
+import org.junit.runners.ParentRunner;
+import org.junit.runners.model.RunnerScheduler;
+
+import junit.runner.Version;
+
+public class MxJUnitWrapper {
+
+    public static class MxJUnitConfig {
+
+        public boolean verbose = false;
+        public boolean veryVerbose = false;
+        public boolean enableTiming = false;
+        public boolean failFast = false;
+        public boolean color = false;
+        public boolean eagerStackTrace = false;
+        public boolean gcAfterTest = false;
+        public boolean recordResults = false;
+        public int repeatCount = 1;
+    }
+
+    private static class RepeatingRunner extends Runner {
+
+        private final Runner parent;
+        private int repeat;
+
+        RepeatingRunner(Runner parent, int repeat) {
+            this.parent = parent;
+            this.repeat = repeat;
+        }
+
+        @Override
+        public Description getDescription() {
+            return parent.getDescription();
+        }
+
+        @Override
+        public void run(RunNotifier notifier) {
+            for (int i = 0; i < repeat; i++) {
+                parent.run(notifier);
+            }
+        }
+
+        @Override
+        public int testCount() {
+            return super.testCount() * repeat;
+        }
+    }
+
+    private static class RepeatingRequest extends Request {
+
+        private final Request request;
+        private final int repeat;
+
+        RepeatingRequest(Request request, int repeat) {
+            this.request = request;
+            this.repeat = repeat;
+        }
+
+        @Override
+        public Runner getRunner() {
+            return new RepeatingRunner(request.getRunner(), repeat);
+        }
+    }
+
+    /**
+     * Run the tests contained in the classes named in the <code>args</code>. A single test method
+     * can be specified by adding #method after the class name. Only a single test can be run in
+     * this way. If all tests run successfully, exit with a status of 0. Otherwise exit with a
+     * status of 1. Write feedback while tests are running and write stack traces for all failed
+     * tests after the tests all complete.
+     *
+     * @param args names of classes in which to find tests to run
+     */
+    public static void main(String... args) {
+        JUnitSystem system = new RealSystem();
+        JUnitCore junitCore = new JUnitCore();
+        system.out().println("MxJUnitCore");
+        system.out().println("JUnit version " + Version.id());
+
+        MxJUnitRequest.Builder builder = new MxJUnitRequest.Builder();
+        MxJUnitConfig config = new MxJUnitConfig();
+
+        String[] expandedArgs = expandArgs(args);
+        int i = 0;
+        while (i < expandedArgs.length) {
+            String each = expandedArgs[i];
+            if (each.charAt(0) == '-') {
+                // command line arguments
+                if (each.contentEquals("-JUnitVerbose")) {
+                    config.verbose = true;
+                } else if (each.contentEquals("-JUnitVeryVerbose")) {
+                    config.veryVerbose = true;
+                } else if (each.contentEquals("-JUnitFailFast")) {
+                    config.failFast = true;
+                } else if (each.contentEquals("-JUnitEnableTiming")) {
+                    config.enableTiming = true;
+                } else if (each.contentEquals("-JUnitColor")) {
+                    config.color = true;
+                } else if (each.contentEquals("-JUnitEagerStackTrace")) {
+                    config.eagerStackTrace = true;
+                } else if (each.contentEquals("-JUnitGCAfterTest")) {
+                    config.gcAfterTest = true;
+                } else if (each.contentEquals("-JUnitRecordResults")) {
+                    config.recordResults = true;
+                } else if (each.contentEquals("-JUnitRepeat")) {
+                    if (i + 1 >= expandedArgs.length) {
+                        system.out().println("Must include argument for -JUnitRepeat");
+                        System.exit(1);
+                    }
+                    try {
+                        config.repeatCount = Integer.parseInt(expandedArgs[++i]);
+                    } catch (NumberFormatException e) {
+                        system.out().println("Expected integer argument for -JUnitRepeat. Found: " + expandedArgs[i]);
+                        System.exit(1);
+                    }
+                } else {
+                    system.out().println("Unknown command line argument: " + each);
+                }
+
+            } else {
+
+                try {
+                    builder.addTestSpec(each);
+                } catch (MxJUnitRequest.BuilderException ex) {
+                    system.out().println(ex.getMessage());
+                    System.exit(1);
+                }
+            }
+            i++;
+        }
+
+        MxJUnitRequest request = builder.build();
+
+        if (System.getProperty("java.specification.version").compareTo("1.9") >= 0) {
+            addExports(request.classes, system.out());
+        }
+
+        for (RunListener p : ServiceLoader.load(RunListener.class)) {
+            junitCore.addListener(p);
+        }
+
+        Result result = runRequest(junitCore, system, config, request);
+        System.exit(result.wasSuccessful() ? 0 : 1);
+    }
+
+    private static PrintStream openFile(JUnitSystem system, String name) {
+        File file = new File(name).getAbsoluteFile();
+        try {
+            FileOutputStream fos = new FileOutputStream(file);
+            return new PrintStream(fos, true);
+        } catch (FileNotFoundException e) {
+            system.out().println("Could not open " + file + " for writing: " + e);
+            System.exit(1);
+            return null;
+        }
+    }
+
+    public static Result runRequest(JUnitCore junitCore, JUnitSystem system, MxJUnitConfig config, MxJUnitRequest mxRequest) {
+        final TextRunListener textListener;
+        if (config.veryVerbose) {
+            textListener = new VerboseTextListener(system, mxRequest.classes.size(), VerboseTextListener.SHOW_ALL_TESTS);
+        } else if (config.verbose) {
+            textListener = new VerboseTextListener(system, mxRequest.classes.size());
+        } else {
+            textListener = new TextRunListener(system);
+        }
+        TimingDecorator timings = config.enableTiming ? new TimingDecorator(textListener) : null;
+        MxRunListener mxListener = config.enableTiming ? timings : textListener;
+
+        if (config.color) {
+            mxListener = new AnsiTerminalDecorator(mxListener);
+        }
+        if (config.eagerStackTrace) {
+            mxListener = new EagerStackTraceDecorator(mxListener);
+        }
+        if (config.gcAfterTest) {
+            mxListener = new GCAfterTestDecorator(mxListener);
+        }
+        if (config.recordResults) {
+            PrintStream passed = openFile(system, "passed.txt");
+            PrintStream failed = openFile(system, "failed.txt");
+            mxListener = new TestResultLoggerDecorator(passed, failed, mxListener);
+        }
+
+        junitCore.addListener(TextRunListener.createRunListener(mxListener));
+
+        Request request = mxRequest.getRequest();
+        if (mxRequest.methodName == null) {
+            if (config.failFast) {
+                Runner runner = request.getRunner();
+                if (runner instanceof ParentRunner) {
+                    ParentRunner<?> parentRunner = (ParentRunner<?>) runner;
+                    parentRunner.setScheduler(new RunnerScheduler() {
+                        public void schedule(Runnable childStatement) {
+                            if (textListener.getLastFailure() == null) {
+                                childStatement.run();
+                            }
+                        }
+
+                        public void finished() {
+                        }
+                    });
+                } else {
+                    system.out().println("Unexpected Runner subclass " + runner.getClass().getName() + " - fail fast not supported");
+                }
+            }
+        } else {
+            if (config.failFast) {
+                system.out().println("Single method selected - fail fast not supported");
+            }
+        }
+
+        if (config.repeatCount != 1) {
+            request = new RepeatingRequest(request, config.repeatCount);
+        }
+
+        if (config.enableTiming) {
+            Runtime.getRuntime().addShutdownHook(new Thread() {
+                @Override
+                public void run() {
+                    printTimings(timings);
+                }
+            });
+        }
+
+        Result result = junitCore.run(request);
+        for (Failure each : mxRequest.missingClasses) {
+            result.getFailures().add(each);
+        }
+
+        return result;
+    }
+
+    private static final Pattern MODULE_PACKAGE_RE = Pattern.compile("([^/]+)/(.+)");
+
+    private static class Timing<T> implements Comparable<Timing<T>> {
+        final T subject;
+        final long value;
+
+        Timing(T subject, long value) {
+            this.subject = subject;
+            this.value = value;
+        }
+
+        public int compareTo(Timing<T> o) {
+            if (this.value < o.value) {
+                return -1;
+            }
+            if (this.value > o.value) {
+                return 1;
+            }
+            return 0;
+        }
+    }
+
+    // Should never need to customize so using a system property instead
+    // of a command line option for customization is fine.
+    private static final int TIMINGS_TO_PRINT = Integer.getInteger("mx.junit.timings_to_print", 10);
+
+    private static void printTimings(TimingDecorator timings) {
+        if (TIMINGS_TO_PRINT != 0) {
+            List<Timing<Class<?>>> classTimes = new ArrayList<>(timings.classTimes.size());
+            List<Timing<Description>> testTimes = new ArrayList<>(timings.testTimes.size());
+            for (Map.Entry<Class<?>, Long> e : timings.classTimes.entrySet()) {
+                classTimes.add(new Timing<>(e.getKey(), e.getValue()));
+            }
+            for (Map.Entry<Description, Long> e : timings.testTimes.entrySet()) {
+                testTimes.add(new Timing<>(e.getKey(), e.getValue()));
+            }
+            classTimes.sort(Collections.reverseOrder());
+            testTimes.sort(Collections.reverseOrder());
+
+            System.out.println();
+            System.out.printf("%d longest running test classes:%n", TIMINGS_TO_PRINT);
+            for (int i = 0; i < TIMINGS_TO_PRINT && i < classTimes.size(); i++) {
+                Timing<Class<?>> timing = classTimes.get(i);
+                System.out.printf(" %,10d ms    %s%n", timing.value, timing.subject.getName());
+            }
+            System.out.printf("%d longest running tests:%n", TIMINGS_TO_PRINT);
+            for (int i = 0; i < TIMINGS_TO_PRINT && i < testTimes.size(); i++) {
+                Timing<Description> timing = testTimes.get(i);
+                System.out.printf(" %,10d ms    %s%n", timing.value, timing.subject);
+            }
+            Object[] current = timings.getCurrentTestDuration();
+            if (current != null) {
+                System.out.printf("Test %s not finished after %d ms%n", current[0], current[1]);
+            }
+
+        }
+    }
+
+    /**
+     * Adds the super types of {@code cls} to {@code supertypes}.
+     */
+    private static void gatherSupertypes(Class<?> cls, Set<Class<?>> supertypes) {
+        if (!supertypes.contains(cls)) {
+            supertypes.add(cls);
+            Class<?> superclass = cls.getSuperclass();
+            if (superclass != null) {
+                gatherSupertypes(superclass, supertypes);
+            }
+            for (Class<?> iface : cls.getInterfaces()) {
+                gatherSupertypes(iface, supertypes);
+            }
+        }
+    }
+
+    /**
+     * Updates modules specified in {@code AddExport} annotations on {@code classes} to export
+     * concealed packages to the annotation classes' declaring modules.
+     */
+    private static void addExports(Set<Class<?>> classes, PrintStream out) {
+        Set<Class<?>> types = new HashSet<>();
+        for (Class<?> cls : classes) {
+            gatherSupertypes(cls, types);
+        }
+        for (Class<?> cls : types) {
+            Annotation[] annos = cls.getAnnotations();
+            for (Annotation a : annos) {
+                Class<? extends Annotation> annotationType = a.annotationType();
+                if (annotationType.getSimpleName().equals("AddExports")) {
+                    Optional<String[]> value = getElement("value", String[].class, a);
+                    if (value.isPresent()) {
+                        for (String export : value.get()) {
+                            Matcher m = MODULE_PACKAGE_RE.matcher(export);
+                            if (m.matches()) {
+                                String moduleName = m.group(1);
+                                String packageName = m.group(2);
+                                JLModule module = JLModule.find(moduleName);
+                                if (module == null) {
+                                    out.printf("%s: Cannot find module named %s specified in \"AddExports\" annotation: %s%n", cls.getName(), moduleName, a);
+                                } else {
+                                    if (packageName.equals("*")) {
+                                        module.exportAllPackagesTo(JLModule.fromClass(cls));
+                                    } else {
+                                        module.addExports(packageName, JLModule.fromClass(cls));
+                                        module.addOpens(packageName, JLModule.fromClass(cls));
+                                    }
+                                }
+                            } else {
+                                out.printf("%s: Ignoring \"AddExports\" annotation with value not matching <module>/<package> pattern: %s%n", cls.getName(), a);
+                            }
+                        }
+                    } else {
+                        out.printf("%s: Ignoring \"AddExports\" annotation without `String value` element: %s%n", cls.getName(), a);
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Gets the value of the element named {@code name} of type {@code type} from {@code annotation}
+     * if present.
+     *
+     * @return the requested element value wrapped in an {@link Optional} or
+     *         {@link Optional#empty()} if {@code annotation} has no element named {@code name}
+     * @throws AssertionError if {@code annotation} has an element of the given name but whose type
+     *             is not {@code type} or if there's some problem reading the value via reflection
+     */
+    private static <T> Optional<T> getElement(String name, Class<T> type, Annotation annotation) {
+        Class<? extends Annotation> annotationType = annotation.annotationType();
+        Method valueAccessor;
+        try {
+            valueAccessor = annotationType.getMethod(name);
+            if (!valueAccessor.getReturnType().equals(type)) {
+                throw new AssertionError(String.format("Element %s of %s is of type %s, not %s ", name, annotationType.getName(), valueAccessor.getReturnType().getName(), type.getName()));
+            }
+        } catch (NoSuchMethodException e) {
+            return Optional.empty();
+        }
+        try {
+            return Optional.of(type.cast(valueAccessor.invoke(annotation)));
+        } catch (Exception e) {
+            throw new AssertionError(String.format("Could not read %s element from %s", name, annotation), e);
+        }
+    }
+
+    /**
+     * Expand any arguments starting with @ and return the resulting argument array.
+     *
+     * @return the expanded argument array
+     */
+    private static String[] expandArgs(String[] args) {
+        List<String> result = null;
+        for (int i = 0; i < args.length; i++) {
+            String arg = args[i];
+            if (arg.length() > 0 && arg.charAt(0) == '@') {
+                if (result == null) {
+                    result = new ArrayList<>();
+                    for (int j = 0; j < i; j++) {
+                        result.add(args[j]);
+                    }
+                    expandArg(arg.substring(1), result);
+                }
+            } else if (result != null) {
+                result.add(arg);
+            }
+        }
+        return result != null ? result.toArray(new String[0]) : args;
+    }
+
+    /**
+     * Add each line from {@code filename} to the list {@code args}.
+     */
+    private static void expandArg(String filename, List<String> args) {
+        BufferedReader br = null;
+        try {
+            br = new BufferedReader(new FileReader(filename));
+
+            String buf;
+            while ((buf = br.readLine()) != null) {
+                args.add(buf);
+            }
+            br.close();
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+            System.exit(2);
+        } finally {
+            try {
+                if (br != null) {
+                    br.close();
+                }
+            } catch (IOException ioe) {
+                ioe.printStackTrace();
+                System.exit(3);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxRunListener.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+interface MxRunListener {
+
+    /**
+     * Called before any tests have been run.
+     *
+     * @param description describes the tests to be run
+     */
+    default void testRunStarted(Description description) {
+    }
+
+    /**
+     * Called when all tests have finished.
+     *
+     * @param result the summary of the test run, including all the tests that failed
+     */
+    default void testRunFinished(Result result) {
+    }
+
+    /**
+     * Called when a test class is about to be started.
+     *
+     * @param clazz the test class
+     */
+    default void testClassStarted(Class<?> clazz) {
+    }
+
+    /**
+     * Called when all tests of a test class have finished.
+     *
+     * @param clazz the test class
+     * @param numPassed number of tests in {@code clazz} that passed
+     * @param numFailed number of tests in {@code clazz} that failed
+     */
+    default void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+    }
+
+    /**
+     * Called when an atomic test is about to be started. This is also called for ignored tests.
+     *
+     * @param description the description of the test that is about to be run (generally a class and
+     *            method name)
+     */
+    default void testStarted(Description description) {
+    }
+
+    /**
+     * Called when an atomic test has finished, whether the test succeeds, fails or is ignored.
+     *
+     * @param description the description of the test that just ran
+     */
+    default void testFinished(Description description) {
+    }
+
+    /**
+     * Called when an atomic test fails.
+     *
+     * @param failure describes the test that failed and the exception that was thrown
+     */
+    default void testFailed(Failure failure) {
+    }
+
+    /**
+     * Called when a test will not be run, generally because a test method is annotated with
+     * {@link org.junit.Ignore}.
+     *
+     * @param description describes the test that will not be run
+     */
+    default void testIgnored(Description description) {
+    }
+
+    /**
+     * Called when an atomic test succeeds.
+     *
+     * @param description describes the test that will not be run
+     */
+    default void testSucceeded(Description description) {
+    }
+
+    /**
+     * Called when an atomic test flags that it assumes a condition that is false.
+     *
+     * @param failure describes the test that failed and the {@link AssumptionViolatedException}
+     *            that was thrown
+     */
+    default void testAssumptionFailure(Failure failure) {
+    }
+
+    /**
+     * Called after {@link #testClassFinished(Class, int, int)}.
+     */
+    default void testClassFinishedDelimiter() {
+    }
+
+    /**
+     * Called after {@link #testClassStarted(Class)}.
+     */
+    default void testClassStartedDelimiter() {
+    }
+
+    /**
+     * Called after {@link #testStarted(Description)}.
+     */
+    default void testStartedDelimiter() {
+    }
+
+    /**
+     * Called after {@link #testFailed(Failure)}.
+     */
+    default void testFinishedDelimiter() {
+    }
+
+    default boolean beVerbose() {
+        return false;
+    }
+
+    PrintStream getWriter();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/MxRunListenerDecorator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.*;
+
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+abstract class MxRunListenerDecorator implements MxRunListener {
+
+    private final MxRunListener l;
+
+    MxRunListenerDecorator(MxRunListener l) {
+        this.l = l;
+    }
+
+    @Override
+    public void testRunStarted(Description description) {
+        l.testRunStarted(description);
+    }
+
+    @Override
+    public void testRunFinished(Result result) {
+        l.testRunFinished(result);
+    }
+
+    @Override
+    public void testAssumptionFailure(Failure failure) {
+        l.testAssumptionFailure(failure);
+    }
+
+    @Override
+    public void testIgnored(Description description) {
+        l.testIgnored(description);
+    }
+
+    @Override
+    public void testClassStarted(Class<?> clazz) {
+        l.testClassStarted(clazz);
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+        l.testClassFinished(clazz, numPassed, numFailed);
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        l.testStarted(description);
+    }
+
+    @Override
+    public void testFinished(Description description) {
+        l.testFinished(description);
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        l.testFailed(failure);
+    }
+
+    @Override
+    public void testSucceeded(Description description) {
+        l.testSucceeded(description);
+    }
+
+    @Override
+    public PrintStream getWriter() {
+        return l.getWriter();
+    }
+
+    public void testClassFinishedDelimiter() {
+        l.testClassFinishedDelimiter();
+    }
+
+    public void testClassStartedDelimiter() {
+        l.testClassStartedDelimiter();
+    }
+
+    public void testStartedDelimiter() {
+        l.testStartedDelimiter();
+    }
+
+    public void testFinishedDelimiter() {
+        l.testFinishedDelimiter();
+    }
+
+    public boolean beVerbose() {
+        return l.beVerbose();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/TestResultLoggerDecorator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.PrintStream;
+
+import org.junit.runner.Result;
+
+class TestResultLoggerDecorator extends MxRunListenerDecorator {
+
+    private final PrintStream passed;
+    private final PrintStream failed;
+
+    TestResultLoggerDecorator(PrintStream passed, PrintStream failed, MxRunListener l) {
+        super(l);
+        this.passed = passed;
+        this.failed = failed;
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+        super.testClassFinished(clazz, numPassed, numFailed);
+        if (numFailed != 0) {
+            failed.println(clazz.getName());
+        } else {
+            passed.println(clazz.getName());
+        }
+    }
+
+    @Override
+    public void testRunFinished(Result result) {
+        super.testRunFinished(result);
+        passed.close();
+        failed.close();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/TextRunListener.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.PrintStream;
+
+import org.junit.internal.JUnitSystem;
+import org.junit.internal.TextListener;
+import org.junit.runner.Description;
+import org.junit.runner.Result;
+import org.junit.runner.notification.Failure;
+import org.junit.runner.notification.RunListener;
+
+class TextRunListener implements MxRunListener {
+
+    private final PrintStream fWriter;
+    protected Failure lastFailure;
+
+    TextRunListener(JUnitSystem system) {
+        this(system.out());
+    }
+
+    TextRunListener(PrintStream writer) {
+        fWriter = writer;
+    }
+
+    public boolean beVerbose() {
+        return false;
+    }
+
+    @Override
+    public PrintStream getWriter() {
+        return fWriter;
+    }
+
+    public Failure getLastFailure() {
+        return lastFailure;
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        getWriter().print('.');
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        getWriter().print('E');
+        lastFailure = failure;
+    }
+
+    @Override
+    public void testIgnored(Description description) {
+        getWriter().print('I');
+    }
+
+    public static RunListener createRunListener(MxRunListener l) {
+        return new TextListener(l.getWriter()) {
+            private Class<?> lastClass;
+            private int passedInLastClass;
+            private int failedInLastClass;
+            private boolean failed;
+
+            @Override
+            public void testStarted(Description description) {
+                Class<?> currentClass = description.getTestClass();
+                if (currentClass != lastClass) {
+                    if (lastClass != null) {
+                        l.testClassFinished(lastClass, passedInLastClass, failedInLastClass);
+                        l.testClassFinishedDelimiter();
+                    }
+                    lastClass = currentClass;
+                    passedInLastClass = 0;
+                    failedInLastClass = 0;
+                    l.testClassStarted(currentClass);
+                    l.testClassStartedDelimiter();
+                }
+                failed = false;
+                l.testStarted(description);
+                l.testStartedDelimiter();
+            }
+
+            @Override
+            public void testFailure(Failure failure) {
+                failed = true;
+                failedInLastClass++;
+                l.testFailed(failure);
+            }
+
+            @Override
+            public void testFinished(Description description) {
+                // we have to do this because there is no callback for successful tests
+                if (!failed) {
+                    l.testSucceeded(description);
+                    passedInLastClass++;
+                }
+                l.testFinished(description);
+                l.testFinishedDelimiter();
+            }
+
+            @Override
+            public void testIgnored(Description description) {
+                testStarted(description);
+                l.testIgnored(description);
+                l.testFinished(description);
+                l.testFinishedDelimiter();
+            }
+
+            @Override
+            public void testRunStarted(Description description) {
+                l.testRunStarted(description);
+            }
+
+            @Override
+            public void testRunFinished(Result result) {
+                if (lastClass != null) {
+                    l.testClassFinished(lastClass, passedInLastClass, failedInLastClass);
+                }
+                l.testRunFinished(result);
+                super.testRunFinished(result);
+            }
+
+            @Override
+            public void testAssumptionFailure(Failure failure) {
+                l.testAssumptionFailure(failure);
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/TimingDecorator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.junit.runner.Description;
+
+/**
+ * Timing support for JUnit test runs.
+ */
+class TimingDecorator extends MxRunListenerDecorator {
+
+    private long startTime;
+    private long classStartTime;
+    private Description currentTest;
+    final Map<Class<?>, Long> classTimes;
+    final Map<Description, Long> testTimes;
+
+    TimingDecorator(MxRunListener l) {
+        super(l);
+        this.classTimes = new HashMap<>();
+        this.testTimes = new HashMap<>();
+    }
+
+    @Override
+    public void testClassStarted(Class<?> clazz) {
+        classStartTime = System.nanoTime();
+        super.testClassStarted(clazz);
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+        long totalTime = System.nanoTime() - classStartTime;
+        super.testClassFinished(clazz, numPassed, numFailed);
+        if (beVerbose()) {
+            getWriter().print(' ' + valueToString(totalTime));
+        }
+        classTimes.put(clazz, totalTime / 1_000_000);
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        currentTest = description;
+        startTime = System.nanoTime();
+        super.testStarted(description);
+    }
+
+    @Override
+    public void testFinished(Description description) {
+        long totalTime = System.nanoTime() - startTime;
+        super.testFinished(description);
+        if (beVerbose()) {
+            getWriter().print(" " + valueToString(totalTime));
+        }
+        currentTest = null;
+        testTimes.put(description, totalTime / 1_000_000);
+    }
+
+    private static String valueToString(long valueNS) {
+        long timeWholeMS = valueNS / 1_000_000;
+        long timeFractionMS = (valueNS / 100_000) % 10;
+        return String.format("%d.%d ms", timeWholeMS, timeFractionMS);
+    }
+
+    /**
+     * Gets the test currently starting but not yet completed along with the number of milliseconds
+     * it has been executing.
+     *
+     * @return {@code null} if there is no test currently executing
+     */
+    public Object[] getCurrentTestDuration() {
+        Description current = currentTest;
+        if (current != null) {
+            long timeMS = (System.nanoTime() - startTime) / 1_000_000;
+            return new Object[]{current, timeMS};
+        }
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/com.oracle.mxtool.junit/com/oracle/mxtool/junit/VerboseTextListener.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.oracle.mxtool.junit;
+
+import java.io.*;
+
+import org.junit.internal.*;
+import org.junit.runner.*;
+import org.junit.runner.notification.*;
+
+class VerboseTextListener extends TextRunListener {
+
+    private static final int DEFAULT_MAX_TEST_PER_CLASS = 50;
+    public static final int SHOW_ALL_TESTS = Integer.MAX_VALUE;
+    private final int classesCount;
+    private final int maxTestsPerClass;
+    private int currentClassNum;
+    private int currentTestNum;
+
+    VerboseTextListener(JUnitSystem system, int classesCount) {
+        this(system.out(), classesCount, DEFAULT_MAX_TEST_PER_CLASS);
+    }
+
+    VerboseTextListener(JUnitSystem system, int classesCount, int maxTests) {
+        this(system.out(), classesCount, maxTests);
+    }
+
+    VerboseTextListener(PrintStream writer, int classesCount, int maxTests) {
+        super(writer);
+        maxTestsPerClass = maxTests;
+        this.classesCount = classesCount;
+    }
+
+    @Override
+    public boolean beVerbose() {
+        return currentTestNum < maxTestsPerClass;
+    }
+
+    @Override
+    public void testClassStarted(Class<?> clazz) {
+        ++currentClassNum;
+        getWriter().printf("%s started (%d of %d)", clazz.getName(), currentClassNum, classesCount);
+        currentTestNum = 0;
+    }
+
+    @Override
+    public void testClassFinished(Class<?> clazz, int numPassed, int numFailed) {
+        getWriter().print(clazz.getName() + " finished");
+    }
+
+    @Override
+    public void testStarted(Description description) {
+        if (beVerbose()) {
+            getWriter().print("  " + description.getMethodName() + ": ");
+            currentTestNum++;
+        } else {
+            super.testStarted(description);
+        }
+    }
+
+    @Override
+    public void testIgnored(Description description) {
+        if (beVerbose()) {
+            getWriter().print("Ignored");
+        } else {
+            super.testIgnored(description);
+        }
+    }
+
+    @Override
+    public void testSucceeded(Description description) {
+        if (beVerbose()) {
+            getWriter().print("Passed");
+        } else {
+            super.testSucceeded(description);
+        }
+    }
+
+    @Override
+    public void testAssumptionFailure(Failure failure) {
+        if (beVerbose()) {
+            getWriter().printf("(%s) ", failure.getMessage());
+        } else {
+            super.testAssumptionFailure(failure);
+        }
+    }
+
+    @Override
+    public void testFailed(Failure failure) {
+        getWriter().print("FAILED");
+        lastFailure = failure;
+    }
+
+    @Override
+    public void testClassFinishedDelimiter() {
+        getWriter().println();
+    }
+
+    @Override
+    public void testClassStartedDelimiter() {
+        getWriter().println();
+    }
+
+    @Override
+    public void testFinishedDelimiter() {
+        if (beVerbose()) {
+            getWriter().println();
+        } else {
+            super.testFinishedDelimiter();
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/common/GraalUnitTestLauncher.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,266 @@
+/*
+ * 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 compiler.graalunit.common;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.*;
+import java.nio.file.*;
+import java.util.stream.Collectors;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.process.ProcessTools;
+
+/*
+ * This is helper class used to run Graal unit tests.
+ * It accepts two arguments:
+ *  -prefix TEST_PREFIX_TO_DEFINE_SET_OF_TESTS_TO_RUN (Ex: -prefix org.graalvm.compiler.api.test)
+ *  -exclude EXCLUDED_TESTS_FILE_NAME
+ */
+public class GraalUnitTestLauncher {
+
+    static final String MXTOOL_JARFILE = "com.oracle.mxtool.junit.jar";
+    static final String GRAAL_UNITTESTS_JARFILE = "jdk.vm.compiler.tests.jar";
+
+    static final String[] GRAAL_EXTRA_JARS = {"junit-4.12.jar", "asm-5.0.4.jar", "asm-tree-5.0.4.jar",
+                                              "hamcrest-core-1.3.jar", "java-allocation-instrumenter.jar"};
+
+    static final String GENERATED_TESTCLASSES_FILENAME = "list.testclasses";
+
+    // Library dir used to find Graal specific jar files.
+    static String libsDir;
+    static {
+        libsDir = System.getProperty("graalunit.libs");
+        if (libsDir == null || libsDir.isEmpty()) {
+            libsDir = System.getenv("TEST_IMAGE_GRAAL_DIR");
+        }
+
+        if (libsDir == null || libsDir.isEmpty())
+            throw new RuntimeException("ERROR: Graal library directory is not specified, use -Dgraalunit.libs or TEST_IMAGE_GRAAL_DIR environment variable.");
+
+        System.out.println("INFO: graal libs dir is '" + libsDir + "'");
+    }
+
+    /*
+     * Generates --add-exports <module>/<package>=<target-module> flags and
+     * returns them as array list.
+     *
+     * @param moduleName
+     *        Name of the module to update export data
+     *
+     * @param targetModule
+     *        Name of the module to whom to export
+     */
+    static ArrayList<String> getModuleExports(String moduleName, String targetModule) {
+        ArrayList<String> exports = new ArrayList<String>();
+
+        Optional<Module> mod = ModuleLayer.boot().findModule(moduleName);
+        Set<String> packages;
+        if (mod.isPresent()) {
+            packages = mod.get().getPackages();
+
+            for (String pName : packages) {
+                exports.add("--add-exports");
+                exports.add(moduleName + "/" + pName + "=" + targetModule);
+            }
+        }
+
+        return exports;
+    }
+
+    /*
+     * Return list of tests which match specified prefix
+     *
+     * @param testPrefix
+     *        String prefix to select tests
+     */
+    static ArrayList<String> getListOfTestsByPrefix(String testPrefix, Set<String> excludeTests) throws Exception {
+        ArrayList<String> classes = new ArrayList<String>();
+
+        final String testAnnotationName = "@Test";
+
+        // return empty list in case no selection prefix specified
+        if (testPrefix == null || testPrefix.isEmpty())
+            return classes;
+
+        // replace "." by "\." in test pattern
+        testPrefix = testPrefix.replaceAll("\\.", "\\\\.") + ".*";
+        System.out.println("INFO: use following pattern to find tests: " + testPrefix);
+
+        String graalUnitTestFilePath = String.join(File.separator, libsDir, GRAAL_UNITTESTS_JARFILE);
+        String classPath = String.join(File.pathSeparator, System.getProperty("java.class.path"),
+                String.join(File.separator, libsDir, MXTOOL_JARFILE));
+
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(false,
+                "-cp",  classPath,
+                "com.oracle.mxtool.junit.FindClassesByAnnotatedMethods", graalUnitTestFilePath, testAnnotationName);
+
+        System.out.println("INFO: run command " + String.join(" ", pb.command()));
+
+        OutputAnalyzer out = new OutputAnalyzer(pb.start());
+        int exitCode = out.getExitValue();
+        if (exitCode != 0) {
+            throw new Exception("Failed to find tests, VM crashed with exit code " + exitCode);
+        }
+
+        String[] lines = out.getStdout().split(" ");
+        if (lines.length > 1) { // first line contains jar file name
+            for (int i = 1; i < lines.length; i++) {
+                String className = lines[i];
+
+                if (testPrefix.equals(".*") || className.matches(testPrefix)) {
+                    // add the test only in case it is not in exclude list
+                    if (excludeTests!= null && excludeTests.contains(className)) {
+                        System.out.println("INFO: excluded test: " + className);
+                    } else {
+                        classes.add(className);
+                    }
+                }
+            }
+        }
+
+        return classes;
+    }
+
+    /*
+     * Return set of excluded tests
+     *
+     * @param excludeFileName
+     *        Name of the file to read excluded test list
+     */
+    static Set loadExcludeList(String excludeFileName) {
+        Set<String> excludeTests;
+
+        Path excludeFilePath = Paths.get(excludeFileName);
+        try {
+            excludeTests = Files.readAllLines(excludeFilePath).stream()
+                    .filter(l -> !l.trim().isEmpty())
+                    .filter(l -> !l.trim().startsWith("#"))
+                    .map(l -> l.split(" ")[0])
+                    .collect(Collectors.toSet());
+
+        } catch (IOException ioe) {
+            throw new Error("TESTBUG: failed to read " + excludeFilePath);
+        }
+
+        return excludeTests;
+    }
+
+    static String getUsageString() {
+        return "Usage: " + GraalUnitTestLauncher.class.getName() + " " +
+                "-prefix (org.graalvm.compiler.api.test) " +
+                "-exclude <ExcludedTestsFileName>" + System.lineSeparator();
+    }
+
+    public static void main(String... args) throws Exception {
+
+        String testPrefix = null;
+        String excludeFileName = null;
+
+        int i=0;
+        String arg, val;
+        while (i+1 < args.length) {
+            arg = args[i++];
+            val = args[i++];
+
+            switch (arg) {
+                case "-prefix":
+                    testPrefix = val;
+                    break;
+
+                case "-exclude":
+                    excludeFileName = val;
+                    break;
+
+                default:
+                    System.out.println("WARN: illegal option " + arg);
+                    break;
+            }
+        }
+
+        if (testPrefix == null)
+            throw new Error("TESTBUG: no tests to run specified." + System.lineSeparator() + getUsageString());
+
+
+        Set<String> excludeTests = null;
+        if (excludeFileName != null) {
+            excludeTests = loadExcludeList(excludeFileName);
+        }
+
+        // Find list of tests which match provided predicate and write into GENERATED_TESTCLASSES_FILENAME file
+        ArrayList<String> tests = getListOfTestsByPrefix(testPrefix, excludeTests);
+        if (tests.size() > 0) {
+            Files.write(Paths.get(GENERATED_TESTCLASSES_FILENAME), String.join(System.lineSeparator(), tests).getBytes());
+        } else {
+            throw new Error("TESTBUG: no tests found for prefix " + testPrefix);
+        }
+
+        ArrayList<String> javaFlags = new ArrayList<String>();
+
+        // add modules and exports
+        javaFlags.add("--add-modules");
+        javaFlags.add("jdk.internal.vm.compiler,jdk.internal.vm.ci");
+        javaFlags.add("--add-exports");
+        javaFlags.add("java.base/jdk.internal.module=ALL-UNNAMED");
+        javaFlags.addAll(getModuleExports("jdk.internal.vm.compiler", "ALL-UNNAMED"));
+        javaFlags.addAll(getModuleExports("jdk.internal.vm.ci", "ALL-UNNAMED,jdk.internal.vm.compiler"));
+
+
+        // add VM flags
+        javaFlags.add("-XX:+UnlockExperimentalVMOptions");
+        javaFlags.add("-XX:+EnableJVMCI");
+        javaFlags.add("-Djava.awt.headless=true");
+        javaFlags.add("-esa");
+        javaFlags.add("-ea");
+
+
+        // generate class path
+        ArrayList<String> graalJars = new ArrayList<String>(Arrays.asList(GRAAL_EXTRA_JARS));
+        graalJars.add(MXTOOL_JARFILE);
+        graalJars.add(GRAAL_UNITTESTS_JARFILE);
+
+        String graalJarsCP = graalJars.stream()
+                                      .map(s -> String.join(File.separator, libsDir, s))
+                                      .collect(Collectors.joining(File.pathSeparator));
+
+        javaFlags.add("-cp");
+        javaFlags.add(String.join(File.pathSeparator, System.getProperty("java.class.path"), graalJarsCP));
+
+        //
+        javaFlags.add("com.oracle.mxtool.junit.MxJUnitWrapper");
+        javaFlags.add("-JUnitVerbose");
+        javaFlags.add("-JUnitEagerStackTrace");
+        javaFlags.add("-JUnitEnableTiming");
+
+        javaFlags.add("@"+GENERATED_TESTCLASSES_FILENAME);
+
+        ProcessBuilder javaPB = ProcessTools.createJavaProcessBuilder(true,
+                javaFlags.toArray(new String[javaFlags.size()]));
+        System.out.println("INFO: run command: " + String.join(" ", javaPB.command()));
+
+        OutputAnalyzer outputAnalyzer = new OutputAnalyzer(javaPB.start());
+        System.out.println("INFO: execution result: " + outputAnalyzer.getOutput());
+        outputAnalyzer.shouldHaveExitValue(0);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/graalunit/generateTests.sh	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,72 @@
+#!/bin/bash
+#
+# 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.
+#
+
+while read -r fName pName requireInfo
+do
+  fName="${fName}Test.java"
+  echo "Generate $fName for $pName ..."
+
+  cat << EOF | sed 's/[[:blank:]]*$//' > $fName
+/*
+ * 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
+ * @requires vm.opt.final.EnableJVMCI == true
+ * $requireInfo
+ * @modules jdk.internal.vm.compiler
+ *
+ * @library /test/lib /compiler/graalunit /
+ *
+ * @build compiler.graalunit.common.GraalUnitTestLauncher
+ *
+ * @run driver jdk.test.lib.FileInstaller ../../ProblemList-graal.txt ExcludeList.txt
+ *
+ * @run main/othervm compiler.graalunit.common.GraalUnitTestLauncher -prefix $pName -exclude ExcludeList.txt
+ */
+EOF
+
+done < TestPackages.txt
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/loopopts/CountedLoopPeelingProfilePredicates.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8205515
+ * @summary CountedLoopEndNode from peeled loop body is not candidate for profile loop predication
+ *
+ * @run main/othervm -XX:-TieredCompilation -XX:-BackgroundCompilation -XX:-UseOnStackReplacement CountedLoopPeelingProfilePredicates
+ *
+ */
+
+import java.util.Arrays;
+
+public class CountedLoopPeelingProfilePredicates {
+    public static void main(String[] args) {
+        int stop = 2;
+        boolean[] flags1 = new boolean[stop];
+        flags1[stop-1] = true;
+        boolean[] flags2 = new boolean[stop];
+        flags2[0] = true;
+        boolean[] flags3 = new boolean[100];
+        Arrays.fill(flags3, true);
+        flags3[0] = false;
+
+        for (int i = 0; i < 20_000; i++) {
+            test_helper(stop, flags1, false);
+            test_helper(stop, flags2, false);
+            test_helper(stop, flags2, false);
+        }
+        for (int i = 0; i < 20_000; i++) {
+            test(stop, flags1, false, flags3, 1);
+            test(stop, flags2, false, flags3, 1);
+            test(stop, flags2, false, flags3, 1);
+        }
+    }
+
+
+
+    private static void test(int stop, boolean[] flags1, boolean flag2, boolean[] flags3, int inc) {
+        for (int j = 0; j < 100; j+=inc) {
+            if (flags3[j]) {
+                test_helper(stop, flags1, flag2);
+            }
+        }
+    }
+
+    private static void test_helper(int stop, boolean[] flags1, boolean flag2) {
+        for (int i = 0; i < stop; i++) {
+            if (flags1[i]) {
+                return;
+            }
+            if (flag2) {
+            }
+        }
+    }
+}
--- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/ByteCodeGenerator.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/ByteCodeGenerator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -23,14 +23,14 @@
 
 package jdk.test.lib.jittester;
 
-import java.io.FileOutputStream;
+import jdk.test.lib.jittester.visitors.ByteCodeVisitor;
+
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.StandardOpenOption;
 import java.util.function.Function;
-import jdk.test.lib.jittester.visitors.ByteCodeVisitor;
 
 /**
  * Generates class files from IRTree
@@ -88,8 +88,8 @@
     }
 
     private void writeFile(String fileName, byte[] bytecode) {
-        try (FileOutputStream file = new FileOutputStream(generatorDir.resolve(fileName).toFile())) {
-            file.write(bytecode);
+        try {
+            Files.write(generatorDir.resolve(fileName), bytecode);
         } catch (IOException ex) {
             ex.printStackTrace();
         }
--- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/JavaCodeGenerator.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/JavaCodeGenerator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -23,7 +23,6 @@
 
 package jdk.test.lib.jittester;
 
-import java.io.File;
 import java.io.IOException;
 import java.util.function.Function;
 import jdk.test.lib.jittester.visitors.JavaCodeVisitor;
@@ -65,7 +64,9 @@
     }
 
     private void compileJavaFile(String mainClassName) {
-        String classPath = getRoot() + File.pathSeparator + generatorDir;
+        String classPath = getRoot().resolve(generatorDir)
+                                    .toAbsolutePath()
+                                    .toString();
         ProcessBuilder pb = new ProcessBuilder(JAVAC, "-cp", classPath,
                 generatorDir.resolve(mainClassName + ".java").toString());
         try {
--- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java	Tue Jul 03 11:23:42 2018 +0200
@@ -58,7 +58,9 @@
     }
 
     protected void generateGoldenOut(String mainClassName) {
-        String classPath = getRoot() + File.pathSeparator + generatorDir;
+        String classPath = getRoot().resolve(generatorDir)
+                                    .toAbsolutePath()
+                                    .toString();
         ProcessBuilder pb = new ProcessBuilder(JAVA, "-Xint", DISABLE_WARNINGS, "-Xverify",
                 "-cp", classPath, mainClassName);
         String goldFile = mainClassName + ".gold";
@@ -182,7 +184,10 @@
         for (String name : env) {
             String path = System.getenv(name);
             if (path != null) {
-                return path + "/bin/";
+                return Paths.get(path)
+                            .resolve("bin")
+                            .toAbsolutePath()
+                            .toString();
             }
         }
         return "";
--- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TypesParser.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TypesParser.java	Tue Jul 03 11:23:42 2018 +0200
@@ -31,6 +31,7 @@
 import java.lang.reflect.Modifier;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -207,7 +208,7 @@
         Asserts.assertNotNull(klassesFileName, "Classes input file name is null");
         Asserts.assertFalse(klassesFileName.isEmpty(), "Classes input file name is empty");
         List<String> klassNamesList = new ArrayList<>();
-        Path klassesFilePath = (new File(klassesFileName)).toPath();
+        Path klassesFilePath = Paths.get(klassesFileName);
         try {
             Files.lines(klassesFilePath).forEach(line -> {
                 line = line.trim();
@@ -223,7 +224,7 @@
             throw new Error("Error reading klasses file", ex);
         }
         List<Class<?>> klassesList = new ArrayList<>();
-        klassNamesList.stream().forEach(klassName -> {
+        klassNamesList.forEach(klassName -> {
             try {
                 klassesList.add(Class.forName(klassName));
             } catch (ClassNotFoundException ex) {
@@ -237,7 +238,7 @@
         Asserts.assertNotNull(methodsFileName, "Methods exclude input file name is null");
         Asserts.assertFalse(methodsFileName.isEmpty(), "Methods exclude input file name is empty");
         LinkedList<String> methodNamesList = new LinkedList<>();
-        Path klassesFilePath = (new File(methodsFileName)).toPath();
+        Path klassesFilePath = Paths.get(methodsFileName);
         try {
             Files.lines(klassesFilePath).forEach(line -> {
                 line = line.trim();
@@ -253,7 +254,7 @@
             throw new Error("Error reading exclude method file", ex);
         }
         Set<Executable> methodsList = new HashSet<>();
-        methodNamesList.stream().forEach(methodName -> {
+        methodNamesList.forEach(methodName -> {
             String[] klassAndNameAndSig = methodName.split("::");
             String klassName = klassAndNameAndSig[0].replaceAll("/", "\\.");
             String[] nameAndSig = klassAndNameAndSig[1].split("[\\(\\)]");
--- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/jtreg/JitTesterDriver.java	Tue Jul 03 11:23:42 2018 +0200
@@ -24,15 +24,15 @@
 package jdk.test.lib.jittester.jtreg;
 
 import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
-import jdk.test.lib.Utils;
+
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
 import java.util.Arrays;
-import java.util.function.Predicate;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/TestDescription.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/TestDescription.java	Tue Jul 03 11:23:42 2018 +0200
@@ -35,8 +35,8 @@
  *     agent starts new thread from the 'agentmain' method, and all test checks are executed
  *     in this thread.
  *     Test checks that agent's JAR file is appended at the end of the system class path.
- *     Agent's JAR file contains modified class java.util.ServiceConfigurationError (it is assumed
- *     that this class isn't loaded before agent is loaded), agent instantiates ServiceConfigurationError
+ *     Agent's JAR file contains modified class java.util.TooManyListenersException (it is assumed
+ *     that this class isn't loaded before agent is loaded), agent instantiates TooManyListenersException
  *     and checks that non-modified version of this class was loaded from rt.jar (not from agent's JAR).
  *
  * @library /vmTestbase
@@ -46,7 +46,7 @@
  *        nsk.share.aod.TargetApplicationWaitingAgents
  *        nsk.jvmti.AttachOnDemand.attach024.attach024Agent00
  *
- * @comment compile modified java.util.ServiceConfigurationError
+ * @comment compile modified java.util.TooManyListenersException
  * @build ExecDriver
  * @run driver PropertyResolvingWrapper ExecDriver --cmd
  *      ${compile.jdk}/bin/javac
@@ -54,14 +54,14 @@
  *      -d ./bin/classes
  *      --patch-module java.base=${test.src}/java.base
  *      --add-reads java.base=ALL-UNNAMED
- *      ${test.src}/java.base/java/util/ServiceConfigurationError.java
+ *      ${test.src}/java.base/java/util/TooManyListenersException.java
  *
  * @comment create attach024Agent00.jar in current directory
  * @run driver PropertyResolvingWrapper ExecDriver --cmd
  *      ${compile.jdk}/bin/jar
  *      -cfm attach024Agent00.jar ${test.src}/attach024Agent00.mf
  *      -C ./bin/classes
- *      java/util/ServiceConfigurationError.class
+ *      java/util/TooManyListenersException.class
  * @run driver ClassFileInstaller
  *      nsk.jvmti.AttachOnDemand.attach024.attach024Agent00
  * @run driver PropertyResolvingWrapper ExecDriver --cmd
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/attach024Agent00.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/attach024Agent00.java	Tue Jul 03 11:23:42 2018 +0200
@@ -30,27 +30,27 @@
 
     public static final String MODIFIED_TO_STRING = "attach024: Modified version";
 
-    private static final String TESTED_CLASS_NAME = "java.util.ServiceConfigurationError";
+    private static final String TESTED_CLASS_NAME = "java.util.TooManyListenersException";
 
     protected void agentActions() {
         /*
-         * Check that ServiceConfigurationError isn't loaded, otherwise test checks
+         * Check that TooManyListenersException isn't loaded, otherwise test checks
          * doesn't make sense
          */
         for (Class<?> klass : inst.getAllLoadedClasses()) {
             if (klass.getName().equals(TESTED_CLASS_NAME)) {
-                throw new TestBug("ServiceConfigurationError already loaded");
+                throw new TestBug("TooManyListenersException already loaded");
             }
         }
 
-        checkServiceConfigurationError();
+        checkTooManyListenersException();
     }
 
-    void checkServiceConfigurationError() {
-        java.util.ServiceConfigurationError e = new java.util.ServiceConfigurationError("Test");
-        display("ServiceConfigurationError.toString(): " + e.toString());
+    void checkTooManyListenersException() {
+        java.util.TooManyListenersException e = new java.util.TooManyListenersException("Test");
+        display("TooManyListenersException.toString(): " + e.toString());
         if (e.toString().equals(MODIFIED_TO_STRING)) {
-            setStatusFailed("Class ServiceConfigurationError was erroneously loaded from agent's jar");
+            setStatusFailed("Class TooManyListenersException was erroneously loaded from agent's jar");
         }
     }
 
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/java.base/java/util/ServiceConfigurationError.java	Tue Jul 03 11:02:57 2018 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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.util;
-
-import nsk.jvmti.AttachOnDemand.attach024.*;
-
-public class ServiceConfigurationError extends Error {
-    private static final long serialVersionUID = 74132770414881L;
-
-    public ServiceConfigurationError(String msg) {
-        super(msg);
-    }
-
-    public ServiceConfigurationError(String msg, Throwable cause) {
-        super(msg, cause);
-    }
-
-    public String toString() {
-        return attach024Agent00.MODIFIED_TO_STRING;
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach024/java.base/java/util/TooManyListenersException.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1996, 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.  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 java.util;
+
+import nsk.jvmti.AttachOnDemand.attach024.*;
+
+/**
+ * <p>
+ * The <code> TooManyListenersException </code> Exception is used as part of
+ * the Java Event model to annotate and implement a unicast special case of
+ * a multicast Event Source.
+ * </p>
+ * <p>
+ * The presence of a "throws TooManyListenersException" clause on any given
+ * concrete implementation of the normally multicast "void addXyzEventListener"
+ * event listener registration pattern is used to annotate that interface as
+ * implementing a unicast Listener special case, that is, that one and only
+ * one Listener may be registered on the particular event listener source
+ * concurrently.
+ * </p>
+ *
+ * @see java.util.EventObject
+ * @see java.util.EventListener
+ *
+ * @author Laurence P. G. Cable
+ * @since  1.1
+ */
+
+public class TooManyListenersException extends Exception {
+    private static final long serialVersionUID = 5074640544770687831L;
+
+    /**
+     * Constructs a TooManyListenersException with no detail message.
+     * A detail message is a String that describes this particular exception.
+     */
+
+    public TooManyListenersException() {
+        super();
+    }
+
+    /**
+     * Constructs a TooManyListenersException with the specified detail message.
+     * A detail message is a String that describes this particular exception.
+     * @param s the detail message
+     */
+
+    public TooManyListenersException(String s) {
+        super(s);
+    }
+
+    public String toString() {
+        return attach024Agent00.MODIFIED_TO_STRING;
+    }
+}
--- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/EventTestTemplates.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/EventTestTemplates.java	Tue Jul 03 11:23:42 2018 +0200
@@ -139,7 +139,7 @@
 
         // can't control events from system libraries, so save events only from nsk packages
         protected boolean shouldSaveEvent(Event event) {
-            return isEventFromNSK(event);
+            return isEventFromNSK(event, debuggee);
         }
 
         protected String debuggeeClassName() {
@@ -415,7 +415,7 @@
 
         // can't control events from system libraries, so save events only from nsk packages
         protected boolean shouldSaveEvent(Event event) {
-            return isEventFromNSK(event);
+            return isEventFromNSK(event, debuggee);
         }
 
         protected String debuggeeClassName() {
@@ -436,20 +436,25 @@
         }
     }
 
-    static public boolean isEventFromNSK(Event event) {
-        if (event instanceof MonitorContendedEnterEvent) {
-            return ((MonitorContendedEnterEvent) event).location() != null && ((MonitorContendedEnterEvent) event).monitor().type().name().startsWith("nsk.");
-        }
-        if (event instanceof MonitorContendedEnteredEvent) {
-            return ((MonitorContendedEnteredEvent) event).location() != null  && ((MonitorContendedEnteredEvent) event).monitor().type().name().startsWith("nsk.");
+    static public boolean isEventFromNSK(Event event, Debugee debuggee) {
+        try {
+            if (event instanceof MonitorContendedEnterEvent) {
+                return ((MonitorContendedEnterEvent) event).location() != null && ((MonitorContendedEnterEvent) event).monitor().type().name().startsWith("nsk.");
+            }
+            if (event instanceof MonitorContendedEnteredEvent) {
+                return ((MonitorContendedEnteredEvent) event).location() != null && ((MonitorContendedEnteredEvent) event).monitor().type().name().startsWith("nsk.");
+            }
+            if (event instanceof MonitorWaitEvent) {
+                return ((MonitorWaitEvent) event).monitor().type().name().startsWith("nsk.");
+            }
+            if (event instanceof MonitorWaitedEvent) {
+                return ((MonitorWaitedEvent) event).monitor().type().name().startsWith("nsk.");
+            }
+        } catch (ObjectCollectedException ex) {
+            // The monitor object the event refers to might be already collected. Ignore this exception.
+            debuggee.getLog().display("Exception caught:" + ex);
+            return false;
         }
-        if (event instanceof MonitorWaitEvent) {
-            return ((MonitorWaitEvent) event).monitor().type().name().startsWith("nsk.");
-        }
-        if (event instanceof MonitorWaitedEvent) {
-            return ((MonitorWaitedEvent) event).monitor().type().name().startsWith("nsk.");
-        }
-
         // don't filter other events
         return true;
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLEventReaderTest/EventReaderTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package stream.XMLEventReaderTest;
+
+import java.io.StringReader;
+import java.util.NoSuchElementException;
+import javax.xml.stream.XMLEventReader;
+
+import javax.xml.stream.XMLInputFactory;
+import org.testng.annotations.Listeners;
+import org.testng.annotations.Test;
+
+/*
+ * @test
+ * @bug 8204329
+ * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
+ * @run testng stream.XMLEventReaderTest.EventReaderTest
+ * @summary Tests XMLEventReader
+ */
+@Listeners({jaxp.library.BasePolicy.class})
+public class EventReaderTest {
+    @Test(expectedExceptions = NoSuchElementException.class)
+    public void testNextEvent() throws Exception {
+        XMLEventReader eventReader = XMLInputFactory.newFactory().createXMLEventReader(
+                new StringReader("<?xml version='1.0'?><foo/>"));
+
+        while (eventReader.hasNext()) {
+            eventReader.nextEvent();
+        }
+        // no more event
+        eventReader.nextEvent();
+    }
+}
--- a/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/jaxp/javax/xml/jaxp/unittest/stream/XMLStreamReaderTest/StreamReaderTest.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -20,9 +20,10 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package stream.XMLStreamReaderTest;
 
+import java.io.StringReader;
+import java.util.NoSuchElementException;
 import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamReader;
@@ -34,7 +35,7 @@
 
 /*
  * @test
- * @bug 8167340
+ * @bug 8167340 8204329
  * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest
  * @run testng/othervm -DrunSecMngr=true stream.XMLStreamReaderTest.StreamReaderTest
  * @run testng/othervm stream.XMLStreamReaderTest.StreamReaderTest
@@ -42,6 +43,20 @@
  */
 @Listeners({jaxp.library.FilePolicy.class})
 public class StreamReaderTest {
+    @Test(expectedExceptions = NoSuchElementException.class)
+    public void testNext() throws Exception {
+        XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+        XMLStreamReader xmlStreamReader = xmlInputFactory.createXMLStreamReader(
+                new StringReader("<?xml version='1.0'?><foo/>"));
+
+        while (xmlStreamReader.hasNext()) {
+            int event = xmlStreamReader.next();
+        }
+        // no more event
+        xmlStreamReader.next();
+    }
+
+
     /**
      * Verifies that after switching to a different XML Version (1.1), the parser
      * is initialized properly (the listener was not registered in this case).
--- a/test/jdk/java/io/RandomAccessFile/SetLength.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/jdk/java/io/RandomAccessFile/SetLength.java	Tue Jul 03 11:23:42 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 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
@@ -22,60 +22,143 @@
  */
 
 /* @test
-   @summary General tests of the setLength method -- Should migrate to 1.2 JCK
+ * @bug 8204310
+ * @summary General tests of the setLength method
+ * @library /test/lib
+ * @build jdk.test.lib.RandomFactory
+ * @run main SetLength
+ * @key randomness
  */
 
-import java.io.*;
+import java.io.IOException;
+import java.io.File;
+import java.io.RandomAccessFile;
 
+import jdk.test.lib.RandomFactory;
 
 public class SetLength {
 
-    static void fail(String s) {
-        throw new RuntimeException(s);
+    static void checkState(RandomAccessFile f, long expectedFilePointer,
+            long expectedLength)
+        throws IOException
+    {
+        long filePointer = f.getFilePointer();
+        long length = f.length();
+        if (length != expectedLength) {
+            throw new RuntimeException("File length " + length + " != expected "
+                    + expectedLength);
+        }
+        if (filePointer != expectedFilePointer) {
+            throw new RuntimeException("File pointer " + filePointer
+                    + " != expected " + expectedFilePointer);
+        }
     }
 
-    static void go(File fn, int max) throws IOException {
-        int chunk = max / 4;
-        long i;
-        RandomAccessFile f;
+    static void test(RandomAccessFile f, long quarterLength)
+        throws IOException
+    {
+        long halfLength = 2 * quarterLength;
+        long threeQuarterLength = 3 * quarterLength;
+        long fullLength = 4 * quarterLength;
+
+        // initially, empty file
+        checkState(f, 0, 0);
+
+        // extending the file size
+        f.setLength(halfLength);
+        checkState(f, 0, halfLength);
+
+        // writing from the begining
+        f.write(new byte[(int)fullLength]);
+        checkState(f, fullLength, fullLength);
+
+        // setting to the same length
+        f.setLength(fullLength);
+        checkState(f, fullLength, fullLength);
+
+        // truncating the file
+        f.setLength(threeQuarterLength);
+        checkState(f, threeQuarterLength, threeQuarterLength);
+
+        // changing the file pointer
+        f.seek(quarterLength);
+        checkState(f, quarterLength, threeQuarterLength);
+
+        // truncating the file again
+        f.setLength(halfLength);
+        checkState(f, quarterLength, halfLength);
+
+        // writing from the middle with extending the file
+        f.write(new byte[(int)halfLength]);
+        checkState(f, threeQuarterLength, threeQuarterLength);
+
+        // changing the file pointer
+        f.seek(quarterLength);
+        checkState(f, quarterLength, threeQuarterLength);
 
-        f = new RandomAccessFile(fn, "rw");
-        f.setLength(2 * chunk);
-        if (f.length() != 2 * chunk) fail("Length not increased to " + (2 * chunk));
-        if ((i = f.getFilePointer()) != 0) fail("File pointer shifted to " + i);
-        byte[] buf = new byte[max];
-        f.write(buf);
-        if (f.length() != max) fail("Write didn't work");
-        if (f.getFilePointer() != max) fail("File pointer inconsistent");
-        f.setLength(3 * chunk);
-        if (f.length() != 3 * chunk) fail("Length not reduced to " + 3 * chunk);
-        if (f.getFilePointer() != 3 * chunk) fail("File pointer not shifted to " + (3 * chunk));
-        f.seek(1 * chunk);
-        if (f.getFilePointer() != 1 * chunk) fail("File pointer not shifted to " + (1 * chunk));
-        f.setLength(2 * chunk);
-        if (f.length() != 2 * chunk) fail("Length not reduced to " + (2 * chunk));
-        if (f.getFilePointer() != 1 * chunk) fail("File pointer not shifted to " + (1 * chunk));
+        // writing from the middle without extending the file
+        f.write(new byte[(int)quarterLength]);
+        checkState(f, halfLength, threeQuarterLength);
+
+        // changing the file pointer to the end of file
+        f.seek(threeQuarterLength);
+        checkState(f, threeQuarterLength, threeQuarterLength);
+
+        // writing to the end of file
+        f.write(new byte[(int)quarterLength]);
+        checkState(f, fullLength, fullLength);
+
+        // truncating the file to zero
+        f.setLength(0);
+        checkState(f, 0, 0);
+
+        // changing the file pointer beyond the end of file
+        f.seek(threeQuarterLength);
+        checkState(f, threeQuarterLength, 0);
+
+        // writing beyont the end of file
+        f.write(new byte[(int)quarterLength]);
+        checkState(f, fullLength, fullLength);
+
+        // negative file pointer
+        try {
+            f.seek(-1);
+            throw new RuntimeException("IOE not thrown");
+        } catch (IOException expected) {
+        }
+        checkState(f, fullLength, fullLength);
+
+        // truncating the file after failed seek
+        f.setLength(halfLength);
+        checkState(f, halfLength, halfLength);
+
+        // truncating after closing
         f.close();
+        try {
+            f.setLength(halfLength);
+            throw new RuntimeException("IOE not thrown");
+        } catch (IOException expected) {
+        }
     }
 
     public static void main(String[] args) throws IOException {
-        File fn = new File("x.SetLength");
-        try {
-            go(fn, 20);
-            fn.delete();
-            go(fn, 64 * 1024);
-            RandomAccessFile f = new RandomAccessFile(fn, "r");
-            boolean thrown = false;
-            try {
-                f.setLength(3);
-            } catch (IOException x) {
-                thrown = true;
-            }
-            if (!thrown) fail("setLength succeeded on a file opened read-only");
-            f.close();
+        File f28b = new File("f28b");
+        File f28K = new File("f28K");
+        File frnd = new File("frnd");
+
+        try (RandomAccessFile raf28b = new RandomAccessFile(f28b, "rw");
+             RandomAccessFile raf28K = new RandomAccessFile(f28K, "rw");
+             RandomAccessFile rafrnd = new RandomAccessFile(frnd, "rw")) {
+            test(raf28b, 7);
+            test(raf28K, 7 * 1024);
+            test(rafrnd, 1 + RandomFactory.getRandom().nextInt(16000));
         }
-        finally {
-            fn.delete();
+
+        // truncating read-only file
+        try (RandomAccessFile raf28b = new RandomAccessFile(f28b, "r")) {
+            raf28b.setLength(42);
+            throw new RuntimeException("IOE not thrown");
+        } catch (IOException expected) {
         }
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/nio/channels/FileChannel/TruncateRAF.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,155 @@
+/*
+ * 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 8204310
+ * @summary Check how FileChannel behaves if the file size/offset change via
+ *          RAF.setLength() and other methods.
+ * @run main TruncateRAF
+ */
+
+import java.io.File;
+import java.io.RandomAccessFile;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
+public class TruncateRAF {
+
+    static void checkState(RandomAccessFile raf, FileChannel fch,
+            long expectedOffset, long expectedLength)
+        throws IOException
+    {
+        long rafLength = raf.length();
+        long rafOffset = raf.getFilePointer();
+        long fchLength = fch.size();
+        long fchOffset = fch.position();
+
+        if (rafLength != expectedLength)
+            throw new RuntimeException("rafLength (" + rafLength + ") != " +
+                    "expectedLength (" + expectedLength + ")");
+        if (rafOffset != expectedOffset)
+            throw new RuntimeException("rafOffset (" + rafOffset + ") != " +
+                    "expectedOffset (" + expectedOffset + ")");
+        if (fchLength != expectedLength)
+            throw new RuntimeException("fchLength (" + fchLength + ") != " +
+                    "expectedLength (" + expectedLength + ")");
+        if (fchOffset != expectedOffset)
+            throw new RuntimeException("fchOffset (" + fchOffset + ") != " +
+                    "expectedOffset (" + expectedOffset + ")");
+    }
+
+    public static void main(String[] args) throws Throwable {
+        File file = new File("tmp");
+        try (RandomAccessFile raf = new RandomAccessFile(file, "rw");
+             FileChannel fch = raf.getChannel()) {
+
+            // initially empty
+            checkState(raf, fch, 0, 0);
+
+            // seeking beyond EOF
+            raf.seek(42);
+            checkState(raf, fch, 42, 0);
+
+            // seeking beyond EOF
+            fch.position(84);
+            checkState(raf, fch, 84, 0);
+
+            // writing at offset beyond EOF
+            raf.write(1);
+            checkState(raf, fch, 85, 85);
+
+            // truncating
+            raf.setLength(63);
+            checkState(raf, fch, 63, 63);
+
+            // writing at EOF
+            fch.write(ByteBuffer.wrap(new byte[1]));
+            checkState(raf, fch, 64, 64);
+
+            // seeking at the middle
+            fch.position(32);
+            checkState(raf, fch, 32, 64);
+
+            // truncating beyond offset
+            fch.truncate(42);
+            checkState(raf, fch, 32, 42);
+
+            // truncating before offset
+            fch.truncate(16);
+            checkState(raf, fch, 16, 16);
+
+            // writing at position beyond EOF
+            fch.write(ByteBuffer.wrap(new byte[1]), 127);
+            checkState(raf, fch, 16, 128);
+
+            // writing at position before EOF
+            fch.write(ByteBuffer.wrap(new byte[1]), 42);
+            checkState(raf, fch, 16, 128);
+
+            // truncating
+            raf.setLength(64);
+            checkState(raf, fch, 16, 64);
+
+            // changing offset
+            raf.seek(21);
+            checkState(raf, fch, 21, 64);
+
+            // skipping should change offset
+            raf.skipBytes(4);
+            checkState(raf, fch, 25, 64);
+
+            // reading should change offset
+            raf.read();
+            checkState(raf, fch, 26, 64);
+
+            // truncating to zero
+            raf.setLength(0);
+            checkState(raf, fch, 0, 0);
+
+            // FileChannel cannot expand size
+            fch.truncate(42);
+            checkState(raf, fch, 0, 0);
+
+            // expanding
+            raf.setLength(42);
+            checkState(raf, fch, 0, 42);
+
+            // seeking beyond EOF
+            raf.seek(512);
+            checkState(raf, fch, 512, 42);
+
+            // truncating to the same size
+            fch.truncate(256);
+            checkState(raf, fch, 256, 42);
+
+            // truncating to the same size
+            fch.truncate(42);
+            checkState(raf, fch, 42, 42);
+
+            // truncating to zero
+            fch.truncate(0);
+            checkState(raf, fch, 0, 0);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/GraphicsConfigNotifier/OrderOfGConfigNotify.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import javax.swing.JFrame;
+import javax.swing.JPanel;
+
+/**
+ * @test
+ * @key headful
+ * @bug 8201552
+ * @summary Container should get "graphicsConfiguration" notification when all
+ *          its children are updated
+ */
+public final class OrderOfGConfigNotify {
+
+    private static String name = "graphicsConfiguration";
+
+    public static void main(final String[] args) throws Exception {
+        EventQueue.invokeAndWait(() -> {
+            AtomicBoolean parentCalled = new AtomicBoolean(false);
+            AtomicBoolean childCalled = new AtomicBoolean(false);
+
+            JFrame frame = new JFrame();
+
+            JPanel parent = new JPanel();
+            parent.addPropertyChangeListener(evt -> {
+                if (!evt.getPropertyName().equals(name)) {
+                    return;
+                }
+                if (!childCalled.get()) {
+                    throw new RuntimeException("Parent is called/child is not");
+                }
+                parentCalled.set(true);
+                if (parent.getGraphicsConfiguration() == null) {
+                    throw new RuntimeException("GraphicsConfiguration is null");
+                }
+            });
+            JPanel child = new JPanel();
+            child.addPropertyChangeListener(evt -> {
+                if (!evt.getPropertyName().equals(name)) {
+                    return;
+                }
+                childCalled.set(true);
+                if (child.getGraphicsConfiguration() == null) {
+                    throw new RuntimeException("GraphicsConfiguration is null");
+                }
+            });
+            parent.add(child);
+
+            // Frame.add() should update graphicsConfiguration for all hierarchy
+            frame.add(parent);
+            if (!parentCalled.get() || !childCalled.get()) {
+                throw new RuntimeException("Property listener was not called");
+            }
+        });
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/GraphicsConfigNotifier/StalePreferredSize.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.EventQueue;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JEditorPane;
+import javax.swing.JFormattedTextField;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JMenu;
+import javax.swing.JMenuItem;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JSpinner;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.JTextField;
+import javax.swing.JToolTip;
+import javax.swing.JTree;
+import javax.swing.SpinnerListModel;
+import javax.swing.SwingUtilities;
+import javax.swing.UIManager;
+import javax.swing.UnsupportedLookAndFeelException;
+import javax.swing.tree.DefaultMutableTreeNode;
+
+import static javax.swing.UIManager.getInstalledLookAndFeels;
+
+/**
+ * @test
+ * @key headful
+ * @bug 8201552
+ * @summary Initial layout of the component should use correct graphics config.
+ *          It is checked by SwingUtilities.updateComponentTreeUI(), if layout
+ *          was correct the call to updateComponentTreeUI() will be no-op.
+ * @compile -encoding utf-8 StalePreferredSize.java
+ * @run main/othervm/timeout=200 StalePreferredSize
+ * @run main/othervm/timeout=200 -Dsun.java2d.uiScale=1 StalePreferredSize
+ * @run main/othervm/timeout=200 -Dsun.java2d.uiScale=2.25 StalePreferredSize
+ */
+public final class StalePreferredSize {
+
+    // Some text to be tested
+    static final String TEXT[] = new String[]{
+            "<span>A few words to get started before the "
+                    + "bug</span><span>overlapping text</span>",
+            "A quick brown fox jumps over the lazy dog",
+            "El veloz murciélago hindú comía feliz cardillo y kiwi. La cigüeña "
+                    + "tocaba el saxofón detrás del palenque de paja",
+            "Voix ambiguë d’un cœur qui au zéphyr préfère les jattes de kiwis",
+            "다람쥐 헌 쳇바퀴에 타고파",
+            "Съешь ещё этих мягких французских булок да выпей же чаю"};
+
+    static JFrame frame;
+    static Component component;
+    static int typeFont = 0; // 0 - default, 1 - bold, 2 - italic
+
+    public static void main(final String[] args) throws Exception {
+        for (final UIManager.LookAndFeelInfo laf : getInstalledLookAndFeels()) {
+            EventQueue.invokeAndWait(() -> setLookAndFeel(laf));
+            for (typeFont = 0; typeFont < 3; typeFont++) {
+                System.err.println("typeFont = " + typeFont);
+                for (final boolean html : new boolean[]{true, false}) {
+                    for (String text : TEXT) {
+                        if (html) {
+                            text = "<html>" + text + "</html>";
+                        }
+                        test(text);
+                    }
+                }
+            }
+        }
+    }
+
+    private static void test(String text) throws Exception {
+        System.err.println("text = " + text);
+        // Each Callable create a component to be tested
+        final List<Callable<Component>> comps = List.of(
+                () -> new JLabel(text),
+                () -> new JButton(text),
+                () -> new JMenuItem(text),
+                () -> new JMenu(text),
+                () -> new JList<>(new String[]{text}),
+                () -> new JComboBox<>(new String[]{text}),
+                () -> new JTextField(text),
+                () -> new JTextArea(text),
+                () -> new JCheckBox(text),
+                () -> new JFormattedTextField(text),
+                () -> new JRadioButton(text),
+                () -> new JTree(new DefaultMutableTreeNode(text)),
+                () -> new JSpinner(new SpinnerListModel(new String[]{text})),
+                () -> {
+                    JToolTip tip = new JToolTip();
+                    tip.setTipText(text);
+                    return tip;
+                    },
+                () -> {
+                    JEditorPane pane = new JEditorPane();
+                    pane.setText(text);
+                    return pane;
+                    },
+                () -> {
+                    JTable table = new JTable(1, 1);
+                    table.getModel().setValueAt(text, 0, 0);
+                    return table;
+                    }
+        );
+
+        for (final Callable<Component> creator : comps) {
+            checkComponent(creator);
+        }
+    }
+
+    static void checkComponent(Callable<Component> creator) throws Exception {
+        EventQueue.invokeAndWait(() -> {
+
+            try {
+                component = creator.call();
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            Font font = component.getFont();
+            if (typeFont == 1) {
+                component.setFont(new Font(font.deriveFont(Font.BOLD).getAttributes()));
+            }
+            if (typeFont == 2) {
+                component.setFont(new Font(font.deriveFont(Font.ITALIC).getAttributes()));
+            }
+
+            frame = new JFrame();
+            frame.setLayout(new FlowLayout());
+            frame.add(new JScrollPane(component));
+            frame.setSize(300, 100);
+            frame.setLocationRelativeTo(null);
+            frame.setVisible(true);
+        });
+
+        EventQueue.invokeAndWait(() -> {
+
+            // After the frame was shown we change nothing, so current layout
+            // should be optimal and updateComponentTreeUI() should be no-op
+            Dimension before = component.getPreferredSize();
+            SwingUtilities.updateComponentTreeUI(frame);
+            Dimension after = component.getPreferredSize();
+
+            // We change the font size to some big value, as a result the
+            // layout and preferredSize of the component should be changed
+            component.setFont(component.getFont().deriveFont(35f));
+            Dimension last = component.getPreferredSize();
+
+            frame.dispose();
+
+            if (!Objects.equals(before, after)) {
+                System.err.println("Component: " + component);
+                System.err.println("Before: " + before);
+                System.err.println("After: " + after);
+                throw new RuntimeException("Wrong PreferredSize");
+            }
+            // TODO JDK-8206024
+//            if (Objects.equals(after, last)) {
+//                System.err.println("Component: " + component);
+//                System.err.println("After: " + after);
+//                System.err.println("Last: " + last);
+//                throw new RuntimeException("Wrong PreferredSize");
+//            }
+        });
+    }
+
+    private static void setLookAndFeel(final UIManager.LookAndFeelInfo laf) {
+        try {
+            UIManager.setLookAndFeel(laf.getClassName());
+            System.err.println("LookAndFeel: " + laf.getClassName());
+        } catch (final UnsupportedLookAndFeelException ignored) {
+            System.err.println(
+                    "Unsupported LookAndFeel: " + laf.getClassName());
+        } catch (ClassNotFoundException | InstantiationException |
+                IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/swing/GraphicsConfigNotifier/TestSingleScreenGConfigNotify.java	Tue Jul 03 11:23:42 2018 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.awt.EventQueue;
+import java.awt.GraphicsConfiguration;
+import java.util.Objects;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+
+/**
+ * @test
+ * @key headful
+ * @bug 8201552
+ * @summary Verifies if graphicsConfiguration property notification is sent
+ *          when frame is shown on the screen.
+ * @run main TestSingleScreenGConfigNotify
+ * @run main/othervm -Dsun.java2d.uiScale=2.25 TestSingleScreenGConfigNotify
+ */
+public final class TestSingleScreenGConfigNotify {
+
+    private static String name = "graphicsConfiguration";
+    private static CountDownLatch go = new CountDownLatch(1);
+    private static JFrame frame;
+    private static GraphicsConfiguration after;
+    private static GraphicsConfiguration before;
+    private static JButton button;
+
+    public static void main(final String[] args) throws Exception {
+        EventQueue.invokeAndWait(() -> {
+            frame = new JFrame();
+
+            frame.setSize(300,300);
+            frame.setLocationRelativeTo(null);
+            button = new JButton();
+            button.addPropertyChangeListener(evt -> {
+                if (evt.getPropertyName().equals(name)) {
+                    go.countDown();
+                }
+            });
+
+            before = button.getGraphicsConfiguration();
+
+            frame.add(button);
+            frame.setVisible(true);
+        });
+
+        boolean called = go.await(10, TimeUnit.SECONDS);
+
+        EventQueue.invokeAndWait(() -> {
+            after = button.getGraphicsConfiguration();
+            frame.dispose();
+        });
+
+        if (Objects.equals(before, after) && called) {
+            throw new RuntimeException("propertyChange() should not be called");
+        }
+        if (!Objects.equals(before, after) && !called) {
+            throw new RuntimeException("propertyChange() should be called");
+        }
+    }
+}
--- a/test/jtreg-ext/requires/VMProps.java	Tue Jul 03 11:02:57 2018 +0200
+++ b/test/jtreg-ext/requires/VMProps.java	Tue Jul 03 11:23:42 2018 +0200
@@ -251,17 +251,18 @@
      * @param flagName - flag name
      */
     private void vmOptFinalFlag(Map<String, String> map, String flagName) {
-        String value = WB.getBooleanVMFlag(flagName) ? "true" : "false";
+        String value = String.valueOf(WB.getBooleanVMFlag(flagName));
         map.put("vm.opt.final." + flagName, value);
     }
 
     /**
      * Selected sets of final flags.
-     * @param map -property-value pairs
+     * @param map - property-value pairs
      */
     protected void vmOptFinalFlags(Map<String, String> map) {
         vmOptFinalFlag(map, "ClassUnloading");
         vmOptFinalFlag(map, "UseCompressedOops");
+        vmOptFinalFlag(map, "EnableJVMCI");
     }
 
     /**