Merge
authorduke
Wed, 05 Jul 2017 20:27:20 +0200
changeset 29770 6415d011ad02
parent 29769 80e73beff5ba (current diff)
parent 29768 c6ba5f375336 (diff)
child 29784 b9220497eb43
Merge
hotspot/src/share/vm/memory/specialized_oop_closures.cpp
jdk/make/Makefile
jdk/src/java.base/unix/conf/arm/jvm.cfg
jdk/src/java.base/unix/conf/ppc/jvm.cfg
jdk/test/jdk/lambda/FDTest.java
jdk/test/jdk/lambda/LambdaTranslationInInterface.java
jdk/test/jdk/lambda/LambdaTranslationInnerConstructor.java
jdk/test/jdk/lambda/MethodReferenceTestFDCCE.java
jdk/test/jdk/lambda/MethodReferenceTestInnerDefault.java
jdk/test/jdk/lambda/MethodReferenceTestInnerInstance.java
jdk/test/jdk/lambda/MethodReferenceTestInnerVarArgsThis.java
jdk/test/jdk/lambda/MethodReferenceTestInstance.java
jdk/test/jdk/lambda/MethodReferenceTestKinds.java
jdk/test/jdk/lambda/MethodReferenceTestNew.java
jdk/test/jdk/lambda/MethodReferenceTestNewInner.java
jdk/test/jdk/lambda/MethodReferenceTestSueCase1.java
jdk/test/jdk/lambda/MethodReferenceTestSueCase2.java
jdk/test/jdk/lambda/MethodReferenceTestSueCase4.java
jdk/test/jdk/lambda/MethodReferenceTestSuper.java
jdk/test/jdk/lambda/MethodReferenceTestSuperDefault.java
jdk/test/jdk/lambda/MethodReferenceTestTypeConversion.java
jdk/test/jdk/lambda/MethodReferenceTestVarArgs.java
jdk/test/jdk/lambda/MethodReferenceTestVarArgsExt.java
jdk/test/jdk/lambda/MethodReferenceTestVarArgsSuper.java
jdk/test/jdk/lambda/MethodReferenceTestVarArgsSuperDefault.java
jdk/test/jdk/lambda/MethodReferenceTestVarArgsThis.java
jdk/test/jdk/lambda/shapegen/ClassCase.java
jdk/test/jdk/lambda/shapegen/Hierarchy.java
jdk/test/jdk/lambda/shapegen/HierarchyGenerator.java
jdk/test/jdk/lambda/shapegen/Rule.java
jdk/test/jdk/lambda/shapegen/RuleGroup.java
jdk/test/jdk/lambda/shapegen/TTNode.java
jdk/test/jdk/lambda/shapegen/TTParser.java
jdk/test/jdk/lambda/shapegen/TTShape.java
make/MakeHelpers.gmk
nashorn/make/Makefile
nashorn/test/src/jdk/internal/dynalink/beans/CallerSensitiveTest.java
nashorn/test/src/jdk/nashorn/api/NashornSQLDriver.java
nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java
nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java
nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java
nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java
nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java
nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java
nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java
nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java
nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java
nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java
nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java
nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java
nashorn/test/src/jdk/nashorn/api/scripting/Window.java
nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java
nashorn/test/src/jdk/nashorn/api/scripting/resources/func.js
nashorn/test/src/jdk/nashorn/api/scripting/resources/gettersetter.js
nashorn/test/src/jdk/nashorn/api/scripting/resources/witheval.js
nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java
nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java
nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java
nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/regexp/JdkRegExpTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java
nashorn/test/src/jdk/nashorn/internal/runtime/resources/load_test.js
--- a/.hgtags-top-repo	Wed Apr 08 13:12:48 2015 -0700
+++ b/.hgtags-top-repo	Wed Jul 05 20:27:20 2017 +0200
@@ -300,3 +300,4 @@
 0c37a832458f0e0b7d2a3f1a6f69aeae311aeb18 jdk9-b55
 eb7febe45865ba6b81f2ea68082262d0708a0b22 jdk9-b56
 f25ee9f62427a9ba27418e5531a89754791a305b jdk9-b57
+6e78dd9b121037719a065fe8fb25b936babdfecb jdk9-b58
--- a/Makefile	Wed Apr 08 13:12:48 2015 -0700
+++ b/Makefile	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,200 +23,42 @@
 # questions.
 #
 
-# This must be the first rule
-default:
+###
+### This file is just a very small wrapper needed to run the real make/Init.gmk.
+### It also performs some sanity checks on make.
+###
 
-# Inclusion of this pseudo-target will cause make to execute this file
-# serially, regardless of -j. Recursively called makefiles will not be
-# affected, however. This is required for correct dependency management.
-.NOTPARALLEL:
+# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU Make.
+# /usr/ccs/bin/make lacks basically every other flow control mechanism.
+.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU Make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
 
-# The shell code below will be executed on /usr/ccs/bin/make on Solaris, but not in GNU make.
-# /usr/ccs/bin/make lacks basically every other flow control mechanism.
-.TEST_FOR_NON_GNUMAKE:sh=echo You are not using GNU make/gmake, this is a requirement. Check your path. 1>&2 && exit 1
+# The .FEATURES variable is likely to be unique for GNU Make.
+ifeq ($(.FEATURES), )
+  $(info Error: '$(MAKE)' does not seem to be GNU Make, which is a requirement.)
+  $(info Check your path, or upgrade to GNU Make 3.81 or newer.)
+  $(error Cannot continue)
+endif
 
-# Assume we have GNU make, but check version.
+# Assume we have GNU Make, but check version.
 ifeq ($(strip $(foreach v, 3.81% 3.82% 4.%, $(filter $v, $(MAKE_VERSION)))), )
-  $(error This version of GNU Make is too low ($(MAKE_VERSION)). Check your path, or upgrade to 3.81 or newer.)
+  $(info Error: This version of GNU Make is too low ($(MAKE_VERSION)).)
+  $(info Check your path, or upgrade to GNU Make 3.81 or newer.)
+  $(error Cannot continue)
+endif
+
+# In Cygwin, the MAKE variable gets prepended with the current directory if the
+# make executable is called using a Windows mixed path (c:/cygwin/bin/make.exe).
+ifneq ($(findstring :, $(MAKE)), )
+  MAKE := $(patsubst $(CURDIR)%, %, $(patsubst $(CURDIR)/%, %, $(MAKE)))
 endif
 
 # Locate this Makefile
-ifeq ($(filter /%,$(lastword $(MAKEFILE_LIST))),)
-  makefile_path:=$(CURDIR)/$(lastword $(MAKEFILE_LIST))
+ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))),)
+  makefile_path := $(CURDIR)/$(strip $(lastword $(MAKEFILE_LIST)))
 else
-  makefile_path:=$(lastword $(MAKEFILE_LIST))
-endif
-root_dir:=$(patsubst %/,%,$(dir $(makefile_path)))
-
-ifeq ($(MAIN_TARGETS), )
-  COMMAND_LINE_VARIABLES:=$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var))))))
-  MAKE_CONTROL_VARIABLES:=LOG CONF SPEC JOBS TEST IGNORE_OLD_CONFIG
-  UNKNOWN_COMMAND_LINE_VARIABLES:=$(strip $(filter-out $(MAKE_CONTROL_VARIABLES), $(COMMAND_LINE_VARIABLES)))
-  ifneq ($(UNKNOWN_COMMAND_LINE_VARIABLES), )
-    $(info Note: Command line contains non-control variables: $(UNKNOWN_COMMAND_LINE_VARIABLES).)
-    $(info Make sure it is not mistyped, and that you intend to override this variable.)
-    $(info 'make help' will list known control variables)
-  endif
-endif
-
-ifneq ($(findstring qp,$(MAKEFLAGS)),)
-  # When called with -qp, assume an external part (e.g. bash completion) is trying
-  # to understand our targets.
-  # Duplication of global targets, needed before ParseConfAndSpec in case we have
-  # no configurations.
-  help:
-  # If both CONF and SPEC are unset, look for all available configurations by
-  # setting CONF to the empty string.
-  ifeq ($(SPEC), )
-    CONF?=
-  endif
+  makefile_path := $(lastword $(MAKEFILE_LIST))
 endif
-
-# ... and then we can include our helper functions
-include $(root_dir)/make/MakeHelpers.gmk
-
-$(eval $(call ParseLogLevel))
-$(eval $(call ParseConfAndSpec))
-
-# Now determine if we have zero, one or several configurations to build.
-ifeq ($(SPEC),)
-  # Since we got past ParseConfAndSpec, we must be building a global target. Do nothing.
-else
-  # In Cygwin, the MAKE variable gets messed up if the make executable is called with
-  # a Windows mixed path (c:/cygwin/bin/make.exe). If that's the case, fix it by removing
-  # the prepended root_dir.
-  ifneq ($(findstring :, $(MAKE)), )
-    MAKE := $(patsubst $(root_dir)%, %, $(MAKE))
-  endif
-
-  # We are potentially building multiple configurations.
-  # First, find out the valid targets
-  # Run the makefile with an arbitrary SPEC using -p -q (quiet dry-run and dump rules) to find
-  # available PHONY targets. Use this list as valid targets to pass on to the repeated calls.
-  all_phony_targets := $(sort $(filter-out $(global_targets), $(strip $(shell \
-      cd $(root_dir)/make && $(MAKE) -f Main.gmk -p -q FRC SPEC=$(firstword $(SPEC)) \
-      -I $(root_dir)/make/common | grep "^.PHONY:" | head -n 1 | cut -d " " -f 2-))))
-
-  # Loop through the configurations and call the main-wrapper for each one. The wrapper
-  # target will execute with a single configuration loaded.
-  $(all_phony_targets):
-	@$(if $(TARGET_RUN),,\
-          $(foreach spec,$(SPEC),\
-            (cd $(root_dir) && $(MAKE) SPEC=$(spec) MAIN_TARGETS="$(call GetRealTarget)" \
-	    $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) main-wrapper) &&) true)
-	@echo > /dev/null
-	$(eval TARGET_RUN=true)
-
-  .PHONY: $(all_phony_targets)
-
-  ifneq ($(MAIN_TARGETS), )
-    # The wrapper target was called so we now have a single configuration. Load the spec file
-    # and call the real Main.gmk.
-    include $(SPEC)
-    include $(SRC_ROOT)/make/common/MakeBase.gmk
+topdir := $(strip $(patsubst %/, %, $(dir $(makefile_path))))
 
-    ### Clean up from previous run
-    # Remove any build.log from a previous run, if they exist
-    ifneq (,$(BUILD_LOG))
-      ifneq (,$(BUILD_LOG_PREVIOUS))
-        # Rotate old log
-        $(shell $(RM) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
-        $(shell $(MV) $(BUILD_LOG) $(BUILD_LOG_PREVIOUS) 2> /dev/null)
-      else
-        $(shell $(RM) $(BUILD_LOG) 2> /dev/null)
-      endif
-      $(shell $(RM) $(OUTPUT_ROOT)/build-trace-time.log 2> /dev/null)
-    endif
-    # Remove any javac server logs and port files. This
-    # prevents a new make run to reuse the previous servers.
-    ifneq (,$(SJAVAC_SERVER_DIR))
-      $(shell $(MKDIR) -p $(SJAVAC_SERVER_DIR) && $(RM) -rf $(SJAVAC_SERVER_DIR)/*)
-    endif
-
-    # Split out the targets requiring sequential execution. Run these targets separately
-    # from the rest so that the rest may still enjoy full parallel execution.
-    SEQUENTIAL_TARGETS := $(filter dist-clean clean% reconfigure, $(MAIN_TARGETS))
-    PARALLEL_TARGETS := $(filter-out $(SEQUENTIAL_TARGETS), $(MAIN_TARGETS))
-
-    main-wrapper:
-        ifneq ($(SEQUENTIAL_TARGETS), )
-	  (cd $(SRC_ROOT)/make && $(MAKE) -f Main.gmk SPEC=$(SPEC) -j 1 \
-	      $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(SEQUENTIAL_TARGETS))
-        endif
-        ifneq ($(PARALLEL_TARGETS), )
-	  @$(call AtMakeStart)
-	  (cd $(SRC_ROOT)/make && $(BUILD_LOG_WRAPPER) $(MAKE) -f Main.gmk SPEC=$(SPEC) -j $(JOBS) \
-	      $(VERBOSE) VERBOSE=$(VERBOSE) LOG_LEVEL=$(LOG_LEVEL) $(PARALLEL_TARGETS) \
-	      $(if $(filter true, $(OUTPUT_SYNC_SUPPORTED)), -O$(OUTPUT_SYNC)))
-	  @$(call AtMakeEnd)
-        endif
-
-     .PHONY: main-wrapper
-
-   endif
-endif
-
-# Here are "global" targets, i.e. targets that can be executed without specifying a single configuration.
-# If you add more global targets, please update the variable global_targets in MakeHelpers.
-
-# Helper macro to allow $(info) to properly print strings beginning with spaces.
-_:=
-
-help:
-	$(info )
-	$(info OpenJDK Makefile help)
-	$(info =====================)
-	$(info )
-	$(info Common make targets)
-	$(info $(_) make [default]         # Compile all modules in langtools, hotspot, jdk, jaxws,)
-	$(info $(_)                        # jaxp and corba, and create a runnable "exploded" image)
-	$(info $(_) make all               # Compile everything, all repos, docs and images)
-	$(info $(_) make images            # Create complete j2sdk and j2re images)
-	$(info $(_) make <phase>           # Build the specified phase and everything it depends on)
-	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
-	$(info $(_) make *-only            # Applies to most targets and disables compling the)
-	$(info $(_)                        # dependencies for the target. This is faster but may)
-	$(info $(_)                        # result in incorrect build results!)
-	$(info $(_) make docs              # Create all docs)
-	$(info $(_) make docs-javadoc      # Create just javadocs, depends on less than full docs)
-	$(info $(_) make profiles          # Create complete j2re compact profile images)
-	$(info $(_) make bootcycle-images  # Build images twice, second time with newly built JDK)
-	$(info $(_) make install           # Install the generated images locally)
-	$(info $(_) make reconfigure       # Rerun configure with the same arguments as last time)
-	$(info $(_) make help              # Give some help on using make)
-	$(info $(_) make test              # Run tests, default is all tests (see TEST below))
-	$(info )
-	$(info Targets for cleaning)
-	$(info $(_) make clean             # Remove all files generated by make, but not those)
-	$(info $(_)                        # generated by configure)
-	$(info $(_) make dist-clean        # Remove all files, including configuration)
-	$(info $(_) make clean-<outputdir> # Remove the subdir in the output dir with the name)
-	$(info $(_) make clean-<phase>     # Remove all build results related to a certain build)
-	$(info $(_)                        # phase (gensrc, java, libs, launchers))
-	$(info $(_) make clean-<module>    # Remove all build results related to a certain module)
-	$(info $(_) make clean-<module>-<phase> # Remove all build results related to a certain)
-	$(info $(_)                        # module and phase)
-	$(info )
-	$(info Targets for specific modules)
-	$(info $(_) make <module>          # Build <module> and everything it depends on.)
-	$(info $(_) make <module>-<phase>  # Compile the specified phase for the specified module)
-	$(info $(_)                        # and everything it depends on)
-	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
-	$(info )
-	$(info Make control variables)
-	$(info $(_) CONF=                  # Build all configurations (note, assignment is empty))
-	$(info $(_) CONF=<substring>       # Build the configuration(s) with a name matching)
-	$(info $(_)                        # <substring>)
-	$(info $(_) SPEC=<spec file>       # Build the configuration given by the spec file)
-	$(info $(_) LOG=<loglevel>         # Change the log level from warn to <loglevel>)
-	$(info $(_)                        # Available log levels are:)
-	$(info $(_)                        # 'warn' (default), 'info', 'debug' and 'trace')
-	$(info $(_)                        # To see executed command lines, use LOG=debug)
-	$(info $(_) JOBS=<n>               # Run <n> parallel make jobs)
-	$(info $(_)                        # Note that -jN does not work as expected!)
-	$(info $(_) IGNORE_OLD_CONFIG=true # Skip tests if spec file is up to date)
-	$(info $(_) make test TEST=<test>  # Only run the given test or tests, e.g.)
-	$(info $(_)                        # make test TEST="jdk_lang jdk_net")
-	$(info )
-
-.PHONY: help
+# ... and then we can include the real makefile
+include $(topdir)/make/Init.gmk
--- a/common/autoconf/basics.m4	Wed Apr 08 13:12:48 2015 -0700
+++ b/common/autoconf/basics.m4	Wed Jul 05 20:27:20 2017 +0200
@@ -78,7 +78,7 @@
 AC_DEFUN([BASIC_FIXUP_PATH],
 [
   # Only process if variable expands to non-empty
-  
+
   if test "x[$]$1" != x; then
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
       BASIC_FIXUP_PATH_CYGWIN($1)
@@ -118,7 +118,7 @@
 AC_DEFUN([BASIC_FIXUP_EXECUTABLE],
 [
   # Only process if variable expands to non-empty
-  
+
   if test "x[$]$1" != x; then
     if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
       BASIC_FIXUP_EXECUTABLE_CYGWIN($1)
@@ -459,12 +459,21 @@
   AC_MSG_RESULT([$TOPDIR])
   AC_SUBST(TOPDIR)
 
+  # Save the original version of TOPDIR for string comparisons
+  ORIGINAL_TOPDIR="$TOPDIR"
+  AC_SUBST(ORIGINAL_TOPDIR)
+
   # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
   BASIC_FIXUP_PATH(CURDIR)
   BASIC_FIXUP_PATH(TOPDIR)
   # SRC_ROOT is a traditional alias for TOPDIR.
   SRC_ROOT=$TOPDIR
 
+  # Calculate a canonical version of TOPDIR for string comparisons
+  CANONICAL_TOPDIR=$TOPDIR
+  BASIC_REMOVE_SYMBOLIC_LINKS([CANONICAL_TOPDIR])
+  AC_SUBST(CANONICAL_TOPDIR)
+
   # Locate the directory of this script.
   AUTOCONF_DIR=$TOPDIR/common/autoconf
 ])
@@ -709,18 +718,6 @@
   AC_CONFIG_FILES([$OUTPUT_ROOT/Makefile:$AUTOCONF_DIR/Makefile.in])
 ])
 
-AC_DEFUN_ONCE([BASIC_SETUP_LOGGING],
-[
-  # Setup default logging of stdout and stderr to build.log in the output root.
-  BUILD_LOG='$(OUTPUT_ROOT)/build.log'
-  BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old'
-  BUILD_LOG_WRAPPER='$(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
-  AC_SUBST(BUILD_LOG)
-  AC_SUBST(BUILD_LOG_PREVIOUS)
-  AC_SUBST(BUILD_LOG_WRAPPER)
-])
-
-
 #%%% Simple tools %%%
 
 # Check if we have found a usable version of make
--- a/common/autoconf/configure.ac	Wed Apr 08 13:12:48 2015 -0700
+++ b/common/autoconf/configure.ac	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -88,7 +88,6 @@
 
 # Continue setting up basic stuff. Most remaining code require fundamental tools.
 BASIC_SETUP_PATHS
-BASIC_SETUP_LOGGING
 
 # Check if it's a pure open build or if custom sources are to be used.
 JDKOPT_SETUP_OPEN_OR_CUSTOM
--- a/common/autoconf/generated-configure.sh	Wed Apr 08 13:12:48 2015 -0700
+++ b/common/autoconf/generated-configure.sh	Wed Jul 05 20:27:20 2017 +0200
@@ -907,9 +907,8 @@
 JVM_INTERPRETER
 JDK_VARIANT
 SET_OPENJDK
-BUILD_LOG_WRAPPER
-BUILD_LOG_PREVIOUS
-BUILD_LOG
+CANONICAL_TOPDIR
+ORIGINAL_TOPDIR
 TOPDIR
 PATH_SEP
 ZERO_ARCHDEF
@@ -3471,9 +3470,6 @@
 
 
 
-
-
-
 #%%% Simple tools %%%
 
 # Check if we have found a usable version of make
@@ -14141,6 +14137,10 @@
 $as_echo "$TOPDIR" >&6; }
 
 
+  # Save the original version of TOPDIR for string comparisons
+  ORIGINAL_TOPDIR="$TOPDIR"
+
+
   # We can only call BASIC_FIXUP_PATH after BASIC_CHECK_PATHS_WINDOWS.
 
   # Only process if variable expands to non-empty
@@ -14397,19 +14397,62 @@
   # SRC_ROOT is a traditional alias for TOPDIR.
   SRC_ROOT=$TOPDIR
 
+  # Calculate a canonical version of TOPDIR for string comparisons
+  CANONICAL_TOPDIR=$TOPDIR
+
+  if test "x$OPENJDK_BUILD_OS" != xwindows; then
+    # Follow a chain of symbolic links. Use readlink
+    # where it exists, else fall back to horribly
+    # complicated shell code.
+    if test "x$READLINK_TESTED" != yes; then
+      # On MacOSX there is a readlink tool with a different
+      # purpose than the GNU readlink tool. Check the found readlink.
+      ISGNU=`$READLINK --version 2>&1 | $GREP GNU`
+      if test "x$ISGNU" = x; then
+        # A readlink that we do not know how to use.
+        # Are there other non-GNU readlinks out there?
+        READLINK_TESTED=yes
+        READLINK=
+      fi
+    fi
+
+    if test "x$READLINK" != x; then
+      CANONICAL_TOPDIR=`$READLINK -f $CANONICAL_TOPDIR`
+    else
+      # Save the current directory for restoring afterwards
+      STARTDIR=$PWD
+      COUNTER=0
+      sym_link_dir=`$DIRNAME $CANONICAL_TOPDIR`
+      sym_link_file=`$BASENAME $CANONICAL_TOPDIR`
+      cd $sym_link_dir
+      # Use -P flag to resolve symlinks in directories.
+      cd `$THEPWDCMD -P`
+      sym_link_dir=`$THEPWDCMD -P`
+      # Resolve file symlinks
+      while test $COUNTER -lt 20; do
+        ISLINK=`$LS -l $sym_link_dir/$sym_link_file | $GREP '\->' | $SED -e 's/.*-> \(.*\)/\1/'`
+        if test "x$ISLINK" == x; then
+          # This is not a symbolic link! We are done!
+          break
+        fi
+        # Again resolve directory symlinks since the target of the just found
+        # link could be in a different directory
+        cd `$DIRNAME $ISLINK`
+        sym_link_dir=`$THEPWDCMD -P`
+        sym_link_file=`$BASENAME $ISLINK`
+        let COUNTER=COUNTER+1
+      done
+      cd $STARTDIR
+      CANONICAL_TOPDIR=$sym_link_dir/$sym_link_file
+    fi
+  fi
+
+
+
   # Locate the directory of this script.
   AUTOCONF_DIR=$TOPDIR/common/autoconf
 
 
-  # Setup default logging of stdout and stderr to build.log in the output root.
-  BUILD_LOG='$(OUTPUT_ROOT)/build.log'
-  BUILD_LOG_PREVIOUS='$(OUTPUT_ROOT)/build.log.old'
-  BUILD_LOG_WRAPPER='$(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)'
-
-
-
-
-
 # Check if it's a pure open build or if custom sources are to be used.
 
   # Check whether --enable-openjdk-only was given.
--- a/common/autoconf/spec.gmk.in	Wed Apr 08 13:12:48 2015 -0700
+++ b/common/autoconf/spec.gmk.in	Wed Jul 05 20:27:20 2017 +0200
@@ -55,25 +55,12 @@
 # A self-referential reference to this file.
 SPEC:=@SPEC@
 
-# Specify where the spec file is.
-MAKE_ARGS="SPEC=$(SPEC)"
-
-MAKE:=@MAKE@
-
-# Pass along the verbosity and log level settings.
-ifeq (,$(findstring VERBOSE=,$(MAKE)))
-  MAKE:=$(MAKE) $(VERBOSE) VERBOSE="$(VERBOSE)" LOG_LEVEL="$(LOG_LEVEL)"
-endif
+# What make to use for main processing, after bootstrapping top-level Makefile.
+MAKE := @MAKE@
 
-# No implicit variables or rules!
-ifeq (,$(findstring -R,$(MAKE)))
-  MAKE:=$(MAKE) -R
-endif
-
-# Specify where the common include directory for makefiles is.
-ifeq (,$(findstring -I @TOPDIR@/make/common,$(MAKE)))
-  MAKE:=$(MAKE) -I @TOPDIR@/make/common
-endif
+# The default make arguments
+MAKE_ARGS = $(MAKE_LOG_FLAGS) -R -I $(TOPDIR)/make/common SPEC=$(SPEC) \
+    MAKE_LOG_FLAGS="$(MAKE_LOG_FLAGS)" LOG_LEVEL=$(LOG_LEVEL)
 
 OUTPUT_SYNC_SUPPORTED:=@OUTPUT_SYNC_SUPPORTED@
 OUTPUT_SYNC:=@OUTPUT_SYNC@
@@ -146,6 +133,9 @@
 
 # The top-level directory of the forest (SRC_ROOT is a traditional alias)
 TOPDIR:=@TOPDIR@
+# These two versions of TOPDIR are used in string comparisons
+ORIGINAL_TOPDIR:=@ORIGINAL_TOPDIR@
+CANONICAL_TOPDIR:=@CANONICAL_TOPDIR@
 SRC_ROOT:=@TOPDIR@
 
 OUTPUT_ROOT:=@OUTPUT_ROOT@
@@ -573,18 +563,6 @@
 XCODEBUILD=@XCODEBUILD@
 FIXPATH:=@FIXPATH@
 
-# Where the build output is stored for your convenience.
-BUILD_LOG:=@BUILD_LOG@
-BUILD_LOG_PREVIOUS:=@BUILD_LOG_PREVIOUS@
-# Disable the build log wrapper on sjavac+windows until
-# we have solved how to prevent the log wrapper to wait
-# for the background sjavac server process.
-ifeq (@ENABLE_SJAVAC@X@OPENJDK_BUILD_OS@,yesXwindows)
-  BUILD_LOG_WRAPPER:=
-else
-  BUILD_LOG_WRAPPER:=@BUILD_LOG_WRAPPER@
-endif
-
 # Build setup
 ENABLE_JFR=@ENABLE_JFR@
 ENABLE_INTREE_EC=@ENABLE_INTREE_EC@
--- a/configure	Wed Apr 08 13:12:48 2015 -0700
+++ b/configure	Wed Jul 05 20:27:20 2017 +0200
@@ -31,4 +31,5 @@
 
 # Delegate to wrapper, forcing wrapper to believe $0 is this script by using -c.
 # This trick is needed to get autoconf to co-operate properly.
-bash -c ". $this_script_dir/common/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@"
+# The ${-:+-$-} construction passes on bash options.
+bash ${-:+-$-} -c ". $this_script_dir/common/autoconf/configure" $this_script_dir/configure CHECKME $this_script_dir "$@"
--- a/corba/.hgtags	Wed Apr 08 13:12:48 2015 -0700
+++ b/corba/.hgtags	Wed Jul 05 20:27:20 2017 +0200
@@ -300,3 +300,4 @@
 734ca5311a225711b79618f3e92f47f07c82154a jdk9-b55
 ef4afd6832b00b8687832c2a36c90e43750ebe40 jdk9-b56
 d8ebf1a5b18ccbc849f5bf0f80aa3d78583eee68 jdk9-b57
+86dd5de1f5cb09073019bd629e22cfcd012d8b4b jdk9-b58
--- a/hotspot/.hgtags	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/.hgtags	Wed Jul 05 20:27:20 2017 +0200
@@ -460,3 +460,4 @@
 be49ab55e5c498c5077bbf58c2737100d1992339 jdk9-b55
 fd2d5ec7e7b16c7bf4043a7fe7cfd8af96b819e2 jdk9-b56
 56a85ffe743d3f9d70ba25d6ce82ddd2ad1bf33c jdk9-b57
+ee878f3d6732856f7725c590312bfbe2ffa52cc7 jdk9-b58
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java	Wed Jul 05 20:27:20 2017 +0200
@@ -123,6 +123,7 @@
 
   private static Type intxType;
   private static Type uintxType;
+  private static Type sizetType;
   private static CIntegerType boolType;
   private Boolean sharingEnabled;
   private Boolean compressedOopsEnabled;
@@ -175,7 +176,7 @@
 
      public long getIntx() {
         if (Assert.ASSERTS_ENABLED) {
-           Assert.that(isIntx(), "not a intx flag!");
+           Assert.that(isIntx(), "not an intx flag!");
         }
         return addr.getCIntegerAt(0, intxType.getSize(), false);
      }
@@ -191,6 +192,17 @@
         return addr.getCIntegerAt(0, uintxType.getSize(), true);
      }
 
+     public boolean isSizet() {
+        return type.equals("size_t");
+     }
+
+     public long getSizet() {
+        if (Assert.ASSERTS_ENABLED) {
+           Assert.that(isSizet(), "not a size_t flag!");
+        }
+        return addr.getCIntegerAt(0, sizetType.getSize(), true);
+     }
+
      public String getValue() {
         if (isBool()) {
            return new Boolean(getBool()).toString();
@@ -198,6 +210,8 @@
            return new Long(getIntx()).toString();
         } else if (isUIntx()) {
            return new Long(getUIntx()).toString();
+        } else if (isSizet()) {
+            return new Long(getSizet()).toString();
         } else {
            return null;
         }
@@ -323,6 +337,7 @@
 
     intxType = db.lookupType("intx");
     uintxType = db.lookupType("uintx");
+    sizetType = db.lookupType("size_t");
     boolType = (CIntegerType) db.lookupType("bool");
 
     minObjAlignmentInBytes = getObjectAlignmentInBytes();
--- a/hotspot/make/linux/makefiles/gcc.make	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/make/linux/makefiles/gcc.make	Wed Jul 05 20:27:20 2017 +0200
@@ -207,7 +207,7 @@
   WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
 endif
 
-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type
+WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type -Woverloaded-virtual
 
 ifeq ($(USE_CLANG),)
   # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
--- a/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/stubGenerator_aarch64.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -673,7 +673,6 @@
   void  gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       // With G1, don't generate the call if we statically know that the target in uninitialized
       if (!dest_uninitialized) {
@@ -719,7 +718,6 @@
     assert_different_registers(start, end, scratch);
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
 
         {
--- a/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/aarch64/vm/templateTable_aarch64.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2014, Red Hat Inc. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -150,7 +150,6 @@
   assert(val == noreg || val == r0, "parameter is just for looks");
   switch (barrier) {
 #if INCLUDE_ALL_GCS
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       {
         // flatten object address if needed
--- a/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/c2_globals_ppc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2014 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -49,7 +49,7 @@
 define_pd_global(intx, MinJumpTableSize,             10);
 define_pd_global(intx, INTPRESSURE,                  25);
 define_pd_global(intx, InteriorEntryAlignment,       16);
-define_pd_global(intx, NewSizeThreadIncrease,        ScaleForWordSize(4*K));
+define_pd_global(size_t, NewSizeThreadIncrease,      ScaleForWordSize(4*K));
 define_pd_global(intx, RegisterCostAreaRatio,        16000);
 define_pd_global(bool, UseTLAB,                      true);
 define_pd_global(bool, ResizeTLAB,                   true);
@@ -85,14 +85,14 @@
 define_pd_global(intx, CodeCacheExpansionSize,       64*K);
 
 // Ergonomics related flags
-define_pd_global(uint64_t,MaxRAM,                    4ULL*G);
+define_pd_global(uint64_t, MaxRAM,                   4ULL*G);
 define_pd_global(uintx, CodeCacheMinBlockLength,     4);
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
 
 define_pd_global(bool,  TrapBasedRangeChecks,        true);
 
 // Heap related flags
-define_pd_global(uintx,MetaspaceSize,                ScaleForWordSize(16*M));
+define_pd_global(size_t, MetaspaceSize,              ScaleForWordSize(16*M));
 
 // Ergonomics related flags
 define_pd_global(bool, NeverActAsServerClassMachine, false);
--- a/hotspot/src/cpu/ppc/vm/globals_ppc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/globals_ppc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2013 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -56,7 +56,7 @@
 define_pd_global(bool, UseMembar,             false);
 
 // GC Ergo Flags
-define_pd_global(uintx, CMSYoungGenPerWorker, 16*M);  // Default max size of CMS young gen, per GC worker thread.
+define_pd_global(size_t, CMSYoungGenPerWorker, 16*M);  // Default max size of CMS young gen, per GC worker thread.
 
 define_pd_global(uintx, TypeProfileLevel, 0);
 
--- a/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/stubGenerator_ppc.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -608,7 +608,6 @@
   void gen_write_ref_array_pre_barrier(Register from, Register to, Register count, bool dest_uninitialized, Register Rtmp1) {
     BarrierSet* const bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         // With G1, don't generate the call if we statically know that the target in uninitialized
         if (!dest_uninitialized) {
@@ -665,7 +664,6 @@
     BarrierSet* const bs = Universe::heap()->barrier_set();
 
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         {
           if (branchToEnd) {
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -66,7 +66,6 @@
 
   switch (barrier) {
 #if INCLUDE_ALL_GCS
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       {
         // Load and record the previous value.
--- a/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/c1_globals_sparc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,10 +53,10 @@
 define_pd_global(intx, CodeCacheExpansionSize,       32*K );
 define_pd_global(uintx, CodeCacheMinBlockLength,     1);
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
-define_pd_global(uintx, MetaspaceSize,               12*M );
+define_pd_global(size_t, MetaspaceSize,              12*M );
 define_pd_global(bool, NeverActAsServerClassMachine, true );
-define_pd_global(intx, NewSizeThreadIncrease,        16*K );
-define_pd_global(uint64_t,MaxRAM,                    1ULL*G);
+define_pd_global(size_t, NewSizeThreadIncrease,      16*K );
+define_pd_global(uint64_t, MaxRAM,                   1ULL*G);
 define_pd_global(intx, InitialCodeCacheSize,         160*K);
 #endif // !TIERED
 
--- a/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/c2_globals_sparc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@
 define_pd_global(intx, FreqInlineSize,               175);
 define_pd_global(intx, INTPRESSURE,                  48);  // large register set
 define_pd_global(intx, InteriorEntryAlignment,       16);  // = CodeEntryAlignment
-define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K));
+define_pd_global(size_t, NewSizeThreadIncrease,      ScaleForWordSize(4*K));
 define_pd_global(intx, RegisterCostAreaRatio,        12000);
 define_pd_global(bool, UseTLAB,                      true);
 define_pd_global(bool, ResizeTLAB,                   true);
@@ -90,7 +90,7 @@
 define_pd_global(intx, NonNMethodCodeHeapSize,       5*M );
 define_pd_global(intx, CodeCacheExpansionSize,       32*K);
 // Ergonomics related flags
-define_pd_global(uint64_t,MaxRAM,                    4ULL*G);
+define_pd_global(uint64_t, MaxRAM,                   4ULL*G);
 #endif
 define_pd_global(uintx, CodeCacheMinBlockLength,     4);
 define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
@@ -98,7 +98,7 @@
 define_pd_global(bool,  TrapBasedRangeChecks,        false); // Not needed on sparc.
 
 // Heap related flags
-define_pd_global(uintx,MetaspaceSize,    ScaleForWordSize(16*M));
+define_pd_global(size_t, MetaspaceSize,              ScaleForWordSize(16*M));
 
 // Ergonomics related flags
 define_pd_global(bool, NeverActAsServerClassMachine, false);
--- a/hotspot/src/cpu/sparc/vm/globals_sparc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/globals_sparc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -75,7 +75,7 @@
 define_pd_global(bool, UseMembar,            false);
 
 // GC Ergo Flags
-define_pd_global(uintx, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
+define_pd_global(size_t, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
 
 define_pd_global(uintx, TypeProfileLevel, 0);
 
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -957,7 +957,6 @@
   void gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         // With G1, don't generate the call if we statically know that the target in uninitialized
         if (!dest_uninitialized) {
@@ -1005,7 +1004,6 @@
     BarrierSet* bs = Universe::heap()->barrier_set();
 
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         {
           // Get some new fresh output registers.
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,6 @@
   assert(index == noreg || offset == 0, "only one offset");
   switch (barrier) {
 #if INCLUDE_ALL_GCS
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       {
         // Load and record the previous value.
--- a/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/c1_globals_x86.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,39 +32,39 @@
 // (see c1_globals.hpp)
 
 #ifndef TIERED
-define_pd_global(bool, BackgroundCompilation,        true );
-define_pd_global(bool, UseTLAB,                      true );
-define_pd_global(bool, ResizeTLAB,                   true );
-define_pd_global(bool, InlineIntrinsics,             true );
-define_pd_global(bool, PreferInterpreterNativeStubs, false);
-define_pd_global(bool, ProfileTraps,                 false);
-define_pd_global(bool, UseOnStackReplacement,        true );
-define_pd_global(bool, TieredCompilation,            false);
-define_pd_global(intx, CompileThreshold,             1500 );
+define_pd_global(bool, BackgroundCompilation,          true );
+define_pd_global(bool, UseTLAB,                        true );
+define_pd_global(bool, ResizeTLAB,                     true );
+define_pd_global(bool, InlineIntrinsics,               true );
+define_pd_global(bool, PreferInterpreterNativeStubs,   false);
+define_pd_global(bool, ProfileTraps,                   false);
+define_pd_global(bool, UseOnStackReplacement,          true );
+define_pd_global(bool, TieredCompilation,              false);
+define_pd_global(intx, CompileThreshold,               1500 );
 
-define_pd_global(intx, OnStackReplacePercentage,     933  );
-define_pd_global(intx, FreqInlineSize,               325  );
-define_pd_global(intx, NewSizeThreadIncrease,        4*K  );
-define_pd_global(intx, InitialCodeCacheSize,         160*K);
-define_pd_global(intx, ReservedCodeCacheSize,        32*M );
-define_pd_global(intx, NonProfiledCodeHeapSize,      13*M );
-define_pd_global(intx, ProfiledCodeHeapSize,         14*M );
-define_pd_global(intx, NonNMethodCodeHeapSize,       5*M  );
-define_pd_global(bool, ProfileInterpreter,           false);
-define_pd_global(intx, CodeCacheExpansionSize,       32*K );
-define_pd_global(uintx, CodeCacheMinBlockLength,     1);
-define_pd_global(uintx, CodeCacheMinimumUseSpace,    400*K);
-define_pd_global(uintx, MetaspaceSize,               12*M );
-define_pd_global(bool, NeverActAsServerClassMachine, true );
-define_pd_global(uint64_t,MaxRAM,                    1ULL*G);
-define_pd_global(bool, CICompileOSR,                 true );
+define_pd_global(intx,   OnStackReplacePercentage,     933  );
+define_pd_global(intx,   FreqInlineSize,               325  );
+define_pd_global(size_t, NewSizeThreadIncrease,        4*K  );
+define_pd_global(intx, InitialCodeCacheSize,           160*K);
+define_pd_global(intx, ReservedCodeCacheSize,          32*M );
+define_pd_global(intx, NonProfiledCodeHeapSize,        13*M );
+define_pd_global(intx, ProfiledCodeHeapSize,           14*M );
+define_pd_global(intx, NonNMethodCodeHeapSize,         5*M  );
+define_pd_global(bool,   ProfileInterpreter,           false);
+define_pd_global(intx, CodeCacheExpansionSize,         32*K );
+define_pd_global(uintx, CodeCacheMinBlockLength,       1    );
+define_pd_global(uintx, CodeCacheMinimumUseSpace,      400*K);
+define_pd_global(size_t, MetaspaceSize,                12*M );
+define_pd_global(bool,   NeverActAsServerClassMachine, true );
+define_pd_global(uint64_t, MaxRAM,                    1ULL*G);
+define_pd_global(bool,   CICompileOSR,                 true );
 #endif // !TIERED
-define_pd_global(bool, UseTypeProfile,               false);
-define_pd_global(bool, RoundFPResults,               true );
+define_pd_global(bool, UseTypeProfile,                 false);
+define_pd_global(bool, RoundFPResults,                 true );
 
-define_pd_global(bool, LIRFillDelaySlots,            false);
-define_pd_global(bool, OptimizeSinglePrecision,      true );
-define_pd_global(bool, CSEArrayLength,               false);
-define_pd_global(bool, TwoOperandLIRForm,            true );
+define_pd_global(bool, LIRFillDelaySlots,              false);
+define_pd_global(bool, OptimizeSinglePrecision,        true );
+define_pd_global(bool, CSEArrayLength,                 false);
+define_pd_global(bool, TwoOperandLIRForm,              true );
 
 #endif // CPU_X86_VM_C1_GLOBALS_X86_HPP
--- a/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/c2_globals_x86.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,25 +54,25 @@
 #ifdef AMD64
 define_pd_global(intx, INTPRESSURE,                  13);
 define_pd_global(intx, InteriorEntryAlignment,       16);
-define_pd_global(intx, NewSizeThreadIncrease, ScaleForWordSize(4*K));
+define_pd_global(size_t, NewSizeThreadIncrease,      ScaleForWordSize(4*K));
 define_pd_global(intx, LoopUnrollLimit,              60);
 // InitialCodeCacheSize derived from specjbb2000 run.
 define_pd_global(intx, InitialCodeCacheSize,         2496*K); // Integral multiple of CodeCacheExpansionSize
 define_pd_global(intx, CodeCacheExpansionSize,       64*K);
 
 // Ergonomics related flags
-define_pd_global(uint64_t,MaxRAM,                    128ULL*G);
+define_pd_global(uint64_t, MaxRAM,                   128ULL*G);
 #else
 define_pd_global(intx, INTPRESSURE,                  6);
 define_pd_global(intx, InteriorEntryAlignment,       4);
-define_pd_global(intx, NewSizeThreadIncrease,        4*K);
+define_pd_global(size_t, NewSizeThreadIncrease,      4*K);
 define_pd_global(intx, LoopUnrollLimit,              50);     // Design center runs on 1.3.1
 // InitialCodeCacheSize derived from specjbb2000 run.
 define_pd_global(intx, InitialCodeCacheSize,         2304*K); // Integral multiple of CodeCacheExpansionSize
 define_pd_global(intx, CodeCacheExpansionSize,       32*K);
 
 // Ergonomics related flags
-define_pd_global(uint64_t,MaxRAM,                    4ULL*G);
+define_pd_global(uint64_t, MaxRAM,                   4ULL*G);
 #endif // AMD64
 define_pd_global(intx, RegisterCostAreaRatio,        16000);
 
@@ -93,7 +93,7 @@
 define_pd_global(bool,  TrapBasedRangeChecks,        false); // Not needed on x86.
 
 // Heap related flags
-define_pd_global(uintx,MetaspaceSize,    ScaleForWordSize(16*M));
+define_pd_global(size_t, MetaspaceSize,              ScaleForWordSize(16*M));
 
 // Ergonomics related flags
 define_pd_global(bool, NeverActAsServerClassMachine, false);
--- a/hotspot/src/cpu/x86/vm/globals_x86.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/globals_x86.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -78,7 +78,7 @@
 #endif
 
 // GC Ergo Flags
-define_pd_global(uintx, CMSYoungGenPerWorker, 64*M);  // default max size of CMS young gen, per GC worker thread
+define_pd_global(size_t, CMSYoungGenPerWorker, 64*M);  // default max size of CMS young gen, per GC worker thread
 
 define_pd_global(uintx, TypeProfileLevel, 111);
 
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_32.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -706,7 +706,6 @@
     assert_different_registers(start, count);
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         // With G1, don't generate the call if we statically know that the target in uninitialized
         if (!uninitialized_target) {
@@ -739,7 +738,6 @@
     BarrierSet* bs = Universe::heap()->barrier_set();
     assert_different_registers(start, count);
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         {
           __ pusha();                      // push registers
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1207,7 +1207,6 @@
   void  gen_write_ref_array_pre_barrier(Register addr, Register count, bool dest_uninitialized) {
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         // With G1, don't generate the call if we statically know that the target in uninitialized
         if (!dest_uninitialized) {
@@ -1252,7 +1251,6 @@
     assert_different_registers(start, count, scratch);
     BarrierSet* bs = Universe::heap()->barrier_set();
     switch (bs->kind()) {
-      case BarrierSet::G1SATBCT:
       case BarrierSet::G1SATBCTLogging:
         {
           __ pusha();             // push registers (overkill)
--- a/hotspot/src/cpu/x86/vm/templateTable_x86.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -156,7 +156,6 @@
   assert(val == noreg || val == rax, "parameter is just for looks");
   switch (barrier) {
 #if INCLUDE_ALL_GCS
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       {
         // flatten object address if needed
--- a/hotspot/src/cpu/zero/vm/globals_zero.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/zero/vm/globals_zero.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -57,7 +57,7 @@
 define_pd_global(bool,  UseMembar,            true);
 
 // GC Ergo Flags
-define_pd_global(uintx, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
+define_pd_global(size_t, CMSYoungGenPerWorker, 16*M);  // default max size of CMS young gen, per GC worker thread
 
 define_pd_global(uintx, TypeProfileLevel, 0);
 
--- a/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/cpu/zero/vm/shark_globals_zero.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2008, 2009, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -50,7 +50,7 @@
 define_pd_global(intx,     OnStackReplacePercentage,     933  );
 define_pd_global(intx,     FreqInlineSize,               325  );
 define_pd_global(uintx,    NewRatio,                     12   );
-define_pd_global(intx,     NewSizeThreadIncrease,        4*K  );
+define_pd_global(size_t,   NewSizeThreadIncrease,        4*K  );
 define_pd_global(intx,     InitialCodeCacheSize,         160*K);
 define_pd_global(intx,     ReservedCodeCacheSize,        32*M );
 define_pd_global(intx,     NonProfiledCodeHeapSize,      13*M );
@@ -61,7 +61,7 @@
 define_pd_global(uintx,    CodeCacheMinBlockLength,      1    );
 define_pd_global(uintx,    CodeCacheMinimumUseSpace,     200*K);
 
-define_pd_global(uintx,    MetaspaceSize,                12*M );
+define_pd_global(size_t,   MetaspaceSize,                12*M );
 define_pd_global(bool,     NeverActAsServerClassMachine, true );
 define_pd_global(uint64_t, MaxRAM,                       1ULL*G);
 define_pd_global(bool,     CICompileOSR,                 true );
--- a/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/aix_ppc/vm/globals_aix_ppc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -40,13 +40,13 @@
 define_pd_global(intx, CompilerThreadStackSize,  4096);
 
 // Allow extra space in DEBUG builds for asserts.
-define_pd_global(uintx,JVMInvokeMethodSlack,     8192);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8192);
 
 define_pd_global(intx, StackYellowPages,         6);
 define_pd_global(intx, StackRedPages,            1);
 define_pd_global(intx, StackShadowPages,         6 DEBUG_ONLY(+2));
 
 // Only used on 64 bit platforms
-define_pd_global(uintx,HeapBaseMinAddress,       2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_AIX_OJDKPPC_VM_GLOBALS_AIX_PPC_HPP
--- a/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/bsd_x86/vm/globals_bsd_x86.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,9 +43,9 @@
 
 define_pd_global(intx, CompilerThreadStackSize,  0);
 
-define_pd_global(uintx, JVMInvokeMethodSlack,    8192);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8192);
 
 // Used on 64 bit platforms for UseCompressedOops base address
-define_pd_global(uintx, HeapBaseMinAddress,      2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_BSD_X86_VM_GLOBALS_BSD_X86_HPP
--- a/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/bsd_zero/vm/globals_bsd_zero.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -39,9 +39,9 @@
 define_pd_global(intx,  VMThreadStackSize,       512);
 #endif // _LP64
 define_pd_global(intx,  CompilerThreadStackSize, 0);
-define_pd_global(uintx, JVMInvokeMethodSlack,    8192);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8192);
 
 // Used on 64 bit platforms for UseCompressedOops base address
-define_pd_global(uintx, HeapBaseMinAddress,      2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_BSD_ZERO_VM_GLOBALS_BSD_ZERO_HPP
--- a/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/linux_aarch64/vm/os_linux_aarch64.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -116,6 +116,14 @@
 #endif
 }
 
+void os::Linux::ucontext_set_pc(ucontext_t * uc, address pc) {
+#ifdef BUILTIN_SIM
+  uc->uc_mcontext.gregs[REG_PC] = (intptr_t)pc;
+#else
+  uc->uc_mcontext.pc = (intptr_t)pc;
+#endif
+}
+
 intptr_t* os::Linux::ucontext_get_sp(ucontext_t * uc) {
 #ifdef BUILTIN_SIM
   return (intptr_t*)uc->uc_mcontext.gregs[REG_SP];
@@ -311,7 +319,7 @@
     }
 #else
     if (StubRoutines::is_safefetch_fault(pc)) {
-      uc->uc_mcontext.pc = intptr_t(StubRoutines::continuation_for_safefetch_fault(pc));
+      os::Linux::ucontext_set_pc(uc, StubRoutines::continuation_for_safefetch_fault(pc));
       return 1;
     }
 #endif
@@ -432,11 +440,7 @@
     // save all thread context in case we need to restore it
     if (thread != NULL) thread->set_saved_exception_pc(pc);
 
-#ifdef BUILTIN_SIM
-    uc->uc_mcontext.gregs[REG_PC] = (greg_t)stub;
-#else
-    uc->uc_mcontext.pc = (__u64)stub;
-#endif
+    os::Linux::ucontext_set_pc(uc, stub);
     return true;
   }
 
--- a/hotspot/src/os_cpu/linux_ppc/vm/globals_linux_ppc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/linux_ppc/vm/globals_linux_ppc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -40,13 +40,13 @@
 define_pd_global(intx, CompilerThreadStackSize,  4096);
 
 // Allow extra space in DEBUG builds for asserts.
-define_pd_global(uintx,JVMInvokeMethodSlack,     8192);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8192);
 
 define_pd_global(intx, StackYellowPages,         6);
 define_pd_global(intx, StackRedPages,            1);
 define_pd_global(intx, StackShadowPages,         6 DEBUG_ONLY(+2));
 
 // Only used on 64 bit platforms
-define_pd_global(uintx,HeapBaseMinAddress,       2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_LINUX_PPC_VM_GLOBALS_LINUX_PPC_HPP
--- a/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/linux_sparc/vm/globals_linux_sparc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,10 +30,10 @@
 // runtime system.  (see globals.hpp)
 //
 
-define_pd_global(uintx, JVMInvokeMethodSlack,    12288);
+define_pd_global(size_t, JVMInvokeMethodSlack,   12288);
 define_pd_global(intx, CompilerThreadStackSize,  0);
 
 // Used on 64 bit platforms for UseCompressedOops base address
-define_pd_global(uintx, HeapBaseMinAddress,      CONST64(4)*G);
+define_pd_global(size_t, HeapBaseMinAddress,     CONST64(4)*G);
 
 #endif // OS_CPU_LINUX_SPARC_VM_GLOBALS_LINUX_SPARC_HPP
--- a/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/linux_x86/vm/globals_linux_x86.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,9 +42,9 @@
 
 define_pd_global(intx, CompilerThreadStackSize,  0);
 
-define_pd_global(uintx,JVMInvokeMethodSlack,     8192);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8192);
 
 // Used on 64 bit platforms for UseCompressedOops base address
-define_pd_global(uintx,HeapBaseMinAddress,       2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_LINUX_X86_VM_GLOBALS_LINUX_X86_HPP
--- a/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/linux_zero/vm/globals_linux_zero.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2010 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -39,9 +39,9 @@
 define_pd_global(intx,  VMThreadStackSize,       512);
 #endif // _LP64
 define_pd_global(intx,  CompilerThreadStackSize, 0);
-define_pd_global(uintx, JVMInvokeMethodSlack,    8192);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8192);
 
 // Used on 64 bit platforms for UseCompressedOops base address
-define_pd_global(uintx, HeapBaseMinAddress,      2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_LINUX_ZERO_VM_GLOBALS_LINUX_ZERO_HPP
--- a/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/solaris_sparc/vm/globals_solaris_sparc.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,16 +30,16 @@
 // (see globals.hpp)
 //
 
-define_pd_global(uintx, JVMInvokeMethodSlack,    12288);
+define_pd_global(size_t, JVMInvokeMethodSlack,   12288);
 define_pd_global(intx, CompilerThreadStackSize,  0);
 
 // Used on 64 bit platforms for UseCompressedOops base address
 #ifdef _LP64
 // use 6G as default base address because by default the OS maps the application
 // to 4G on Solaris-Sparc. This leaves at least 2G for the native heap.
-define_pd_global(uintx, HeapBaseMinAddress,      CONST64(6)*G);
+define_pd_global(size_t, HeapBaseMinAddress,     CONST64(6)*G);
 #else
-define_pd_global(uintx, HeapBaseMinAddress,      2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 #endif
 
 
--- a/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/solaris_x86/vm/globals_solaris_x86.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,18 +32,18 @@
 #ifdef AMD64
 define_pd_global(intx, ThreadStackSize,          1024); // 0 => use system default
 define_pd_global(intx, VMThreadStackSize,        1024);
-define_pd_global(uintx,JVMInvokeMethodSlack,     8*K);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8*K);
 #else
 // ThreadStackSize 320 allows a couple of test cases to run while
 // keeping the number of threads that can be created high.
 define_pd_global(intx, ThreadStackSize,          320);
 define_pd_global(intx, VMThreadStackSize,        512);
-define_pd_global(uintx,JVMInvokeMethodSlack,     10*K);
+define_pd_global(size_t, JVMInvokeMethodSlack,   10*K);
 #endif // AMD64
 
 define_pd_global(intx, CompilerThreadStackSize,  0);
 
 // Used on 64 bit platforms for UseCompressedOops base address
-define_pd_global(uintx,HeapBaseMinAddress,       2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_SOLARIS_X86_VM_GLOBALS_SOLARIS_X86_HPP
--- a/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/os_cpu/windows_x86/vm/globals_windows_x86.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,9 +43,9 @@
 define_pd_global(intx, CompilerThreadStackSize,  0);
 #endif
 
-define_pd_global(uintx, JVMInvokeMethodSlack,    8192);
+define_pd_global(size_t, JVMInvokeMethodSlack,   8192);
 
 // Used on 64 bit platforms for UseCompressedOops base address
-define_pd_global(uintx, HeapBaseMinAddress,      2*G);
+define_pd_global(size_t, HeapBaseMinAddress,     2*G);
 
 #endif // OS_CPU_WINDOWS_X86_VM_GLOBALS_WINDOWS_X86_HPP
--- a/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/c1/c1_LIRGenerator.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1421,7 +1421,6 @@
   // Do the pre-write barrier, if any.
   switch (_bs->kind()) {
 #if INCLUDE_ALL_GCS
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       G1SATBCardTableModRef_pre_barrier(addr_opr, pre_val, do_load, patch, info);
       break;
@@ -1442,7 +1441,6 @@
 void LIRGenerator::post_barrier(LIR_OprDesc* addr, LIR_OprDesc* new_val) {
   switch (_bs->kind()) {
 #if INCLUDE_ALL_GCS
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       G1SATBCardTableModRef_post_barrier(addr,  new_val);
       break;
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -186,7 +186,7 @@
       cp->space->set_compaction_top(compact_top);
       cp->space = cp->space->next_compaction_space();
       if (cp->space == NULL) {
-        cp->gen = GenCollectedHeap::heap()->prev_gen(cp->gen);
+        cp->gen = GenCollectedHeap::heap()->young_gen();
         assert(cp->gen != NULL, "compaction must succeed");
         cp->space = cp->gen->first_compaction_space();
         assert(cp->space != NULL, "generation must have a first compaction space");
@@ -900,7 +900,6 @@
   }
 }
 
-
 // Callers of this iterator beware: The closure application should
 // be robust in the face of uninitialized objects and should (always)
 // return a correct size so that the next addr + size below gives us a
@@ -2663,8 +2662,8 @@
       // Need to smooth wrt historical average
       if (ResizeOldPLAB) {
         _blocks_to_claim[i].sample(
-          MAX2((size_t)CMSOldPLABMin,
-          MIN2((size_t)CMSOldPLABMax,
+          MAX2(CMSOldPLABMin,
+          MIN2(CMSOldPLABMax,
                _global_num_blocks[i]/(_global_num_workers[i]*CMSOldPLABNumRefills))));
       }
       // Reset counters for next round
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,9 @@
 // space, in this case a CompactibleFreeListSpace.
 
 // Forward declarations
+class CMSCollector;
 class CompactibleFreeListSpace;
+class ConcurrentMarkSweepGeneration;
 class BlkClosure;
 class BlkClosureCareful;
 class FreeChunk;
@@ -396,6 +398,10 @@
   // Resizing support
   void set_end(HeapWord* value);  // override
 
+  // Never mangle CompactibleFreeListSpace
+  void mangle_unused_area() {}
+  void mangle_unused_area_complete() {}
+
   // Mutual exclusion support
   Mutex* freelistLock() const { return &_freelistLock; }
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -369,7 +369,7 @@
 double CMSStats::time_until_cms_gen_full() const {
   size_t cms_free = _cms_gen->cmsSpace()->free();
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  size_t expected_promotion = MIN2(gch->get_gen(0)->capacity(),
+  size_t expected_promotion = MIN2(gch->young_gen()->capacity(),
                                    (size_t) _cms_gen->gc_stats()->avg_promoted()->padded_average());
   if (cms_free > expected_promotion) {
     // Start a cms collection if there isn't enough space to promote
@@ -506,7 +506,7 @@
   _collector_policy(cp),
   _should_unload_classes(CMSClassUnloadingEnabled),
   _concurrent_cycles_since_last_unload(0),
-  _roots_scanning_options(SharedHeap::SO_None),
+  _roots_scanning_options(GenCollectedHeap::SO_None),
   _inter_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding),
   _intra_sweep_estimate(CMS_SweepWeight, CMS_SweepPadding),
   _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) CMSTracer()),
@@ -626,8 +626,8 @@
 
   // Support for parallelizing young gen rescan
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  assert(gch->prev_gen(_cmsGen)->kind() == Generation::ParNew, "CMS can only be used with ParNew");
-  _young_gen = (ParNewGeneration*)gch->prev_gen(_cmsGen);
+  assert(gch->young_gen()->kind() == Generation::ParNew, "CMS can only be used with ParNew");
+  _young_gen = (ParNewGeneration*)gch->young_gen();
   if (gch->supports_inline_contig_alloc()) {
     _top_addr = gch->top_addr();
     _end_addr = gch->end_addr();
@@ -869,7 +869,7 @@
       if (prev_level >= 0) {
         size_t prev_size = 0;
         GenCollectedHeap* gch = GenCollectedHeap::heap();
-        Generation* prev_gen = gch->get_gen(prev_level);
+        Generation* prev_gen = gch->young_gen();
         prev_size = prev_gen->capacity();
           gclog_or_tty->print_cr("  Younger gen size "SIZE_FORMAT,
                                  prev_size/1000);
@@ -1049,11 +1049,8 @@
     // expand and retry
     size_t s = _cmsSpace->expansionSpaceRequired(obj_size);  // HeapWords
     expand_for_gc_cause(s*HeapWordSize, MinHeapDeltaBytes, CMSExpansionCause::_satisfy_promotion);
-    // Since there's currently no next generation, we don't try to promote
+    // Since this is the old generation, we don't try to promote
     // into a more senior generation.
-    assert(next_gen() == NULL, "assumption, based upon which no attempt "
-                               "is made to pass on a possibly failing "
-                               "promotion to next generation");
     res = _cmsSpace->promote(obj, obj_size);
   }
   if (res != NULL) {
@@ -2499,7 +2496,7 @@
   gch->gen_process_roots(_cmsGen->level(),
                          true,   // younger gens are roots
                          true,   // activate StrongRootsScope
-                         SharedHeap::ScanningOption(roots_scanning_options()),
+                         GenCollectedHeap::ScanningOption(roots_scanning_options()),
                          should_unload_classes(),
                          &notOlder,
                          NULL,
@@ -2567,7 +2564,7 @@
   gch->gen_process_roots(_cmsGen->level(),
                          true,   // younger gens are roots
                          true,   // activate StrongRootsScope
-                         SharedHeap::ScanningOption(roots_scanning_options()),
+                         GenCollectedHeap::ScanningOption(roots_scanning_options()),
                          should_unload_classes(),
                          &notOlder,
                          NULL,
@@ -2751,7 +2748,7 @@
 void CMSCollector::setup_cms_unloading_and_verification_state() {
   const  bool should_verify =   VerifyBeforeGC || VerifyAfterGC || VerifyDuringGC
                              || VerifyBeforeExit;
-  const  int  rso           =   SharedHeap::SO_AllCodeCache;
+  const  int  rso           =   GenCollectedHeap::SO_AllCodeCache;
 
   // We set the proper root for this CMS cycle here.
   if (should_unload_classes()) {   // Should unload classes this cycle
@@ -3000,7 +2997,6 @@
   report_heap_summary(GCWhen::BeforeGC);
 
   ReferenceProcessor* rp = ref_processor();
-  SpecializationStats::clear();
   assert(_restart_addr == NULL, "Control point invariant");
   {
     // acquire locks for subsequent manipulations
@@ -3011,7 +3007,6 @@
     rp->enable_discovery();
     _collectorState = Marking;
   }
-  SpecializationStats::print();
 }
 
 void CMSCollector::checkpointRootsInitialWork() {
@@ -3092,7 +3087,7 @@
       gch->gen_process_roots(_cmsGen->level(),
                              true,   // younger gens are roots
                              true,   // activate StrongRootsScope
-                             SharedHeap::ScanningOption(roots_scanning_options()),
+                             GenCollectedHeap::ScanningOption(roots_scanning_options()),
                              should_unload_classes(),
                              &notOlder,
                              NULL,
@@ -4329,7 +4324,6 @@
   verify_work_stacks_empty();
   verify_overflow_empty();
 
-  SpecializationStats::clear();
   if (PrintGCDetails) {
     gclog_or_tty->print("[YG occupancy: "SIZE_FORMAT" K ("SIZE_FORMAT" K)]",
                         _young_gen->used() / K,
@@ -4360,7 +4354,6 @@
   }
   verify_work_stacks_empty();
   verify_overflow_empty();
-  SpecializationStats::print();
 }
 
 void CMSCollector::checkpointRootsFinalWork() {
@@ -4528,13 +4521,13 @@
   gch->gen_process_roots(_collector->_cmsGen->level(),
                          false,     // yg was scanned above
                          false,     // this is parallel code
-                         SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
+                         GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
                          _collector->should_unload_classes(),
                          &par_mri_cl,
                          NULL,
                          &cld_closure);
   assert(_collector->should_unload_classes()
-         || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_AllCodeCache),
+         || (_collector->CMSCollector::roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache),
          "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
   _timer.stop();
   if (PrintCMSStatistics != 0) {
@@ -4664,14 +4657,14 @@
   gch->gen_process_roots(_collector->_cmsGen->level(),
                          false,     // yg was scanned above
                          false,     // this is parallel code
-                         SharedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
+                         GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
                          _collector->should_unload_classes(),
                          &par_mrias_cl,
                          NULL,
                          NULL);     // The dirty klasses will be handled below
 
   assert(_collector->should_unload_classes()
-         || (_collector->CMSCollector::roots_scanning_options() & SharedHeap::SO_AllCodeCache),
+         || (_collector->CMSCollector::roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache),
          "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
   _timer.stop();
   if (PrintCMSStatistics != 0) {
@@ -5255,14 +5248,14 @@
     gch->gen_process_roots(_cmsGen->level(),
                            true,  // younger gens as roots
                            false, // use the local StrongRootsScope
-                           SharedHeap::ScanningOption(roots_scanning_options()),
+                           GenCollectedHeap::ScanningOption(roots_scanning_options()),
                            should_unload_classes(),
                            &mrias_cl,
                            NULL,
                            NULL); // The dirty klasses will be handled below
 
     assert(should_unload_classes()
-           || (roots_scanning_options() & SharedHeap::SO_AllCodeCache),
+           || (roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache),
            "if we didn't scan the code cache, we have to be ready to drop nmethods with expired weak oops");
   }
 
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPGENERATION_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CONCURRENTMARKSWEEPGENERATION_HPP
 
+#include "gc_implementation/concurrentMarkSweep/cmsOopClosures.hpp"
 #include "gc_implementation/shared/gcHeapSummary.hpp"
 #include "gc_implementation/shared/gSpaceCounters.hpp"
 #include "gc_implementation/shared/gcStats.hpp"
@@ -55,6 +56,7 @@
 // means of a sliding mark-compact.
 
 class AdaptiveSizePolicy;
+class CMSCollector;
 class CMSConcMarkingTask;
 class CMSGCAdaptivePolicyCounters;
 class CMSTracer;
@@ -64,6 +66,7 @@
 class ConcurrentMarkSweepThread;
 class CompactibleFreeListSpace;
 class FreeChunk;
+class ParNewGeneration;
 class PromotionInfo;
 class ScanMarkedObjectsAgainCarefullyClosure;
 class TenuredGeneration;
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -696,32 +696,32 @@
   }
 
   if (FLAG_IS_DEFAULT(MarkStackSize)) {
-    uintx mark_stack_size =
+    size_t mark_stack_size =
       MIN2(MarkStackSizeMax,
-          MAX2(MarkStackSize, (uintx) (parallel_marking_threads() * TASKQUEUE_SIZE)));
+          MAX2(MarkStackSize, (size_t) (parallel_marking_threads() * TASKQUEUE_SIZE)));
     // Verify that the calculated value for MarkStackSize is in range.
     // It would be nice to use the private utility routine from Arguments.
     if (!(mark_stack_size >= 1 && mark_stack_size <= MarkStackSizeMax)) {
-      warning("Invalid value calculated for MarkStackSize (" UINTX_FORMAT "): "
-              "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
-              mark_stack_size, (uintx) 1, MarkStackSizeMax);
+      warning("Invalid value calculated for MarkStackSize (" SIZE_FORMAT "): "
+              "must be between 1 and " SIZE_FORMAT,
+              mark_stack_size, MarkStackSizeMax);
       return;
     }
-    FLAG_SET_ERGO(uintx, MarkStackSize, mark_stack_size);
+    FLAG_SET_ERGO(size_t, MarkStackSize, mark_stack_size);
   } else {
     // Verify MarkStackSize is in range.
     if (FLAG_IS_CMDLINE(MarkStackSize)) {
       if (FLAG_IS_DEFAULT(MarkStackSizeMax)) {
         if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
-          warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT "): "
-                  "must be between " UINTX_FORMAT " and " UINTX_FORMAT,
-                  MarkStackSize, (uintx) 1, MarkStackSizeMax);
+          warning("Invalid value specified for MarkStackSize (" SIZE_FORMAT "): "
+                  "must be between 1 and " SIZE_FORMAT,
+                  MarkStackSize, MarkStackSizeMax);
           return;
         }
       } else if (FLAG_IS_CMDLINE(MarkStackSizeMax)) {
         if (!(MarkStackSize >= 1 && MarkStackSize <= MarkStackSizeMax)) {
-          warning("Invalid value specified for MarkStackSize (" UINTX_FORMAT ")"
-                  " or for MarkStackSizeMax (" UINTX_FORMAT ")",
+          warning("Invalid value specified for MarkStackSize (" SIZE_FORMAT ")"
+                  " or for MarkStackSizeMax (" SIZE_FORMAT ")",
                   MarkStackSize, MarkStackSizeMax);
           return;
         }
@@ -745,7 +745,7 @@
   // so that the assertion in MarkingTaskQueue::task_queue doesn't fail
   _active_tasks = _max_worker_id;
 
-  size_t max_regions = (size_t) _g1h->max_regions();
+  uint max_regions = _g1h->max_regions();
   for (uint i = 0; i < _max_worker_id; ++i) {
     CMTaskQueue* task_queue = new CMTaskQueue();
     task_queue->initialize();
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -34,6 +34,7 @@
 class G1CollectedHeap;
 class CMBitMap;
 class CMTask;
+class ConcurrentMark;
 typedef GenericTaskQueue<oop, mtGC>            CMTaskQueue;
 typedef GenericTaskQueueSet<CMTaskQueue, mtGC> CMTaskQueueSet;
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -48,6 +48,7 @@
 #include "gc_implementation/g1/g1ParScanThreadState.inline.hpp"
 #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
 #include "gc_implementation/g1/g1RemSet.inline.hpp"
+#include "gc_implementation/g1/g1RootProcessor.hpp"
 #include "gc_implementation/g1/g1StringDedup.hpp"
 #include "gc_implementation/g1/g1YCTypes.hpp"
 #include "gc_implementation/g1/heapRegion.inline.hpp"
@@ -89,18 +90,6 @@
 // apply to TLAB allocation, which is not part of this interface: it
 // is done by clients of this interface.)
 
-// Notes on implementation of parallelism in different tasks.
-//
-// G1ParVerifyTask uses heap_region_par_iterate() for parallelism.
-// The number of GC workers is passed to heap_region_par_iterate().
-// It does use run_task() which sets _n_workers in the task.
-// G1ParTask executes g1_process_roots() ->
-// SharedHeap::process_roots() which calls eventually to
-// CardTableModRefBS::par_non_clean_card_iterate_work() which uses
-// SequentialSubTasksDone.  SharedHeap::process_roots() also
-// directly uses SubTasksDone (_process_strong_tasks field in SharedHeap).
-//
-
 // Local to this file.
 
 class RefineCardTableEntryClosure: public CardTableEntryClosure {
@@ -1767,7 +1756,6 @@
   _is_alive_closure_stw(this),
   _ref_processor_cm(NULL),
   _ref_processor_stw(NULL),
-  _process_strong_tasks(new SubTasksDone(G1H_PS_NumElements)),
   _bot_shared(NULL),
   _evac_failure_scan_stack(NULL),
   _mark_in_progress(false),
@@ -1801,9 +1789,6 @@
   _gc_tracer_cm(new (ResourceObj::C_HEAP, mtGC) G1OldTracer()) {
 
   _g1h = this;
-  if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) {
-    vm_exit_during_initialization("Failed necessary allocation.");
-  }
 
   _allocator = G1Allocator::create_allocator(_g1h);
   _humongous_object_threshold_in_words = HeapRegion::GrainWords / 2;
@@ -2026,10 +2011,6 @@
                                              Shared_DirtyCardQ_lock,
                                              &JavaThread::dirty_card_queue_set());
 
-  // In case we're keeping closure specialization stats, initialize those
-  // counts and that mechanism.
-  SpecializationStats::clear();
-
   // Here we allocate the dummy HeapRegion that is required by the
   // G1AllocRegion class.
   HeapRegion* dummy_region = _hrm.get_dummy_region();
@@ -2206,11 +2187,11 @@
   hot_card_cache->drain(worker_i, g1_rem_set(), into_cset_dcq);
 
   DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set();
-  int n_completed_buffers = 0;
+  size_t n_completed_buffers = 0;
   while (dcqs.apply_closure_to_completed_buffer(cl, worker_i, 0, true)) {
     n_completed_buffers++;
   }
-  g1_policy()->phase_times()->record_update_rs_processed_buffers(worker_i, n_completed_buffers);
+  g1_policy()->phase_times()->record_thread_work_item(G1GCPhaseTimes::UpdateRS, worker_i, n_completed_buffers);
   dcqs.clear_n_completed_buffers();
   assert(!dcqs.completed_buffers_exist_dirty(), "Completed buffers exist!");
 }
@@ -3111,11 +3092,12 @@
     G1VerifyCodeRootOopClosure codeRootsCl(this, &rootsCl, vo);
     G1VerifyCodeRootBlobClosure blobsCl(&codeRootsCl);
 
-    process_all_roots(true,            // activate StrongRootsScope
-                      SO_AllCodeCache, // roots scanning options
-                      &rootsCl,
-                      &cldCl,
-                      &blobsCl);
+    {
+      G1RootProcessor root_processor(this);
+      root_processor.process_all_roots(&rootsCl,
+                                       &cldCl,
+                                       &blobsCl);
+    }
 
     bool failures = rootsCl.failures() || codeRootsCl.failures();
 
@@ -3321,7 +3303,6 @@
     concurrent_mark()->print_summary_info();
   }
   g1_policy()->print_yg_surv_rate_info();
-  SpecializationStats::print();
 }
 
 #ifndef PRODUCT
@@ -3751,9 +3732,9 @@
 
     TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
 
-    int active_workers = workers()->active_workers();
+    uint active_workers = workers()->active_workers();
     double pause_start_sec = os::elapsedTime();
-    g1_policy()->phase_times()->note_gc_start(active_workers);
+    g1_policy()->phase_times()->note_gc_start(active_workers, mark_in_progress());
     log_gc_header();
 
     TraceCollectorStats tcs(g1mm()->incremental_collection_counters());
@@ -4365,60 +4346,11 @@
   }
 };
 
-class G1CodeBlobClosure : public CodeBlobClosure {
-  class HeapRegionGatheringOopClosure : public OopClosure {
-    G1CollectedHeap* _g1h;
-    OopClosure* _work;
-    nmethod* _nm;
-
-    template <typename T>
-    void do_oop_work(T* p) {
-      _work->do_oop(p);
-      T oop_or_narrowoop = oopDesc::load_heap_oop(p);
-      if (!oopDesc::is_null(oop_or_narrowoop)) {
-        oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
-        HeapRegion* hr = _g1h->heap_region_containing_raw(o);
-        assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in CS then evacuation failed and nm must already be in the remset");
-        hr->add_strong_code_root(_nm);
-      }
-    }
-
-  public:
-    HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {}
-
-    void do_oop(oop* o) {
-      do_oop_work(o);
-    }
-
-    void do_oop(narrowOop* o) {
-      do_oop_work(o);
-    }
-
-    void set_nm(nmethod* nm) {
-      _nm = nm;
-    }
-  };
-
-  HeapRegionGatheringOopClosure _oc;
-public:
-  G1CodeBlobClosure(OopClosure* oc) : _oc(oc) {}
-
-  void do_code_blob(CodeBlob* cb) {
-    nmethod* nm = cb->as_nmethod_or_null();
-    if (nm != NULL) {
-      if (!nm->test_set_oops_do_mark()) {
-        _oc.set_nm(nm);
-        nm->oops_do(&_oc);
-        nm->fix_oop_relocations();
-      }
-    }
-  }
-};
-
 class G1ParTask : public AbstractGangTask {
 protected:
   G1CollectedHeap*       _g1h;
   RefToScanQueueSet      *_queues;
+  G1RootProcessor*       _root_processor;
   ParallelTaskTerminator _terminator;
   uint _n_workers;
 
@@ -4426,10 +4358,11 @@
   Mutex* stats_lock() { return &_stats_lock; }
 
 public:
-  G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues)
+  G1ParTask(G1CollectedHeap* g1h, RefToScanQueueSet *task_queues, G1RootProcessor* root_processor)
     : AbstractGangTask("G1 collection"),
       _g1h(g1h),
       _queues(task_queues),
+      _root_processor(root_processor),
       _terminator(0, _queues),
       _stats_lock(Mutex::leaf, "parallel G1 stats lock", true)
   {}
@@ -4443,13 +4376,7 @@
   ParallelTaskTerminator* terminator() { return &_terminator; }
 
   virtual void set_for_termination(int active_workers) {
-    // This task calls set_n_termination() in par_non_clean_card_iterate_work()
-    // in the young space (_par_seq_tasks) in the G1 heap
-    // for SequentialSubTasksDone.
-    // This task also uses SubTasksDone in SharedHeap and G1CollectedHeap
-    // both of which need setting by set_n_termination().
-    _g1h->SharedHeap::set_n_termination(active_workers);
-    _g1h->set_n_termination(active_workers);
+    _root_processor->set_num_workers(active_workers);
     terminator()->reset_for_reuse(active_workers);
     _n_workers = active_workers;
   }
@@ -4486,8 +4413,7 @@
   void work(uint worker_id) {
     if (worker_id >= _n_workers) return;  // no work needed this round
 
-    double start_time_ms = os::elapsedTime() * 1000.0;
-    _g1h->g1_policy()->phase_times()->record_gc_worker_start_time(worker_id, start_time_ms);
+    _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerStart, worker_id, os::elapsedTime());
 
     {
       ResourceMark rm;
@@ -4519,24 +4445,21 @@
                                                                                     false, // Process all klasses.
                                                                                     true); // Need to claim CLDs.
 
-      G1CodeBlobClosure scan_only_code_cl(&scan_only_root_cl);
-      G1CodeBlobClosure scan_mark_code_cl(&scan_mark_root_cl);
-      // IM Weak code roots are handled later.
-
       OopClosure* strong_root_cl;
       OopClosure* weak_root_cl;
       CLDClosure* strong_cld_cl;
       CLDClosure* weak_cld_cl;
-      CodeBlobClosure* strong_code_cl;
+
+      bool trace_metadata = false;
 
       if (_g1h->g1_policy()->during_initial_mark_pause()) {
         // We also need to mark copied objects.
         strong_root_cl = &scan_mark_root_cl;
         strong_cld_cl  = &scan_mark_cld_cl;
-        strong_code_cl = &scan_mark_code_cl;
         if (ClassUnloadingWithConcurrentMark) {
           weak_root_cl = &scan_mark_weak_root_cl;
           weak_cld_cl  = &scan_mark_weak_cld_cl;
+          trace_metadata = true;
         } else {
           weak_root_cl = &scan_mark_root_cl;
           weak_cld_cl  = &scan_mark_cld_cl;
@@ -4546,31 +4469,32 @@
         weak_root_cl   = &scan_only_root_cl;
         strong_cld_cl  = &scan_only_cld_cl;
         weak_cld_cl    = &scan_only_cld_cl;
-        strong_code_cl = &scan_only_code_cl;
       }
 
-
-      G1ParPushHeapRSClosure  push_heap_rs_cl(_g1h, &pss);
-
       pss.start_strong_roots();
-      _g1h->g1_process_roots(strong_root_cl,
-                             weak_root_cl,
-                             &push_heap_rs_cl,
-                             strong_cld_cl,
-                             weak_cld_cl,
-                             strong_code_cl,
-                             worker_id);
-
+
+      _root_processor->evacuate_roots(strong_root_cl,
+                                      weak_root_cl,
+                                      strong_cld_cl,
+                                      weak_cld_cl,
+                                      trace_metadata,
+                                      worker_id);
+
+      G1ParPushHeapRSClosure push_heap_rs_cl(_g1h, &pss);
+      _root_processor->scan_remembered_sets(&push_heap_rs_cl,
+                                            weak_root_cl,
+                                            worker_id);
       pss.end_strong_roots();
 
       {
         double start = os::elapsedTime();
         G1ParEvacuateFollowersClosure evac(_g1h, &pss, _queues, &_terminator);
         evac.do_void();
-        double elapsed_ms = (os::elapsedTime()-start)*1000.0;
-        double term_ms = pss.term_time()*1000.0;
-        _g1h->g1_policy()->phase_times()->add_obj_copy_time(worker_id, elapsed_ms-term_ms);
-        _g1h->g1_policy()->phase_times()->record_termination(worker_id, term_ms, pss.term_attempts());
+        double elapsed_sec = os::elapsedTime() - start;
+        double term_sec = pss.term_time();
+        _g1h->g1_policy()->phase_times()->add_time_secs(G1GCPhaseTimes::ObjCopy, worker_id, elapsed_sec - term_sec);
+        _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::Termination, worker_id, term_sec);
+        _g1h->g1_policy()->phase_times()->record_thread_work_item(G1GCPhaseTimes::Termination, worker_id, pss.term_attempts());
       }
       _g1h->g1_policy()->record_thread_age_table(pss.age_table());
       _g1h->update_surviving_young_words(pss.surviving_young_words()+1);
@@ -4586,100 +4510,10 @@
       // destructors are executed here and are included as part of the
       // "GC Worker Time".
     }
-
-    double end_time_ms = os::elapsedTime() * 1000.0;
-    _g1h->g1_policy()->phase_times()->record_gc_worker_end_time(worker_id, end_time_ms);
+    _g1h->g1_policy()->phase_times()->record_time_secs(G1GCPhaseTimes::GCWorkerEnd, worker_id, os::elapsedTime());
   }
 };
 
-// *** Common G1 Evacuation Stuff
-
-// This method is run in a GC worker.
-
-void
-G1CollectedHeap::
-g1_process_roots(OopClosure* scan_non_heap_roots,
-                 OopClosure* scan_non_heap_weak_roots,
-                 G1ParPushHeapRSClosure* scan_rs,
-                 CLDClosure* scan_strong_clds,
-                 CLDClosure* scan_weak_clds,
-                 CodeBlobClosure* scan_strong_code,
-                 uint worker_i) {
-
-  // First scan the shared roots.
-  double ext_roots_start = os::elapsedTime();
-  double closure_app_time_sec = 0.0;
-
-  bool during_im = _g1h->g1_policy()->during_initial_mark_pause();
-  bool trace_metadata = during_im && ClassUnloadingWithConcurrentMark;
-
-  BufferingOopClosure buf_scan_non_heap_roots(scan_non_heap_roots);
-  BufferingOopClosure buf_scan_non_heap_weak_roots(scan_non_heap_weak_roots);
-
-  process_roots(false, // no scoping; this is parallel code
-                SharedHeap::SO_None,
-                &buf_scan_non_heap_roots,
-                &buf_scan_non_heap_weak_roots,
-                scan_strong_clds,
-                // Unloading Initial Marks handle the weak CLDs separately.
-                (trace_metadata ? NULL : scan_weak_clds),
-                scan_strong_code);
-
-  // Now the CM ref_processor roots.
-  if (!_process_strong_tasks->is_task_claimed(G1H_PS_refProcessor_oops_do)) {
-    // We need to treat the discovered reference lists of the
-    // concurrent mark ref processor as roots and keep entries
-    // (which are added by the marking threads) on them live
-    // until they can be processed at the end of marking.
-    ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots);
-  }
-
-  if (trace_metadata) {
-    // Barrier to make sure all workers passed
-    // the strong CLD and strong nmethods phases.
-    active_strong_roots_scope()->wait_until_all_workers_done_with_threads(n_par_threads());
-
-    // Now take the complement of the strong CLDs.
-    ClassLoaderDataGraph::roots_cld_do(NULL, scan_weak_clds);
-  }
-
-  // Finish up any enqueued closure apps (attributed as object copy time).
-  buf_scan_non_heap_roots.done();
-  buf_scan_non_heap_weak_roots.done();
-
-  double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds()
-      + buf_scan_non_heap_weak_roots.closure_app_seconds();
-
-  g1_policy()->phase_times()->record_obj_copy_time(worker_i, obj_copy_time_sec * 1000.0);
-
-  double ext_root_time_ms =
-    ((os::elapsedTime() - ext_roots_start) - obj_copy_time_sec) * 1000.0;
-
-  g1_policy()->phase_times()->record_ext_root_scan_time(worker_i, ext_root_time_ms);
-
-  // During conc marking we have to filter the per-thread SATB buffers
-  // to make sure we remove any oops into the CSet (which will show up
-  // as implicitly live).
-  double satb_filtering_ms = 0.0;
-  if (!_process_strong_tasks->is_task_claimed(G1H_PS_filter_satb_buffers)) {
-    if (mark_in_progress()) {
-      double satb_filter_start = os::elapsedTime();
-
-      JavaThread::satb_mark_queue_set().filter_thread_buffers();
-
-      satb_filtering_ms = (os::elapsedTime() - satb_filter_start) * 1000.0;
-    }
-  }
-  g1_policy()->phase_times()->record_satb_filtering_time(worker_i, satb_filtering_ms);
-
-  // Now scan the complement of the collection set.
-  G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots);
-
-  g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i);
-
-  _process_strong_tasks->all_tasks_completed();
-}
-
 class G1StringSymbolTableUnlinkTask : public AbstractGangTask {
 private:
   BoolObjectClosure* _is_alive;
@@ -5054,14 +4888,13 @@
   G1RedirtyLoggedCardsTask(DirtyCardQueueSet* queue) : AbstractGangTask("Redirty Cards"), _queue(queue) { }
 
   virtual void work(uint worker_id) {
-    double start_time = os::elapsedTime();
+    G1GCPhaseTimes* phase_times = G1CollectedHeap::heap()->g1_policy()->phase_times();
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::RedirtyCards, worker_id);
 
     RedirtyLoggedCardTableEntryClosure cl;
     _queue->par_apply_closure_to_all_completed_buffers(&cl);
 
-    G1GCPhaseTimes* timer = G1CollectedHeap::heap()->g1_policy()->phase_times();
-    timer->record_redirty_logged_cards_time_ms(worker_id, (os::elapsedTime() - start_time) * 1000.0);
-    timer->record_redirty_logged_cards_processed_cards(worker_id, cl.num_processed());
+    phase_times->record_thread_work_item(G1GCPhaseTimes::RedirtyCards, worker_id, cl.num_processed());
   }
 };
 
@@ -5608,7 +5441,6 @@
   workers()->set_active_workers(n_workers);
   set_par_threads(n_workers);
 
-  G1ParTask g1_par_task(this, _task_queues);
 
   init_for_evac_failure(NULL);
 
@@ -5617,7 +5449,8 @@
   double end_par_time_sec;
 
   {
-    StrongRootsScope srs(this);
+    G1RootProcessor root_processor(this);
+    G1ParTask g1_par_task(this, _task_queues, &root_processor);
     // InitialMark needs claim bits to keep track of the marked-through CLDs.
     if (g1_policy()->during_initial_mark_pause()) {
       ClassLoaderDataGraph::clear_claimed_marks();
@@ -5633,18 +5466,20 @@
     end_par_time_sec = os::elapsedTime();
 
     // Closing the inner scope will execute the destructor
-    // for the StrongRootsScope object. We record the current
+    // for the G1RootProcessor object. We record the current
     // elapsed time before closing the scope so that time
-    // taken for the SRS destructor is NOT included in the
+    // taken for the destructor is NOT included in the
     // reported parallel time.
   }
 
+  G1GCPhaseTimes* phase_times = g1_policy()->phase_times();
+
   double par_time_ms = (end_par_time_sec - start_par_time_sec) * 1000.0;
-  g1_policy()->phase_times()->record_par_time(par_time_ms);
+  phase_times->record_par_time(par_time_ms);
 
   double code_root_fixup_time_ms =
         (os::elapsedTime() - end_par_time_sec) * 1000.0;
-  g1_policy()->phase_times()->record_code_root_fixup_time(code_root_fixup_time_ms);
+  phase_times->record_code_root_fixup_time(code_root_fixup_time_ms);
 
   set_par_threads(0);
 
@@ -5656,9 +5491,14 @@
   process_discovered_references(n_workers);
 
   if (G1StringDedup::is_enabled()) {
+    double fixup_start = os::elapsedTime();
+
     G1STWIsAliveClosure is_alive(this);
     G1KeepAliveClosure keep_alive(this);
-    G1StringDedup::unlink_or_oops_do(&is_alive, &keep_alive);
+    G1StringDedup::unlink_or_oops_do(&is_alive, &keep_alive, true, phase_times);
+
+    double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0;
+    phase_times->record_string_dedup_fixup_time(fixup_time_ms);
   }
 
   _allocator->release_gc_alloc_regions(n_workers, evacuation_info);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -56,6 +56,7 @@
 class GenerationSpec;
 class OopsInHeapRegionClosure;
 class G1KlassScanClosure;
+class G1ParScanThreadState;
 class ObjectClosure;
 class SpaceClosure;
 class CompactibleSpaceClosure;
@@ -780,22 +781,6 @@
   // statistics or updating free lists.
   void abandon_collection_set(HeapRegion* cs_head);
 
-  // Applies "scan_non_heap_roots" to roots outside the heap,
-  // "scan_rs" to roots inside the heap (having done "set_region" to
-  // indicate the region in which the root resides),
-  // and does "scan_metadata" If "scan_rs" is
-  // NULL, then this step is skipped.  The "worker_i"
-  // param is for use with parallel roots processing, and should be
-  // the "i" of the calling parallel worker thread's work(i) function.
-  // In the sequential case this param will be ignored.
-  void g1_process_roots(OopClosure* scan_non_heap_roots,
-                        OopClosure* scan_non_heap_weak_roots,
-                        G1ParPushHeapRSClosure* scan_rs,
-                        CLDClosure* scan_strong_clds,
-                        CLDClosure* scan_weak_clds,
-                        CodeBlobClosure* scan_strong_code,
-                        uint worker_i);
-
   // The concurrent marker (and the thread it runs in.)
   ConcurrentMark* _cm;
   ConcurrentMarkThread* _cmThread;
@@ -982,21 +967,10 @@
   // of G1CollectedHeap::_gc_time_stamp.
   uint* _worker_cset_start_region_time_stamp;
 
-  enum G1H_process_roots_tasks {
-    G1H_PS_filter_satb_buffers,
-    G1H_PS_refProcessor_oops_do,
-    // Leave this one last.
-    G1H_PS_NumElements
-  };
-
-  SubTasksDone* _process_strong_tasks;
-
   volatile bool _free_regions_coming;
 
 public:
 
-  SubTasksDone* process_strong_tasks() { return _process_strong_tasks; }
-
   void set_refine_cte_cl_concurrency(bool concurrent);
 
   RefToScanQueue *task_queue(int i) const;
@@ -1029,21 +1003,11 @@
   // Initialize weak reference processing.
   virtual void ref_processing_init();
 
-  void set_par_threads(uint t) {
-    SharedHeap::set_par_threads(t);
-    // Done in SharedHeap but oddly there are
-    // two _process_strong_tasks's in a G1CollectedHeap
-    // so do it here too.
-    _process_strong_tasks->set_n_threads(t);
-  }
-
+  // Explicitly import set_par_threads into this scope
+  using SharedHeap::set_par_threads;
   // Set _n_par_threads according to a policy TBD.
   void set_par_threads();
 
-  void set_n_termination(int t) {
-    _process_strong_tasks->set_n_threads(t);
-  }
-
   virtual CollectedHeap::Name kind() const {
     return CollectedHeap::G1CollectedHeap;
   }
@@ -1118,6 +1082,10 @@
   // The number of regions that are completely free.
   uint num_free_regions() const { return _hrm.num_free_regions(); }
 
+  MemoryUsage get_auxiliary_data_memory_usage() const {
+    return _hrm.get_auxiliary_data_memory_usage();
+  }
+
   // The number of regions that are not completely free.
   uint num_used_regions() const { return num_regions() - num_free_regions(); }
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -321,7 +321,7 @@
 
 void G1CollectorPolicy::initialize_flags() {
   if (G1HeapRegionSize != HeapRegion::GrainBytes) {
-    FLAG_SET_ERGO(uintx, G1HeapRegionSize, HeapRegion::GrainBytes);
+    FLAG_SET_ERGO(size_t, G1HeapRegionSize, HeapRegion::GrainBytes);
   }
 
   if (SurvivorRatio < 1) {
@@ -335,7 +335,7 @@
   uintx max_regions = G1CollectedHeap::heap()->max_regions();
   size_t max_young_size = (size_t)_young_gen_sizer->max_young_length(max_regions) * HeapRegion::GrainBytes;
   if (max_young_size != MaxNewSize) {
-    FLAG_SET_ERGO(uintx, MaxNewSize, max_young_size);
+    FLAG_SET_ERGO(size_t, MaxNewSize, max_young_size);
   }
 }
 
@@ -1073,7 +1073,7 @@
   if (update_stats) {
     double cost_per_card_ms = 0.0;
     if (_pending_cards > 0) {
-      cost_per_card_ms = phase_times()->average_last_update_rs_time() / (double) _pending_cards;
+      cost_per_card_ms = phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS) / (double) _pending_cards;
       _cost_per_card_ms_seq->add(cost_per_card_ms);
     }
 
@@ -1081,7 +1081,7 @@
 
     double cost_per_entry_ms = 0.0;
     if (cards_scanned > 10) {
-      cost_per_entry_ms = phase_times()->average_last_scan_rs_time() / (double) cards_scanned;
+      cost_per_entry_ms = phase_times()->average_time_ms(G1GCPhaseTimes::ScanRS) / (double) cards_scanned;
       if (_last_gc_was_young) {
         _cost_per_entry_ms_seq->add(cost_per_entry_ms);
       } else {
@@ -1123,7 +1123,7 @@
     double cost_per_byte_ms = 0.0;
 
     if (copied_bytes > 0) {
-      cost_per_byte_ms = phase_times()->average_last_obj_copy_time() / (double) copied_bytes;
+      cost_per_byte_ms = phase_times()->average_time_ms(G1GCPhaseTimes::ObjCopy) / (double) copied_bytes;
       if (_in_marking_window) {
         _cost_per_byte_ms_during_cm_seq->add(cost_per_byte_ms);
       } else {
@@ -1132,8 +1132,8 @@
     }
 
     double all_other_time_ms = pause_time_ms -
-      (phase_times()->average_last_update_rs_time() + phase_times()->average_last_scan_rs_time()
-      + phase_times()->average_last_obj_copy_time() + phase_times()->average_last_termination_time());
+      (phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS) + phase_times()->average_time_ms(G1GCPhaseTimes::ScanRS) +
+          phase_times()->average_time_ms(G1GCPhaseTimes::ObjCopy) + phase_times()->average_time_ms(G1GCPhaseTimes::Termination));
 
     double young_other_time_ms = 0.0;
     if (young_cset_region_length() > 0) {
@@ -1174,8 +1174,8 @@
 
   // Note that _mmu_tracker->max_gc_time() returns the time in seconds.
   double update_rs_time_goal_ms = _mmu_tracker->max_gc_time() * MILLIUNITS * G1RSetUpdatingPauseTimePercent / 100.0;
-  adjust_concurrent_refinement(phase_times()->average_last_update_rs_time(),
-                               phase_times()->sum_last_update_rs_processed_buffers(), update_rs_time_goal_ms);
+  adjust_concurrent_refinement(phase_times()->average_time_ms(G1GCPhaseTimes::UpdateRS),
+                               phase_times()->sum_thread_work_items(G1GCPhaseTimes::UpdateRS), update_rs_time_goal_ms);
 
   _collectionSetChooser->verify();
 }
@@ -2114,19 +2114,19 @@
     _other.add(pause_time_ms - phase_times->accounted_time_ms());
     _root_region_scan_wait.add(phase_times->root_region_scan_wait_time_ms());
     _parallel.add(phase_times->cur_collection_par_time_ms());
-    _ext_root_scan.add(phase_times->average_last_ext_root_scan_time());
-    _satb_filtering.add(phase_times->average_last_satb_filtering_times_ms());
-    _update_rs.add(phase_times->average_last_update_rs_time());
-    _scan_rs.add(phase_times->average_last_scan_rs_time());
-    _obj_copy.add(phase_times->average_last_obj_copy_time());
-    _termination.add(phase_times->average_last_termination_time());
+    _ext_root_scan.add(phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan));
+    _satb_filtering.add(phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering));
+    _update_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS));
+    _scan_rs.add(phase_times->average_time_ms(G1GCPhaseTimes::ScanRS));
+    _obj_copy.add(phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy));
+    _termination.add(phase_times->average_time_ms(G1GCPhaseTimes::Termination));
 
-    double parallel_known_time = phase_times->average_last_ext_root_scan_time() +
-      phase_times->average_last_satb_filtering_times_ms() +
-      phase_times->average_last_update_rs_time() +
-      phase_times->average_last_scan_rs_time() +
-      phase_times->average_last_obj_copy_time() +
-      + phase_times->average_last_termination_time();
+    double parallel_known_time = phase_times->average_time_ms(G1GCPhaseTimes::ExtRootScan) +
+      phase_times->average_time_ms(G1GCPhaseTimes::SATBFiltering) +
+      phase_times->average_time_ms(G1GCPhaseTimes::UpdateRS) +
+      phase_times->average_time_ms(G1GCPhaseTimes::ScanRS) +
+      phase_times->average_time_ms(G1GCPhaseTimes::ObjCopy) +
+      phase_times->average_time_ms(G1GCPhaseTimes::Termination);
 
     double parallel_other_time = phase_times->cur_collection_par_time_ms() - parallel_known_time;
     _parallel_other.add(parallel_other_time);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -22,13 +22,13 @@
  *
  */
 
-
 #include "precompiled.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/g1/g1GCPhaseTimes.hpp"
 #include "gc_implementation/g1/g1Log.hpp"
 #include "gc_implementation/g1/g1StringDedup.hpp"
-#include "runtime/atomic.inline.hpp"
+#include "memory/allocation.hpp"
+#include "runtime/os.hpp"
 
 // Helper class for avoiding interleaved logging
 class LineBuffer: public StackObj {
@@ -71,184 +71,258 @@
     va_end(ap);
   }
 
+  void print_cr() {
+    gclog_or_tty->print_cr("%s", _buffer);
+    _cur = _indent_level * INDENT_CHARS;
+  }
+
   void append_and_print_cr(const char* format, ...)  ATTRIBUTE_PRINTF(2, 3) {
     va_list ap;
     va_start(ap, format);
     vappend(format, ap);
     va_end(ap);
-    gclog_or_tty->print_cr("%s", _buffer);
-    _cur = _indent_level * INDENT_CHARS;
+    print_cr();
   }
 };
 
-PRAGMA_DIAG_PUSH
-PRAGMA_FORMAT_NONLITERAL_IGNORED
 template <class T>
-void WorkerDataArray<T>::print(int level, const char* title) {
-  if (_length == 1) {
-    // No need for min, max, average and sum for only one worker
-    LineBuffer buf(level);
-    buf.append("[%s:  ", title);
-    buf.append(_print_format, _data[0]);
-    buf.append_and_print_cr("]");
-    return;
+class WorkerDataArray  : public CHeapObj<mtGC> {
+  friend class G1GCParPhasePrinter;
+  T*          _data;
+  uint        _length;
+  const char* _title;
+  bool        _print_sum;
+  int         _log_level;
+  uint        _indent_level;
+  bool        _enabled;
+
+  WorkerDataArray<size_t>* _thread_work_items;
+
+  NOT_PRODUCT(T uninitialized();)
+
+  // We are caching the sum and average to only have to calculate them once.
+  // This is not done in an MT-safe way. It is intended to allow single
+  // threaded code to call sum() and average() multiple times in any order
+  // without having to worry about the cost.
+  bool   _has_new_data;
+  T      _sum;
+  T      _min;
+  T      _max;
+  double _average;
+
+ public:
+  WorkerDataArray(uint length, const char* title, bool print_sum, int log_level, uint indent_level) :
+    _title(title), _length(0), _print_sum(print_sum), _log_level(log_level), _indent_level(indent_level),
+    _has_new_data(true), _thread_work_items(NULL), _enabled(true) {
+    assert(length > 0, "Must have some workers to store data for");
+    _length = length;
+    _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
+  }
+
+  ~WorkerDataArray() {
+    FREE_C_HEAP_ARRAY(T, _data);
+  }
+
+  void link_thread_work_items(WorkerDataArray<size_t>* thread_work_items) {
+    _thread_work_items = thread_work_items;
+  }
+
+  WorkerDataArray<size_t>* thread_work_items() { return _thread_work_items; }
+
+  void set(uint worker_i, T value) {
+    assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length));
+    assert(_data[worker_i] == WorkerDataArray<T>::uninitialized(), err_msg("Overwriting data for worker %d in %s", worker_i, _title));
+    _data[worker_i] = value;
+    _has_new_data = true;
+  }
+
+  void set_thread_work_item(uint worker_i, size_t value) {
+    assert(_thread_work_items != NULL, "No sub count");
+    _thread_work_items->set(worker_i, value);
   }
 
-  T min = _data[0];
-  T max = _data[0];
-  T sum = 0;
+  T get(uint worker_i) {
+    assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length));
+    assert(_data[worker_i] != WorkerDataArray<T>::uninitialized(), err_msg("No data added for worker %d", worker_i));
+    return _data[worker_i];
+  }
+
+  void add(uint worker_i, T value) {
+    assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length));
+    assert(_data[worker_i] != WorkerDataArray<T>::uninitialized(), err_msg("No data to add to for worker %d", worker_i));
+    _data[worker_i] += value;
+    _has_new_data = true;
+  }
 
-  LineBuffer buf(level);
-  buf.append("[%s:", title);
-  for (uint i = 0; i < _length; ++i) {
-    T val = _data[i];
-    min = MIN2(val, min);
-    max = MAX2(val, max);
-    sum += val;
-    if (G1Log::finest()) {
-      buf.append("  ");
-      buf.append(_print_format, val);
-    }
+  double average(){
+    calculate_totals();
+    return _average;
+  }
+
+  T sum() {
+    calculate_totals();
+    return _sum;
+  }
+
+  T minimum() {
+    calculate_totals();
+    return _min;
   }
 
-  if (G1Log::finest()) {
-    buf.append_and_print_cr("%s", "");
+  T maximum() {
+    calculate_totals();
+    return _max;
   }
 
-  double avg = (double)sum / (double)_length;
-  buf.append(" Min: ");
-  buf.append(_print_format, min);
-  buf.append(", Avg: ");
-  buf.append("%.1lf", avg); // Always print average as a double
-  buf.append(", Max: ");
-  buf.append(_print_format, max);
-  buf.append(", Diff: ");
-  buf.append(_print_format, max - min);
-  if (_print_sum) {
-    // for things like the start and end times the sum is not
-    // that relevant
-    buf.append(", Sum: ");
-    buf.append(_print_format, sum);
+  void reset() PRODUCT_RETURN;
+  void verify() PRODUCT_RETURN;
+
+  void set_enabled(bool enabled) { _enabled = enabled; }
+
+  int log_level() { return _log_level;  }
+
+ private:
+
+  void calculate_totals(){
+    if (!_has_new_data) {
+      return;
+    }
+
+    _sum = (T)0;
+    _min = _data[0];
+    _max = _min;
+    for (uint i = 0; i < _length; ++i) {
+      T val = _data[i];
+      _sum += val;
+      _min = MIN2(_min, val);
+      _max = MAX2(_max, val);
+    }
+    _average = (double)_sum / (double)_length;
+    _has_new_data = false;
   }
-  buf.append_and_print_cr("]");
-}
-PRAGMA_DIAG_POP
+};
+
 
 #ifndef PRODUCT
 
-template <> const int WorkerDataArray<int>::_uninitialized = -1;
-template <> const double WorkerDataArray<double>::_uninitialized = -1.0;
-template <> const size_t WorkerDataArray<size_t>::_uninitialized = (size_t)-1;
+template <>
+size_t WorkerDataArray<size_t>::uninitialized() {
+  return (size_t)-1;
+}
+
+template <>
+double WorkerDataArray<double>::uninitialized() {
+  return -1.0;
+}
 
 template <class T>
 void WorkerDataArray<T>::reset() {
   for (uint i = 0; i < _length; i++) {
-    _data[i] = (T)_uninitialized;
+    _data[i] = WorkerDataArray<T>::uninitialized();
+  }
+  if (_thread_work_items != NULL) {
+    _thread_work_items->reset();
   }
 }
 
 template <class T>
 void WorkerDataArray<T>::verify() {
+  if (!_enabled) {
+    return;
+  }
+
   for (uint i = 0; i < _length; i++) {
-    assert(_data[i] != _uninitialized,
-        err_msg("Invalid data for worker %u, data: %lf, uninitialized: %lf",
-            i, (double)_data[i], (double)_uninitialized));
+    assert(_data[i] != WorkerDataArray<T>::uninitialized(),
+        err_msg("Invalid data for worker %u in '%s'", i, _title));
+  }
+  if (_thread_work_items != NULL) {
+    _thread_work_items->verify();
   }
 }
 
 #endif
 
 G1GCPhaseTimes::G1GCPhaseTimes(uint max_gc_threads) :
-  _max_gc_threads(max_gc_threads),
-  _last_gc_worker_start_times_ms(_max_gc_threads, "%.1lf", false),
-  _last_ext_root_scan_times_ms(_max_gc_threads, "%.1lf"),
-  _last_satb_filtering_times_ms(_max_gc_threads, "%.1lf"),
-  _last_update_rs_times_ms(_max_gc_threads, "%.1lf"),
-  _last_update_rs_processed_buffers(_max_gc_threads, "%d"),
-  _last_scan_rs_times_ms(_max_gc_threads, "%.1lf"),
-  _last_strong_code_root_scan_times_ms(_max_gc_threads, "%.1lf"),
-  _last_obj_copy_times_ms(_max_gc_threads, "%.1lf"),
-  _last_termination_times_ms(_max_gc_threads, "%.1lf"),
-  _last_termination_attempts(_max_gc_threads, SIZE_FORMAT),
-  _last_gc_worker_end_times_ms(_max_gc_threads, "%.1lf", false),
-  _last_gc_worker_times_ms(_max_gc_threads, "%.1lf"),
-  _last_gc_worker_other_times_ms(_max_gc_threads, "%.1lf"),
-  _last_redirty_logged_cards_time_ms(_max_gc_threads, "%.1lf"),
-  _last_redirty_logged_cards_processed_cards(_max_gc_threads, SIZE_FORMAT),
-  _cur_string_dedup_queue_fixup_worker_times_ms(_max_gc_threads, "%.1lf"),
-  _cur_string_dedup_table_fixup_worker_times_ms(_max_gc_threads, "%.1lf")
+  _max_gc_threads(max_gc_threads)
 {
   assert(max_gc_threads > 0, "Must have some GC threads");
+
+  _gc_par_phases[GCWorkerStart] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Start (ms)", false, G1Log::LevelFiner, 2);
+  _gc_par_phases[ExtRootScan] = new WorkerDataArray<double>(max_gc_threads, "Ext Root Scanning (ms)", true, G1Log::LevelFiner, 2);
+
+  // Root scanning phases
+  _gc_par_phases[ThreadRoots] = new WorkerDataArray<double>(max_gc_threads, "Thread Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[StringTableRoots] = new WorkerDataArray<double>(max_gc_threads, "StringTable Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[UniverseRoots] = new WorkerDataArray<double>(max_gc_threads, "Universe Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[JNIRoots] = new WorkerDataArray<double>(max_gc_threads, "JNI Handles Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[ObjectSynchronizerRoots] = new WorkerDataArray<double>(max_gc_threads, "ObjectSynchronizer Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[FlatProfilerRoots] = new WorkerDataArray<double>(max_gc_threads, "FlatProfiler Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[ManagementRoots] = new WorkerDataArray<double>(max_gc_threads, "Management Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[SystemDictionaryRoots] = new WorkerDataArray<double>(max_gc_threads, "SystemDictionary Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[CLDGRoots] = new WorkerDataArray<double>(max_gc_threads, "CLDG Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[JVMTIRoots] = new WorkerDataArray<double>(max_gc_threads, "JVMTI Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[CodeCacheRoots] = new WorkerDataArray<double>(max_gc_threads, "CodeCache Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[CMRefRoots] = new WorkerDataArray<double>(max_gc_threads, "CM RefProcessor Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[WaitForStrongCLD] = new WorkerDataArray<double>(max_gc_threads, "Wait For Strong CLD (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[WeakCLDRoots] = new WorkerDataArray<double>(max_gc_threads, "Weak CLD Roots (ms)", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[SATBFiltering] = new WorkerDataArray<double>(max_gc_threads, "SATB Filtering (ms)", true, G1Log::LevelFinest, 3);
+
+  _gc_par_phases[UpdateRS] = new WorkerDataArray<double>(max_gc_threads, "Update RS (ms)", true, G1Log::LevelFiner, 2);
+  _gc_par_phases[ScanRS] = new WorkerDataArray<double>(max_gc_threads, "Scan RS (ms)", true, G1Log::LevelFiner, 2);
+  _gc_par_phases[CodeRoots] = new WorkerDataArray<double>(max_gc_threads, "Code Root Scanning (ms)", true, G1Log::LevelFiner, 2);
+  _gc_par_phases[ObjCopy] = new WorkerDataArray<double>(max_gc_threads, "Object Copy (ms)", true, G1Log::LevelFiner, 2);
+  _gc_par_phases[Termination] = new WorkerDataArray<double>(max_gc_threads, "Termination (ms)", true, G1Log::LevelFiner, 2);
+  _gc_par_phases[GCWorkerTotal] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Total (ms)", true, G1Log::LevelFiner, 2);
+  _gc_par_phases[GCWorkerEnd] = new WorkerDataArray<double>(max_gc_threads, "GC Worker End (ms)", false, G1Log::LevelFiner, 2);
+  _gc_par_phases[Other] = new WorkerDataArray<double>(max_gc_threads, "GC Worker Other (ms)", true, G1Log::LevelFiner, 2);
+
+  _update_rs_processed_buffers = new WorkerDataArray<size_t>(max_gc_threads, "Processed Buffers", true, G1Log::LevelFiner, 3);
+  _gc_par_phases[UpdateRS]->link_thread_work_items(_update_rs_processed_buffers);
+
+  _termination_attempts = new WorkerDataArray<size_t>(max_gc_threads, "Termination Attempts", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[Termination]->link_thread_work_items(_termination_attempts);
+
+  _gc_par_phases[StringDedupQueueFixup] = new WorkerDataArray<double>(max_gc_threads, "Queue Fixup (ms)", true, G1Log::LevelFiner, 2);
+  _gc_par_phases[StringDedupTableFixup] = new WorkerDataArray<double>(max_gc_threads, "Table Fixup (ms)", true, G1Log::LevelFiner, 2);
+
+  _gc_par_phases[RedirtyCards] = new WorkerDataArray<double>(max_gc_threads, "Parallel Redirty", true, G1Log::LevelFinest, 3);
+  _redirtied_cards = new WorkerDataArray<size_t>(max_gc_threads, "Redirtied Cards", true, G1Log::LevelFinest, 3);
+  _gc_par_phases[RedirtyCards]->link_thread_work_items(_redirtied_cards);
 }
 
-void G1GCPhaseTimes::note_gc_start(uint active_gc_threads) {
+void G1GCPhaseTimes::note_gc_start(uint active_gc_threads, bool mark_in_progress) {
   assert(active_gc_threads > 0, "The number of threads must be > 0");
-  assert(active_gc_threads <= _max_gc_threads, "The number of active threads must be <= the max nubmer of threads");
+  assert(active_gc_threads <= _max_gc_threads, "The number of active threads must be <= the max number of threads");
   _active_gc_threads = active_gc_threads;
 
-  _last_gc_worker_start_times_ms.reset();
-  _last_ext_root_scan_times_ms.reset();
-  _last_satb_filtering_times_ms.reset();
-  _last_update_rs_times_ms.reset();
-  _last_update_rs_processed_buffers.reset();
-  _last_scan_rs_times_ms.reset();
-  _last_strong_code_root_scan_times_ms.reset();
-  _last_obj_copy_times_ms.reset();
-  _last_termination_times_ms.reset();
-  _last_termination_attempts.reset();
-  _last_gc_worker_end_times_ms.reset();
-  _last_gc_worker_times_ms.reset();
-  _last_gc_worker_other_times_ms.reset();
+  for (int i = 0; i < GCParPhasesSentinel; i++) {
+    _gc_par_phases[i]->reset();
+  }
 
-  _last_redirty_logged_cards_time_ms.reset();
-  _last_redirty_logged_cards_processed_cards.reset();
-
+  _gc_par_phases[StringDedupQueueFixup]->set_enabled(G1StringDedup::is_enabled());
+  _gc_par_phases[StringDedupTableFixup]->set_enabled(G1StringDedup::is_enabled());
 }
 
 void G1GCPhaseTimes::note_gc_end() {
-  _last_gc_worker_start_times_ms.verify();
-  _last_ext_root_scan_times_ms.verify();
-  _last_satb_filtering_times_ms.verify();
-  _last_update_rs_times_ms.verify();
-  _last_update_rs_processed_buffers.verify();
-  _last_scan_rs_times_ms.verify();
-  _last_strong_code_root_scan_times_ms.verify();
-  _last_obj_copy_times_ms.verify();
-  _last_termination_times_ms.verify();
-  _last_termination_attempts.verify();
-  _last_gc_worker_end_times_ms.verify();
+  for (uint i = 0; i < _active_gc_threads; i++) {
+    double worker_time = _gc_par_phases[GCWorkerEnd]->get(i) - _gc_par_phases[GCWorkerStart]->get(i);
+    record_time_secs(GCWorkerTotal, i , worker_time);
 
-  for (uint i = 0; i < _active_gc_threads; i++) {
-    double worker_time = _last_gc_worker_end_times_ms.get(i) - _last_gc_worker_start_times_ms.get(i);
-    _last_gc_worker_times_ms.set(i, worker_time);
+    double worker_known_time =
+        _gc_par_phases[ExtRootScan]->get(i) +
+        _gc_par_phases[SATBFiltering]->get(i) +
+        _gc_par_phases[UpdateRS]->get(i) +
+        _gc_par_phases[ScanRS]->get(i) +
+        _gc_par_phases[CodeRoots]->get(i) +
+        _gc_par_phases[ObjCopy]->get(i) +
+        _gc_par_phases[Termination]->get(i);
 
-    double worker_known_time = _last_ext_root_scan_times_ms.get(i) +
-                               _last_satb_filtering_times_ms.get(i) +
-                               _last_update_rs_times_ms.get(i) +
-                               _last_scan_rs_times_ms.get(i) +
-                               _last_strong_code_root_scan_times_ms.get(i) +
-                               _last_obj_copy_times_ms.get(i) +
-                               _last_termination_times_ms.get(i);
-
-    double worker_other_time = worker_time - worker_known_time;
-    _last_gc_worker_other_times_ms.set(i, worker_other_time);
+    record_time_secs(Other, i, worker_time - worker_known_time);
   }
 
-  _last_gc_worker_times_ms.verify();
-  _last_gc_worker_other_times_ms.verify();
-
-  _last_redirty_logged_cards_time_ms.verify();
-  _last_redirty_logged_cards_processed_cards.verify();
-}
-
-void G1GCPhaseTimes::note_string_dedup_fixup_start() {
-  _cur_string_dedup_queue_fixup_worker_times_ms.reset();
-  _cur_string_dedup_table_fixup_worker_times_ms.reset();
-}
-
-void G1GCPhaseTimes::note_string_dedup_fixup_end() {
-  _cur_string_dedup_queue_fixup_worker_times_ms.verify();
-  _cur_string_dedup_table_fixup_worker_times_ms.verify();
+  for (int i = 0; i < GCParPhasesSentinel; i++) {
+    _gc_par_phases[i]->verify();
+  }
 }
 
 void G1GCPhaseTimes::print_stats(int level, const char* str, double value) {
@@ -288,35 +362,172 @@
     return misc_time_ms;
 }
 
+// record the time a phase took in seconds
+void G1GCPhaseTimes::record_time_secs(GCParPhases phase, uint worker_i, double secs) {
+  _gc_par_phases[phase]->set(worker_i, secs);
+}
+
+// add a number of seconds to a phase
+void G1GCPhaseTimes::add_time_secs(GCParPhases phase, uint worker_i, double secs) {
+  _gc_par_phases[phase]->add(worker_i, secs);
+}
+
+void G1GCPhaseTimes::record_thread_work_item(GCParPhases phase, uint worker_i, size_t count) {
+  _gc_par_phases[phase]->set_thread_work_item(worker_i, count);
+}
+
+// return the average time for a phase in milliseconds
+double G1GCPhaseTimes::average_time_ms(GCParPhases phase) {
+  return _gc_par_phases[phase]->average() * 1000.0;
+}
+
+double G1GCPhaseTimes::get_time_ms(GCParPhases phase, uint worker_i) {
+  return _gc_par_phases[phase]->get(worker_i) * 1000.0;
+}
+
+double G1GCPhaseTimes::sum_time_ms(GCParPhases phase) {
+  return _gc_par_phases[phase]->sum() * 1000.0;
+}
+
+double G1GCPhaseTimes::min_time_ms(GCParPhases phase) {
+  return _gc_par_phases[phase]->minimum() * 1000.0;
+}
+
+double G1GCPhaseTimes::max_time_ms(GCParPhases phase) {
+  return _gc_par_phases[phase]->maximum() * 1000.0;
+}
+
+size_t G1GCPhaseTimes::get_thread_work_item(GCParPhases phase, uint worker_i) {
+  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
+  return _gc_par_phases[phase]->thread_work_items()->get(worker_i);
+}
+
+size_t G1GCPhaseTimes::sum_thread_work_items(GCParPhases phase) {
+  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
+  return _gc_par_phases[phase]->thread_work_items()->sum();
+}
+
+double G1GCPhaseTimes::average_thread_work_items(GCParPhases phase) {
+  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
+  return _gc_par_phases[phase]->thread_work_items()->average();
+}
+
+size_t G1GCPhaseTimes::min_thread_work_items(GCParPhases phase) {
+  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
+  return _gc_par_phases[phase]->thread_work_items()->minimum();
+}
+
+size_t G1GCPhaseTimes::max_thread_work_items(GCParPhases phase) {
+  assert(_gc_par_phases[phase]->thread_work_items() != NULL, "No sub count");
+  return _gc_par_phases[phase]->thread_work_items()->maximum();
+}
+
+class G1GCParPhasePrinter : public StackObj {
+  G1GCPhaseTimes* _phase_times;
+ public:
+  G1GCParPhasePrinter(G1GCPhaseTimes* phase_times) : _phase_times(phase_times) {}
+
+  void print(G1GCPhaseTimes::GCParPhases phase_id) {
+    WorkerDataArray<double>* phase = _phase_times->_gc_par_phases[phase_id];
+
+    if (phase->_log_level > G1Log::level() || !phase->_enabled) {
+      return;
+    }
+
+    if (phase->_length == 1) {
+      print_single_length(phase_id, phase);
+    } else {
+      print_multi_length(phase_id, phase);
+    }
+  }
+
+ private:
+
+  void print_single_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
+    // No need for min, max, average and sum for only one worker
+    LineBuffer buf(phase->_indent_level);
+    buf.append_and_print_cr("[%s:  %.1lf]", phase->_title, _phase_times->get_time_ms(phase_id, 0));
+
+    if (phase->_thread_work_items != NULL) {
+      LineBuffer buf2(phase->_thread_work_items->_indent_level);
+      buf2.append_and_print_cr("[%s:  "SIZE_FORMAT"]", phase->_thread_work_items->_title, _phase_times->sum_thread_work_items(phase_id));
+    }
+  }
+
+  void print_time_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
+    for (uint i = 0; i < phase->_length; ++i) {
+      buf.append("  %.1lf", _phase_times->get_time_ms(phase_id, i));
+    }
+    buf.print_cr();
+  }
+
+  void print_count_values(LineBuffer& buf, G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
+    for (uint i = 0; i < thread_work_items->_length; ++i) {
+      buf.append("  " SIZE_FORMAT, _phase_times->get_thread_work_item(phase_id, i));
+    }
+    buf.print_cr();
+  }
+
+  void print_thread_work_items(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<size_t>* thread_work_items) {
+    LineBuffer buf(thread_work_items->_indent_level);
+    buf.append("[%s:", thread_work_items->_title);
+
+    if (G1Log::finest()) {
+      print_count_values(buf, phase_id, thread_work_items);
+    }
+
+    assert(thread_work_items->_print_sum, err_msg("%s does not have print sum true even though it is a count", thread_work_items->_title));
+
+    buf.append_and_print_cr(" Min: " SIZE_FORMAT ", Avg: %.1lf, Max: " SIZE_FORMAT ", Diff: " SIZE_FORMAT ", Sum: " SIZE_FORMAT "]",
+        _phase_times->min_thread_work_items(phase_id), _phase_times->average_thread_work_items(phase_id), _phase_times->max_thread_work_items(phase_id),
+        _phase_times->max_thread_work_items(phase_id) - _phase_times->min_thread_work_items(phase_id), _phase_times->sum_thread_work_items(phase_id));
+  }
+
+  void print_multi_length(G1GCPhaseTimes::GCParPhases phase_id, WorkerDataArray<double>* phase) {
+    LineBuffer buf(phase->_indent_level);
+    buf.append("[%s:", phase->_title);
+
+    if (G1Log::finest()) {
+      print_time_values(buf, phase_id, phase);
+    }
+
+    buf.append(" Min: %.1lf, Avg: %.1lf, Max: %.1lf, Diff: %.1lf",
+        _phase_times->min_time_ms(phase_id), _phase_times->average_time_ms(phase_id), _phase_times->max_time_ms(phase_id),
+        _phase_times->max_time_ms(phase_id) - _phase_times->min_time_ms(phase_id));
+
+    if (phase->_print_sum) {
+      // for things like the start and end times the sum is not
+      // that relevant
+      buf.append(", Sum: %.1lf", _phase_times->sum_time_ms(phase_id));
+    }
+
+    buf.append_and_print_cr("]");
+
+    if (phase->_thread_work_items != NULL) {
+      print_thread_work_items(phase_id, phase->_thread_work_items);
+    }
+  }
+};
+
 void G1GCPhaseTimes::print(double pause_time_sec) {
+  G1GCParPhasePrinter par_phase_printer(this);
+
   if (_root_region_scan_wait_time_ms > 0.0) {
     print_stats(1, "Root Region Scan Waiting", _root_region_scan_wait_time_ms);
   }
+
   print_stats(1, "Parallel Time", _cur_collection_par_time_ms, _active_gc_threads);
-  _last_gc_worker_start_times_ms.print(2, "GC Worker Start (ms)");
-  _last_ext_root_scan_times_ms.print(2, "Ext Root Scanning (ms)");
-  if (_last_satb_filtering_times_ms.sum() > 0.0) {
-    _last_satb_filtering_times_ms.print(2, "SATB Filtering (ms)");
+  for (int i = 0; i <= GCMainParPhasesLast; i++) {
+    par_phase_printer.print((GCParPhases) i);
   }
-  _last_update_rs_times_ms.print(2, "Update RS (ms)");
-    _last_update_rs_processed_buffers.print(3, "Processed Buffers");
-  _last_scan_rs_times_ms.print(2, "Scan RS (ms)");
-  _last_strong_code_root_scan_times_ms.print(2, "Code Root Scanning (ms)");
-  _last_obj_copy_times_ms.print(2, "Object Copy (ms)");
-  _last_termination_times_ms.print(2, "Termination (ms)");
-  if (G1Log::finest()) {
-    _last_termination_attempts.print(3, "Termination Attempts");
-  }
-  _last_gc_worker_other_times_ms.print(2, "GC Worker Other (ms)");
-  _last_gc_worker_times_ms.print(2, "GC Worker Total (ms)");
-  _last_gc_worker_end_times_ms.print(2, "GC Worker End (ms)");
 
   print_stats(1, "Code Root Fixup", _cur_collection_code_root_fixup_time_ms);
   print_stats(1, "Code Root Purge", _cur_strong_code_root_purge_time_ms);
   if (G1StringDedup::is_enabled()) {
     print_stats(1, "String Dedup Fixup", _cur_string_dedup_fixup_time_ms, _active_gc_threads);
-    _cur_string_dedup_queue_fixup_worker_times_ms.print(2, "Queue Fixup (ms)");
-    _cur_string_dedup_table_fixup_worker_times_ms.print(2, "Table Fixup (ms)");
+    for (int i = StringDedupPhasesFirst; i <= StringDedupPhasesLast; i++) {
+      par_phase_printer.print((GCParPhases) i);
+    }
   }
   print_stats(1, "Clear CT", _cur_clear_ct_time_ms);
   double misc_time_ms = pause_time_sec * MILLIUNITS - accounted_time_ms();
@@ -340,10 +551,7 @@
   print_stats(2, "Ref Proc", _cur_ref_proc_time_ms);
   print_stats(2, "Ref Enq", _cur_ref_enq_time_ms);
   print_stats(2, "Redirty Cards", _recorded_redirty_logged_cards_time_ms);
-  if (G1Log::finest()) {
-    _last_redirty_logged_cards_time_ms.print(3, "Parallel Redirty");
-    _last_redirty_logged_cards_processed_cards.print(3, "Redirtied Cards");
-  }
+  par_phase_printer.print(RedirtyCards);
   if (G1EagerReclaimHumongousObjects) {
     print_stats(2, "Humongous Register", _cur_fast_reclaim_humongous_register_time_ms);
     if (G1Log::finest()) {
@@ -366,3 +574,17 @@
     print_stats(2, "Verify After", _cur_verify_after_time_ms);
   }
 }
+
+G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id) :
+    _phase_times(phase_times), _phase(phase), _worker_id(worker_id) {
+  if (_phase_times != NULL) {
+    _start_time = os::elapsedTime();
+  }
+}
+
+G1GCParPhaseTimesTracker::~G1GCParPhaseTimesTracker() {
+  if (_phase_times != NULL) {
+    _phase_times->record_time_secs(_phase, _worker_id, os::elapsedTime() - _start_time);
+  }
+}
+
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -26,106 +26,60 @@
 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP
 
 #include "memory/allocation.hpp"
-#include "gc_interface/gcCause.hpp"
-
-template <class T>
-class WorkerDataArray  : public CHeapObj<mtGC> {
-  T*          _data;
-  uint        _length;
-  const char* _print_format;
-  bool        _print_sum;
-
-  NOT_PRODUCT(static const T _uninitialized;)
-
-  // We are caching the sum and average to only have to calculate them once.
-  // This is not done in an MT-safe way. It is intended to allow single
-  // threaded code to call sum() and average() multiple times in any order
-  // without having to worry about the cost.
-  bool   _has_new_data;
-  T      _sum;
-  double _average;
-
- public:
-  WorkerDataArray(uint length, const char* print_format, bool print_sum = true) :
-  _length(length), _print_format(print_format), _print_sum(print_sum), _has_new_data(true) {
-    assert(length > 0, "Must have some workers to store data for");
-    _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
-  }
-
-  ~WorkerDataArray() {
-    FREE_C_HEAP_ARRAY(T, _data);
-  }
-
-  void set(uint worker_i, T value) {
-    assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length));
-    assert(_data[worker_i] == (T)-1, err_msg("Overwriting data for worker %d", worker_i));
-    _data[worker_i] = value;
-    _has_new_data = true;
-  }
 
-  T get(uint worker_i) {
-    assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length));
-    assert(_data[worker_i] != (T)-1, err_msg("No data to add to for worker %d", worker_i));
-    return _data[worker_i];
-  }
-
-  void add(uint worker_i, T value) {
-    assert(worker_i < _length, err_msg("Worker %d is greater than max: %d", worker_i, _length));
-    assert(_data[worker_i] != (T)-1, err_msg("No data to add to for worker %d", worker_i));
-    _data[worker_i] += value;
-    _has_new_data = true;
-  }
-
-  double average(){
-    if (_has_new_data) {
-      calculate_totals();
-    }
-    return _average;
-  }
+class LineBuffer;
 
-  T sum() {
-    if (_has_new_data) {
-      calculate_totals();
-    }
-    return _sum;
-  }
-
-  void print(int level, const char* title);
-
-  void reset() PRODUCT_RETURN;
-  void verify() PRODUCT_RETURN;
-
- private:
-
-  void calculate_totals(){
-    _sum = (T)0;
-    for (uint i = 0; i < _length; ++i) {
-      _sum += _data[i];
-    }
-    _average = (double)_sum / (double)_length;
-    _has_new_data = false;
-  }
-};
+template <class T> class WorkerDataArray;
 
 class G1GCPhaseTimes : public CHeapObj<mtGC> {
+  friend class G1GCParPhasePrinter;
 
- private:
   uint _active_gc_threads;
   uint _max_gc_threads;
 
-  WorkerDataArray<double> _last_gc_worker_start_times_ms;
-  WorkerDataArray<double> _last_ext_root_scan_times_ms;
-  WorkerDataArray<double> _last_satb_filtering_times_ms;
-  WorkerDataArray<double> _last_update_rs_times_ms;
-  WorkerDataArray<int>    _last_update_rs_processed_buffers;
-  WorkerDataArray<double> _last_scan_rs_times_ms;
-  WorkerDataArray<double> _last_strong_code_root_scan_times_ms;
-  WorkerDataArray<double> _last_obj_copy_times_ms;
-  WorkerDataArray<double> _last_termination_times_ms;
-  WorkerDataArray<size_t> _last_termination_attempts;
-  WorkerDataArray<double> _last_gc_worker_end_times_ms;
-  WorkerDataArray<double> _last_gc_worker_times_ms;
-  WorkerDataArray<double> _last_gc_worker_other_times_ms;
+ public:
+  enum GCParPhases {
+    GCWorkerStart,
+    ExtRootScan,
+    ThreadRoots,
+    StringTableRoots,
+    UniverseRoots,
+    JNIRoots,
+    ObjectSynchronizerRoots,
+    FlatProfilerRoots,
+    ManagementRoots,
+    SystemDictionaryRoots,
+    CLDGRoots,
+    JVMTIRoots,
+    CodeCacheRoots,
+    CMRefRoots,
+    WaitForStrongCLD,
+    WeakCLDRoots,
+    SATBFiltering,
+    UpdateRS,
+    ScanRS,
+    CodeRoots,
+    ObjCopy,
+    Termination,
+    Other,
+    GCWorkerTotal,
+    GCWorkerEnd,
+    StringDedupQueueFixup,
+    StringDedupTableFixup,
+    RedirtyCards,
+    GCParPhasesSentinel
+  };
+
+ private:
+  // Markers for grouping the phases in the GCPhases enum above
+  static const int GCMainParPhasesLast = GCWorkerEnd;
+  static const int StringDedupPhasesFirst = StringDedupQueueFixup;
+  static const int StringDedupPhasesLast = StringDedupTableFixup;
+
+  WorkerDataArray<double>* _gc_par_phases[GCParPhasesSentinel];
+  WorkerDataArray<size_t>* _update_rs_processed_buffers;
+  WorkerDataArray<size_t>* _termination_attempts;
+  WorkerDataArray<size_t>* _redirtied_cards;
 
   double _cur_collection_par_time_ms;
   double _cur_collection_code_root_fixup_time_ms;
@@ -135,9 +89,7 @@
   double _cur_evac_fail_restore_remsets;
   double _cur_evac_fail_remove_self_forwards;
 
-  double                  _cur_string_dedup_fixup_time_ms;
-  WorkerDataArray<double> _cur_string_dedup_queue_fixup_worker_times_ms;
-  WorkerDataArray<double> _cur_string_dedup_table_fixup_worker_times_ms;
+  double _cur_string_dedup_fixup_time_ms;
 
   double _cur_clear_ct_time_ms;
   double _cur_ref_proc_time_ms;
@@ -149,8 +101,6 @@
   double _recorded_young_cset_choice_time_ms;
   double _recorded_non_young_cset_choice_time_ms;
 
-  WorkerDataArray<double> _last_redirty_logged_cards_time_ms;
-  WorkerDataArray<size_t> _last_redirty_logged_cards_processed_cards;
   double _recorded_redirty_logged_cards_time_ms;
 
   double _recorded_young_free_cset_time_ms;
@@ -172,54 +122,34 @@
 
  public:
   G1GCPhaseTimes(uint max_gc_threads);
-  void note_gc_start(uint active_gc_threads);
+  void note_gc_start(uint active_gc_threads, bool mark_in_progress);
   void note_gc_end();
   void print(double pause_time_sec);
 
-  void record_gc_worker_start_time(uint worker_i, double ms) {
-    _last_gc_worker_start_times_ms.set(worker_i, ms);
-  }
-
-  void record_ext_root_scan_time(uint worker_i, double ms) {
-    _last_ext_root_scan_times_ms.set(worker_i, ms);
-  }
+  // record the time a phase took in seconds
+  void record_time_secs(GCParPhases phase, uint worker_i, double secs);
 
-  void record_satb_filtering_time(uint worker_i, double ms) {
-    _last_satb_filtering_times_ms.set(worker_i, ms);
-  }
+  // add a number of seconds to a phase
+  void add_time_secs(GCParPhases phase, uint worker_i, double secs);
 
-  void record_update_rs_time(uint worker_i, double ms) {
-    _last_update_rs_times_ms.set(worker_i, ms);
-  }
+  void record_thread_work_item(GCParPhases phase, uint worker_i, size_t count);
 
-  void record_update_rs_processed_buffers(uint worker_i, int processed_buffers) {
-    _last_update_rs_processed_buffers.set(worker_i, processed_buffers);
-  }
+  // return the average time for a phase in milliseconds
+  double average_time_ms(GCParPhases phase);
 
-  void record_scan_rs_time(uint worker_i, double ms) {
-    _last_scan_rs_times_ms.set(worker_i, ms);
-  }
-
-  void record_strong_code_root_scan_time(uint worker_i, double ms) {
-    _last_strong_code_root_scan_times_ms.set(worker_i, ms);
-  }
-
-  void record_obj_copy_time(uint worker_i, double ms) {
-    _last_obj_copy_times_ms.set(worker_i, ms);
-  }
+  size_t sum_thread_work_items(GCParPhases phase);
 
-  void add_obj_copy_time(uint worker_i, double ms) {
-    _last_obj_copy_times_ms.add(worker_i, ms);
-  }
+ private:
+  double get_time_ms(GCParPhases phase, uint worker_i);
+  double sum_time_ms(GCParPhases phase);
+  double min_time_ms(GCParPhases phase);
+  double max_time_ms(GCParPhases phase);
+  size_t get_thread_work_item(GCParPhases phase, uint worker_i);
+  double average_thread_work_items(GCParPhases phase);
+  size_t min_thread_work_items(GCParPhases phase);
+  size_t max_thread_work_items(GCParPhases phase);
 
-  void record_termination(uint worker_i, double ms, size_t attempts) {
-    _last_termination_times_ms.set(worker_i, ms);
-    _last_termination_attempts.set(worker_i, attempts);
-  }
-
-  void record_gc_worker_end_time(uint worker_i, double ms) {
-    _last_gc_worker_end_times_ms.set(worker_i, ms);
-  }
+ public:
 
   void record_clear_ct_time(double ms) {
     _cur_clear_ct_time_ms = ms;
@@ -249,21 +179,10 @@
     _cur_evac_fail_remove_self_forwards = ms;
   }
 
-  void note_string_dedup_fixup_start();
-  void note_string_dedup_fixup_end();
-
   void record_string_dedup_fixup_time(double ms) {
     _cur_string_dedup_fixup_time_ms = ms;
   }
 
-  void record_string_dedup_queue_fixup_worker_time(uint worker_id, double ms) {
-    _cur_string_dedup_queue_fixup_worker_times_ms.set(worker_id, ms);
-  }
-
-  void record_string_dedup_table_fixup_worker_time(uint worker_id, double ms) {
-    _cur_string_dedup_table_fixup_worker_times_ms.set(worker_id, ms);
-  }
-
   void record_ref_proc_time(double ms) {
     _cur_ref_proc_time_ms = ms;
   }
@@ -303,14 +222,6 @@
     _recorded_non_young_cset_choice_time_ms = time_ms;
   }
 
-  void record_redirty_logged_cards_time_ms(uint worker_i, double time_ms) {
-    _last_redirty_logged_cards_time_ms.set(worker_i, time_ms);
-  }
-
-  void record_redirty_logged_cards_processed_cards(uint worker_i, size_t processed_buffers) {
-    _last_redirty_logged_cards_processed_cards.set(worker_i, processed_buffers);
-  }
-
   void record_redirty_logged_cards_time_ms(double time_ms) {
     _recorded_redirty_logged_cards_time_ms = time_ms;
   }
@@ -364,38 +275,16 @@
   double fast_reclaim_humongous_time_ms() {
     return _cur_fast_reclaim_humongous_time_ms;
   }
-
-  double average_last_update_rs_time() {
-    return _last_update_rs_times_ms.average();
-  }
-
-  int sum_last_update_rs_processed_buffers() {
-    return _last_update_rs_processed_buffers.sum();
-  }
-
-  double average_last_scan_rs_time(){
-    return _last_scan_rs_times_ms.average();
-  }
+};
 
-  double average_last_strong_code_root_scan_time(){
-    return _last_strong_code_root_scan_times_ms.average();
-  }
-
-  double average_last_obj_copy_time() {
-    return _last_obj_copy_times_ms.average();
-  }
-
-  double average_last_termination_time() {
-    return _last_termination_times_ms.average();
-  }
-
-  double average_last_ext_root_scan_time() {
-    return _last_ext_root_scan_times_ms.average();
-  }
-
-  double average_last_satb_filtering_times_ms() {
-    return _last_satb_filtering_times_ms.average();
-  }
+class G1GCParPhaseTimesTracker : public StackObj {
+  double _start_time;
+  G1GCPhaseTimes::GCParPhases _phase;
+  G1GCPhaseTimes* _phase_times;
+  uint _worker_id;
+public:
+  G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id);
+  ~G1GCParPhaseTimesTracker();
 };
 
 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Log.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Log.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -28,6 +28,7 @@
 #include "memory/allocation.hpp"
 
 class G1Log : public AllStatic {
+ public:
   typedef enum {
     LevelNone,
     LevelFine,
@@ -35,6 +36,7 @@
     LevelFinest
   } LogLevel;
 
+ private:
   static LogLevel _level;
 
  public:
@@ -50,6 +52,10 @@
     return _level == LevelFinest;
   }
 
+  static LogLevel level() {
+    return _level;
+  }
+
   static void init();
 };
 
--- a/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1MarkSweep.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -31,6 +31,7 @@
 #include "code/icBuffer.hpp"
 #include "gc_implementation/g1/g1Log.hpp"
 #include "gc_implementation/g1/g1MarkSweep.hpp"
+#include "gc_implementation/g1/g1RootProcessor.hpp"
 #include "gc_implementation/g1/g1StringDedup.hpp"
 #include "gc_implementation/shared/gcHeapSummary.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
@@ -125,21 +126,22 @@
   GCTraceTime tm("phase 1", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id());
   GenMarkSweep::trace(" 1");
 
-  SharedHeap* sh = SharedHeap::heap();
+  G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
   // Need cleared claim bits for the roots processing
   ClassLoaderDataGraph::clear_claimed_marks();
 
   MarkingCodeBlobClosure follow_code_closure(&GenMarkSweep::follow_root_closure, !CodeBlobToOopClosure::FixRelocations);
-  sh->process_strong_roots(true,   // activate StrongRootsScope
-                           SharedHeap::SO_None,
-                           &GenMarkSweep::follow_root_closure,
-                           &GenMarkSweep::follow_cld_closure,
-                           &follow_code_closure);
+  {
+    G1RootProcessor root_processor(g1h);
+    root_processor.process_strong_roots(&GenMarkSweep::follow_root_closure,
+                                        &GenMarkSweep::follow_cld_closure,
+                                        &follow_code_closure);
+  }
 
   // Process reference objects found during marking
   ReferenceProcessor* rp = GenMarkSweep::ref_processor();
-  assert(rp == G1CollectedHeap::heap()->ref_processor_stw(), "Sanity");
+  assert(rp == g1h->ref_processor_stw(), "Sanity");
 
   rp->setup_policy(clear_all_softrefs);
   const ReferenceProcessorStats& stats =
@@ -225,6 +227,12 @@
   }
 };
 
+class G1AlwaysTrueClosure: public BoolObjectClosure {
+public:
+  bool do_object_b(oop p) { return true; }
+};
+static G1AlwaysTrueClosure always_true;
+
 void G1MarkSweep::mark_sweep_phase3() {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
 
@@ -232,24 +240,23 @@
   GCTraceTime tm("phase 3", G1Log::fine() && Verbose, true, gc_timer(), gc_tracer()->gc_id());
   GenMarkSweep::trace("3");
 
-  SharedHeap* sh = SharedHeap::heap();
-
   // Need cleared claim bits for the roots processing
   ClassLoaderDataGraph::clear_claimed_marks();
 
   CodeBlobToOopClosure adjust_code_closure(&GenMarkSweep::adjust_pointer_closure, CodeBlobToOopClosure::FixRelocations);
-  sh->process_all_roots(true,  // activate StrongRootsScope
-                        SharedHeap::SO_AllCodeCache,
-                        &GenMarkSweep::adjust_pointer_closure,
-                        &GenMarkSweep::adjust_cld_closure,
-                        &adjust_code_closure);
+  {
+    G1RootProcessor root_processor(g1h);
+    root_processor.process_all_roots(&GenMarkSweep::adjust_pointer_closure,
+                                     &GenMarkSweep::adjust_cld_closure,
+                                     &adjust_code_closure);
+  }
 
   assert(GenMarkSweep::ref_processor() == g1h->ref_processor_stw(), "Sanity");
   g1h->ref_processor_stw()->weak_oops_do(&GenMarkSweep::adjust_pointer_closure);
 
   // Now adjust pointers in remaining weak roots.  (All of which should
   // have been cleared if they pointed to non-surviving objects.)
-  sh->process_weak_roots(&GenMarkSweep::adjust_pointer_closure);
+  JNIHandles::weak_oops_do(&always_true, &GenMarkSweep::adjust_pointer_closure);
 
   if (G1StringDedup::is_enabled()) {
     G1StringDedup::oops_do(&GenMarkSweep::adjust_pointer_closure);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1OopClosures.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -109,6 +109,18 @@
   template <class T> void do_klass_barrier(T* p, oop new_obj);
 };
 
+enum G1Barrier {
+  G1BarrierNone,
+  G1BarrierEvac,
+  G1BarrierKlass
+};
+
+enum G1Mark {
+  G1MarkNone,
+  G1MarkFromRoot,
+  G1MarkPromotedFromRoot
+};
+
 template <G1Barrier barrier, G1Mark do_mark_object>
 class G1ParCopyClosure : public G1ParCopyHelper {
 private:
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -226,6 +226,8 @@
   }
 
   assert(obj_ptr != NULL, "when we get here, allocation should have succeeded");
+  assert(_g1h->is_in_reserved(obj_ptr), "Allocated memory should be in the heap");
+
 #ifndef PRODUCT
   // Should this evacuation fail?
   if (_g1h->evacuation_should_fail()) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RegionToSpaceMapper.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,9 @@
  public:
   MemRegion reserved() { return _storage.reserved(); }
 
+  size_t reserved_size() { return _storage.reserved_size(); }
+  size_t committed_size() { return _storage.committed_size(); }
+
   void set_mapping_changed_listener(G1MappingChangedListener* listener) { _listener = listener; }
 
   virtual ~G1RegionToSpaceMapper() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,7 +79,6 @@
     _cards_scanned(NULL), _total_cards_scanned(0),
     _prev_period_summary()
 {
-  _seq_task = new SubTasksDone(NumSeqTasks);
   _cset_rs_update_cl = NEW_C_HEAP_ARRAY(G1ParPushHeapRSClosure*, n_workers(), mtGC);
   for (uint i = 0; i < n_workers(); i++) {
     _cset_rs_update_cl[i] = NULL;
@@ -90,7 +89,6 @@
 }
 
 G1RemSet::~G1RemSet() {
-  delete _seq_task;
   for (uint i = 0; i < n_workers(); i++) {
     assert(_cset_rs_update_cl[i] == NULL, "it should be");
   }
@@ -109,7 +107,7 @@
 
   double _strong_code_root_scan_time_sec;
   uint   _worker_i;
-  int    _block_size;
+  size_t _block_size;
   bool   _try_claimed;
 
 public:
@@ -127,7 +125,7 @@
     _g1h = G1CollectedHeap::heap();
     _bot_shared = _g1h->bot_shared();
     _ct_bs = _g1h->g1_barrier_set();
-    _block_size = MAX2<int>(G1RSetScanBlockSize, 1);
+    _block_size = MAX2<size_t>(G1RSetScanBlockSize, 1);
   }
 
   void set_try_claimed() { _try_claimed = true; }
@@ -248,9 +246,8 @@
   assert(_cards_scanned != NULL, "invariant");
   _cards_scanned[worker_i] = scanRScl.cards_done();
 
-  _g1p->phase_times()->record_scan_rs_time(worker_i, scan_rs_time_sec * 1000.0);
-  _g1p->phase_times()->record_strong_code_root_scan_time(worker_i,
-                                                         scanRScl.strong_code_root_scan_time_sec() * 1000.0);
+  _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::ScanRS, worker_i, scan_rs_time_sec);
+  _g1p->phase_times()->record_time_secs(G1GCPhaseTimes::CodeRoots, worker_i, scanRScl.strong_code_root_scan_time_sec());
 }
 
 // Closure used for updating RSets and recording references that
@@ -287,13 +284,11 @@
 };
 
 void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) {
-  double start = os::elapsedTime();
+  G1GCParPhaseTimesTracker x(_g1p->phase_times(), G1GCPhaseTimes::UpdateRS, worker_i);
   // Apply the given closure to all remaining log entries.
   RefineRecordRefsIntoCSCardTableEntryClosure into_cset_update_rs_cl(_g1, into_cset_dcq);
 
   _g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, into_cset_dcq, false, worker_i);
-
-  _g1p->phase_times()->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0);
 }
 
 void G1RemSet::cleanupHRRS() {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -58,7 +58,6 @@
   };
 
   CardTableModRefBS*     _ct_bs;
-  SubTasksDone*          _seq_task;
   G1CollectorPolicy*     _g1p;
 
   ConcurrentG1Refine*    _cg1r;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+
+#include "classfile/stringTable.hpp"
+#include "classfile/systemDictionary.hpp"
+#include "code/codeCache.hpp"
+#include "gc_implementation/g1/bufferingOopClosure.hpp"
+#include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
+#include "gc_implementation/g1/g1CollectorPolicy.hpp"
+#include "gc_implementation/g1/g1GCPhaseTimes.hpp"
+#include "gc_implementation/g1/g1RemSet.inline.hpp"
+#include "gc_implementation/g1/g1RootProcessor.hpp"
+#include "memory/allocation.inline.hpp"
+#include "runtime/fprofiler.hpp"
+#include "runtime/mutex.hpp"
+#include "services/management.hpp"
+
+class G1CodeBlobClosure : public CodeBlobClosure {
+  class HeapRegionGatheringOopClosure : public OopClosure {
+    G1CollectedHeap* _g1h;
+    OopClosure* _work;
+    nmethod* _nm;
+
+    template <typename T>
+    void do_oop_work(T* p) {
+      _work->do_oop(p);
+      T oop_or_narrowoop = oopDesc::load_heap_oop(p);
+      if (!oopDesc::is_null(oop_or_narrowoop)) {
+        oop o = oopDesc::decode_heap_oop_not_null(oop_or_narrowoop);
+        HeapRegion* hr = _g1h->heap_region_containing_raw(o);
+        assert(!_g1h->obj_in_cs(o) || hr->rem_set()->strong_code_roots_list_contains(_nm), "if o still in CS then evacuation failed and nm must already be in the remset");
+        hr->add_strong_code_root(_nm);
+      }
+    }
+
+  public:
+    HeapRegionGatheringOopClosure(OopClosure* oc) : _g1h(G1CollectedHeap::heap()), _work(oc), _nm(NULL) {}
+
+    void do_oop(oop* o) {
+      do_oop_work(o);
+    }
+
+    void do_oop(narrowOop* o) {
+      do_oop_work(o);
+    }
+
+    void set_nm(nmethod* nm) {
+      _nm = nm;
+    }
+  };
+
+  HeapRegionGatheringOopClosure _oc;
+public:
+  G1CodeBlobClosure(OopClosure* oc) : _oc(oc) {}
+
+  void do_code_blob(CodeBlob* cb) {
+    nmethod* nm = cb->as_nmethod_or_null();
+    if (nm != NULL) {
+      if (!nm->test_set_oops_do_mark()) {
+        _oc.set_nm(nm);
+        nm->oops_do(&_oc);
+        nm->fix_oop_relocations();
+      }
+    }
+  }
+};
+
+
+void G1RootProcessor::worker_has_discovered_all_strong_classes() {
+  uint n_workers = _g1h->n_par_threads();
+  assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
+
+  uint new_value = (uint)Atomic::add(1, &_n_workers_discovered_strong_classes);
+  if (new_value == n_workers) {
+    // This thread is last. Notify the others.
+    MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
+    _lock.notify_all();
+  }
+}
+
+void G1RootProcessor::wait_until_all_strong_classes_discovered() {
+  uint n_workers = _g1h->n_par_threads();
+  assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
+
+  if ((uint)_n_workers_discovered_strong_classes != n_workers) {
+    MonitorLockerEx ml(&_lock, Mutex::_no_safepoint_check_flag);
+    while ((uint)_n_workers_discovered_strong_classes != n_workers) {
+      _lock.wait(Mutex::_no_safepoint_check_flag, 0, false);
+    }
+  }
+}
+
+G1RootProcessor::G1RootProcessor(G1CollectedHeap* g1h) :
+    _g1h(g1h),
+    _process_strong_tasks(new SubTasksDone(G1RP_PS_NumElements)),
+    _srs(g1h),
+    _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never),
+    _n_workers_discovered_strong_classes(0) {}
+
+void G1RootProcessor::evacuate_roots(OopClosure* scan_non_heap_roots,
+                                     OopClosure* scan_non_heap_weak_roots,
+                                     CLDClosure* scan_strong_clds,
+                                     CLDClosure* scan_weak_clds,
+                                     bool trace_metadata,
+                                     uint worker_i) {
+  // First scan the shared roots.
+  double ext_roots_start = os::elapsedTime();
+  G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times();
+
+  BufferingOopClosure buf_scan_non_heap_roots(scan_non_heap_roots);
+  BufferingOopClosure buf_scan_non_heap_weak_roots(scan_non_heap_weak_roots);
+
+  OopClosure* const weak_roots = &buf_scan_non_heap_weak_roots;
+  OopClosure* const strong_roots = &buf_scan_non_heap_roots;
+
+  // CodeBlobClosures are not interoperable with BufferingOopClosures
+  G1CodeBlobClosure root_code_blobs(scan_non_heap_roots);
+
+  process_java_roots(strong_roots,
+                     trace_metadata ? scan_strong_clds : NULL,
+                     scan_strong_clds,
+                     trace_metadata ? NULL : scan_weak_clds,
+                     &root_code_blobs,
+                     phase_times,
+                     worker_i);
+
+  // This is the point where this worker thread will not find more strong CLDs/nmethods.
+  // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing.
+  if (trace_metadata) {
+    worker_has_discovered_all_strong_classes();
+  }
+
+  process_vm_roots(strong_roots, weak_roots, phase_times, worker_i);
+
+  {
+    // Now the CM ref_processor roots.
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CMRefRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_refProcessor_oops_do)) {
+      // We need to treat the discovered reference lists of the
+      // concurrent mark ref processor as roots and keep entries
+      // (which are added by the marking threads) on them live
+      // until they can be processed at the end of marking.
+      _g1h->ref_processor_cm()->weak_oops_do(&buf_scan_non_heap_roots);
+    }
+  }
+
+  if (trace_metadata) {
+    {
+      G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WaitForStrongCLD, worker_i);
+      // Barrier to make sure all workers passed
+      // the strong CLD and strong nmethods phases.
+      wait_until_all_strong_classes_discovered();
+    }
+
+    // Now take the complement of the strong CLDs.
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::WeakCLDRoots, worker_i);
+    ClassLoaderDataGraph::roots_cld_do(NULL, scan_weak_clds);
+  } else {
+    phase_times->record_time_secs(G1GCPhaseTimes::WaitForStrongCLD, worker_i, 0.0);
+    phase_times->record_time_secs(G1GCPhaseTimes::WeakCLDRoots, worker_i, 0.0);
+  }
+
+  // Finish up any enqueued closure apps (attributed as object copy time).
+  buf_scan_non_heap_roots.done();
+  buf_scan_non_heap_weak_roots.done();
+
+  double obj_copy_time_sec = buf_scan_non_heap_roots.closure_app_seconds()
+      + buf_scan_non_heap_weak_roots.closure_app_seconds();
+
+  phase_times->record_time_secs(G1GCPhaseTimes::ObjCopy, worker_i, obj_copy_time_sec);
+
+  double ext_root_time_sec = os::elapsedTime() - ext_roots_start - obj_copy_time_sec;
+
+  phase_times->record_time_secs(G1GCPhaseTimes::ExtRootScan, worker_i, ext_root_time_sec);
+
+  // During conc marking we have to filter the per-thread SATB buffers
+  // to make sure we remove any oops into the CSet (which will show up
+  // as implicitly live).
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SATBFiltering, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_filter_satb_buffers) && _g1h->mark_in_progress()) {
+      JavaThread::satb_mark_queue_set().filter_thread_buffers();
+    }
+  }
+
+  _process_strong_tasks->all_tasks_completed();
+}
+
+void G1RootProcessor::process_strong_roots(OopClosure* oops,
+                                           CLDClosure* clds,
+                                           CodeBlobClosure* blobs) {
+
+  process_java_roots(oops, clds, clds, NULL, blobs, NULL, 0);
+  process_vm_roots(oops, NULL, NULL, 0);
+
+  _process_strong_tasks->all_tasks_completed();
+}
+
+void G1RootProcessor::process_all_roots(OopClosure* oops,
+                                        CLDClosure* clds,
+                                        CodeBlobClosure* blobs) {
+
+  process_java_roots(oops, NULL, clds, clds, NULL, NULL, 0);
+  process_vm_roots(oops, oops, NULL, 0);
+
+  if (!_process_strong_tasks->is_task_claimed(G1RP_PS_CodeCache_oops_do)) {
+    CodeCache::blobs_do(blobs);
+  }
+
+  _process_strong_tasks->all_tasks_completed();
+}
+
+void G1RootProcessor::process_java_roots(OopClosure* strong_roots,
+                                         CLDClosure* thread_stack_clds,
+                                         CLDClosure* strong_clds,
+                                         CLDClosure* weak_clds,
+                                         CodeBlobClosure* strong_code,
+                                         G1GCPhaseTimes* phase_times,
+                                         uint worker_i) {
+  assert(thread_stack_clds == NULL || weak_clds == NULL, "There is overlap between those, only one may be set");
+  // Iterating over the CLDG and the Threads are done early to allow us to
+  // first process the strong CLDs and nmethods and then, after a barrier,
+  // let the thread process the weak CLDs and nmethods.
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CLDGRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_ClassLoaderDataGraph_oops_do)) {
+      ClassLoaderDataGraph::roots_cld_do(strong_clds, weak_clds);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ThreadRoots, worker_i);
+    Threads::possibly_parallel_oops_do(strong_roots, thread_stack_clds, strong_code);
+  }
+}
+
+void G1RootProcessor::process_vm_roots(OopClosure* strong_roots,
+                                       OopClosure* weak_roots,
+                                       G1GCPhaseTimes* phase_times,
+                                       uint worker_i) {
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::UniverseRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Universe_oops_do)) {
+      Universe::oops_do(strong_roots);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JNIRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_JNIHandles_oops_do)) {
+      JNIHandles::oops_do(strong_roots);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ObjectSynchronizerRoots, worker_i);
+    if (!_process_strong_tasks-> is_task_claimed(G1RP_PS_ObjectSynchronizer_oops_do)) {
+      ObjectSynchronizer::oops_do(strong_roots);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::FlatProfilerRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_FlatProfiler_oops_do)) {
+      FlatProfiler::oops_do(strong_roots);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::ManagementRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_Management_oops_do)) {
+      Management::oops_do(strong_roots);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::JVMTIRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_jvmti_oops_do)) {
+      JvmtiExport::oops_do(strong_roots);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::SystemDictionaryRoots, worker_i);
+    if (!_process_strong_tasks->is_task_claimed(G1RP_PS_SystemDictionary_oops_do)) {
+      SystemDictionary::roots_oops_do(strong_roots, weak_roots);
+    }
+  }
+
+  {
+    G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::StringTableRoots, worker_i);
+    // All threads execute the following. A specific chunk of buckets
+    // from the StringTable are the individual tasks.
+    if (weak_roots != NULL) {
+      StringTable::possibly_parallel_oops_do(weak_roots);
+    }
+  }
+}
+
+void G1RootProcessor::scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
+                                           OopClosure* scan_non_heap_weak_roots,
+                                           uint worker_i) {
+  G1GCPhaseTimes* phase_times = _g1h->g1_policy()->phase_times();
+  G1GCParPhaseTimesTracker x(phase_times, G1GCPhaseTimes::CodeCacheRoots, worker_i);
+
+  // Now scan the complement of the collection set.
+  G1CodeBlobClosure scavenge_cs_nmethods(scan_non_heap_weak_roots);
+
+  _g1h->g1_rem_set()->oops_into_collection_set_do(scan_rs, &scavenge_cs_nmethods, worker_i);
+}
+
+void G1RootProcessor::set_num_workers(int active_workers) {
+  _process_strong_tasks->set_n_threads(active_workers);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RootProcessor.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP
+
+#include "memory/allocation.hpp"
+#include "memory/sharedHeap.hpp"
+#include "runtime/mutex.hpp"
+
+class CLDClosure;
+class CodeBlobClosure;
+class G1CollectedHeap;
+class G1GCPhaseTimes;
+class G1ParPushHeapRSClosure;
+class Monitor;
+class OopClosure;
+class SubTasksDone;
+
+// Scoped object to assist in applying oop, CLD and code blob closures to
+// root locations. Handles claiming of different root scanning tasks
+// and takes care of global state for root scanning via a StrongRootsScope.
+// In the parallel case there is a shared G1RootProcessor object where all
+// worker thread call the process_roots methods.
+class G1RootProcessor : public StackObj {
+  G1CollectedHeap* _g1h;
+  SubTasksDone* _process_strong_tasks;
+  SharedHeap::StrongRootsScope _srs;
+
+  // Used to implement the Thread work barrier.
+  Monitor _lock;
+  volatile jint _n_workers_discovered_strong_classes;
+
+  enum G1H_process_roots_tasks {
+    G1RP_PS_Universe_oops_do,
+    G1RP_PS_JNIHandles_oops_do,
+    G1RP_PS_ObjectSynchronizer_oops_do,
+    G1RP_PS_FlatProfiler_oops_do,
+    G1RP_PS_Management_oops_do,
+    G1RP_PS_SystemDictionary_oops_do,
+    G1RP_PS_ClassLoaderDataGraph_oops_do,
+    G1RP_PS_jvmti_oops_do,
+    G1RP_PS_CodeCache_oops_do,
+    G1RP_PS_filter_satb_buffers,
+    G1RP_PS_refProcessor_oops_do,
+    // Leave this one last.
+    G1RP_PS_NumElements
+  };
+
+  void worker_has_discovered_all_strong_classes();
+  void wait_until_all_strong_classes_discovered();
+
+  void process_java_roots(OopClosure* scan_non_heap_roots,
+                          CLDClosure* thread_stack_clds,
+                          CLDClosure* scan_strong_clds,
+                          CLDClosure* scan_weak_clds,
+                          CodeBlobClosure* scan_strong_code,
+                          G1GCPhaseTimes* phase_times,
+                          uint worker_i);
+
+  void process_vm_roots(OopClosure* scan_non_heap_roots,
+                        OopClosure* scan_non_heap_weak_roots,
+                        G1GCPhaseTimes* phase_times,
+                        uint worker_i);
+
+public:
+  G1RootProcessor(G1CollectedHeap* g1h);
+
+  // Apply closures to the strongly and weakly reachable roots in the system
+  // in a single pass.
+  // Record and report timing measurements for sub phases using the worker_i
+  void evacuate_roots(OopClosure* scan_non_heap_roots,
+                      OopClosure* scan_non_heap_weak_roots,
+                      CLDClosure* scan_strong_clds,
+                      CLDClosure* scan_weak_clds,
+                      bool trace_metadata,
+                      uint worker_i);
+
+  // Apply oops, clds and blobs to all strongly reachable roots in the system
+  void process_strong_roots(OopClosure* oops,
+                            CLDClosure* clds,
+                            CodeBlobClosure* blobs);
+
+  // Apply oops, clds and blobs to strongly and weakly reachable roots in the system
+  void process_all_roots(OopClosure* oops,
+                         CLDClosure* clds,
+                         CodeBlobClosure* blobs);
+
+  // Apply scan_rs to all locations in the union of the remembered sets for all
+  // regions in the collection set
+  // (having done "set_region" to indicate the region in which the root resides),
+  void scan_remembered_sets(G1ParPushHeapRSClosure* scan_rs,
+                            OopClosure* scan_non_heap_weak_roots,
+                            uint worker_i);
+
+  // Inform the root processor about the number of worker threads
+  void set_num_workers(int active_workers);
+};
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_ROOTPROCESSOR_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -106,7 +106,7 @@
 
 void G1StringDedup::oops_do(OopClosure* keep_alive) {
   assert(is_enabled(), "String deduplication not enabled");
-  unlink_or_oops_do(NULL, keep_alive);
+  unlink_or_oops_do(NULL, keep_alive, true /* allow_resize_and_rehash */);
 }
 
 void G1StringDedup::unlink(BoolObjectClosure* is_alive) {
@@ -123,45 +123,39 @@
 class G1StringDedupUnlinkOrOopsDoTask : public AbstractGangTask {
 private:
   G1StringDedupUnlinkOrOopsDoClosure _cl;
+  G1GCPhaseTimes* _phase_times;
 
 public:
   G1StringDedupUnlinkOrOopsDoTask(BoolObjectClosure* is_alive,
                                   OopClosure* keep_alive,
-                                  bool allow_resize_and_rehash) :
+                                  bool allow_resize_and_rehash,
+                                  G1GCPhaseTimes* phase_times) :
     AbstractGangTask("G1StringDedupUnlinkOrOopsDoTask"),
-    _cl(is_alive, keep_alive, allow_resize_and_rehash) {
-  }
+    _cl(is_alive, keep_alive, allow_resize_and_rehash), _phase_times(phase_times) { }
 
   virtual void work(uint worker_id) {
-    double queue_fixup_start = os::elapsedTime();
-    G1StringDedupQueue::unlink_or_oops_do(&_cl);
-
-    double table_fixup_start = os::elapsedTime();
-    G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id);
-
-    double queue_fixup_time_ms = (table_fixup_start - queue_fixup_start) * 1000.0;
-    double table_fixup_time_ms = (os::elapsedTime() - table_fixup_start) * 1000.0;
-    G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
-    g1p->phase_times()->record_string_dedup_queue_fixup_worker_time(worker_id, queue_fixup_time_ms);
-    g1p->phase_times()->record_string_dedup_table_fixup_worker_time(worker_id, table_fixup_time_ms);
+    {
+      G1GCParPhaseTimesTracker x(_phase_times, G1GCPhaseTimes::StringDedupQueueFixup, worker_id);
+      G1StringDedupQueue::unlink_or_oops_do(&_cl);
+    }
+    {
+      G1GCParPhaseTimesTracker x(_phase_times, G1GCPhaseTimes::StringDedupTableFixup, worker_id);
+      G1StringDedupTable::unlink_or_oops_do(&_cl, worker_id);
+    }
   }
 };
 
-void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive, bool allow_resize_and_rehash) {
+void G1StringDedup::unlink_or_oops_do(BoolObjectClosure* is_alive,
+                                      OopClosure* keep_alive,
+                                      bool allow_resize_and_rehash,
+                                      G1GCPhaseTimes* phase_times) {
   assert(is_enabled(), "String deduplication not enabled");
-  G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy();
-  g1p->phase_times()->note_string_dedup_fixup_start();
-  double fixup_start = os::elapsedTime();
 
-  G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash);
+  G1StringDedupUnlinkOrOopsDoTask task(is_alive, keep_alive, allow_resize_and_rehash, phase_times);
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   g1h->set_par_threads();
   g1h->workers()->run_task(&task);
   g1h->set_par_threads(0);
-
-  double fixup_time_ms = (os::elapsedTime() - fixup_start) * 1000.0;
-  g1p->phase_times()->record_string_dedup_fixup_time(fixup_time_ms);
-  g1p->phase_times()->note_string_dedup_fixup_end();
 }
 
 void G1StringDedup::threads_do(ThreadClosure* tc) {
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedup.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -91,6 +91,7 @@
 class ThreadClosure;
 class outputStream;
 class G1StringDedupTable;
+class G1GCPhaseTimes;
 
 //
 // Main interface for interacting with string deduplication.
@@ -131,7 +132,7 @@
   static void oops_do(OopClosure* keep_alive);
   static void unlink(BoolObjectClosure* is_alive);
   static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive,
-                                bool allow_resize_and_rehash = true);
+                                bool allow_resize_and_rehash, G1GCPhaseTimes* phase_times = NULL);
 
   static void threads_do(ThreadClosure* tc);
   static void print_worker_threads_on(outputStream* st);
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -86,7 +86,7 @@
           "If true, enable reference discovery during concurrent "          \
           "marking and reference processing at the end of remark.")         \
                                                                             \
-  product(intx, G1SATBBufferSize, 1*K,                                      \
+  product(size_t, G1SATBBufferSize, 1*K,                                    \
           "Number of entries in an SATB log buffer.")                       \
                                                                             \
   develop(intx, G1SATBProcessCompletedThreshold, 20,                        \
@@ -112,7 +112,7 @@
             "Prints the liveness information for all regions in the heap "  \
             "at the end of a marking cycle.")                               \
                                                                             \
-  product(intx, G1UpdateBufferSize, 256,                                    \
+  product(size_t, G1UpdateBufferSize, 256,                                  \
           "Size of an update buffer")                                       \
                                                                             \
   product(intx, G1ConcRefinementYellowZone, 0,                              \
@@ -148,7 +148,7 @@
           "Select green, yellow and red zones adaptively to meet the "      \
           "the pause requirements.")                                        \
                                                                             \
-  product(uintx, G1ConcRSLogCacheSize, 10,                                  \
+  product(size_t, G1ConcRSLogCacheSize, 10,                                 \
           "Log base 2 of the length of conc RS hot-card cache.")            \
                                                                             \
   product(uintx, G1ConcRSHotCardLimit, 4,                                   \
@@ -210,7 +210,7 @@
           "When set, G1 will fail when it encounters an FP 'error', "       \
           "so as to allow debugging")                                       \
                                                                             \
-  product(uintx, G1HeapRegionSize, 0,                                       \
+  product(size_t, G1HeapRegionSize, 0,                                      \
           "Size of the G1 regions.")                                        \
                                                                             \
   product(uintx, G1ConcRefinementThreads, 0,                                \
@@ -220,7 +220,7 @@
   develop(bool, G1VerifyCTCleanup, false,                                   \
           "Verify card table cleanup.")                                     \
                                                                             \
-  product(uintx, G1RSetScanBlockSize, 64,                                   \
+  product(size_t, G1RSetScanBlockSize, 64,                                  \
           "Size of a work unit of cards claimed by a worker thread"         \
           "during RSet scanning.")                                          \
                                                                             \
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_specialized_oop_closures.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,23 +30,8 @@
 // non-virtually, using a mechanism defined in this file.  Extend these
 // macros in the obvious way to add specializations for new closures.
 
-enum G1Barrier {
-  G1BarrierNone,
-  G1BarrierEvac,
-  G1BarrierKlass
-};
-
-enum G1Mark {
-  G1MarkNone,
-  G1MarkFromRoot,
-  G1MarkPromotedFromRoot
-};
-
 // Forward declarations.
 
-template<G1Barrier barrier, G1Mark do_mark_object>
-class G1ParCopyClosure;
-
 class G1ParScanClosure;
 class G1ParPushHeapRSClosure;
 
@@ -61,26 +46,16 @@
 class G1InvokeIfNotTriggeredClosure;
 class G1UpdateRSOrPushRefOopClosure;
 
-#ifdef FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES
-#error "FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES already defined."
-#endif
-
-#define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \
-      f(G1ParScanClosure,_nv)                           \
-      f(G1ParPushHeapRSClosure,_nv)                     \
-      f(FilterIntoCSClosure,_nv)                        \
-      f(FilterOutOfRegionClosure,_nv)                   \
-      f(G1CMOopClosure,_nv)                             \
-      f(G1RootRegionScanClosure,_nv)                    \
-      f(G1Mux2Closure,_nv)                              \
-      f(G1TriggerClosure,_nv)                           \
-      f(G1InvokeIfNotTriggeredClosure,_nv)              \
+#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f) \
+      f(G1ParScanClosure,_nv)                      \
+      f(G1ParPushHeapRSClosure,_nv)                \
+      f(FilterIntoCSClosure,_nv)                   \
+      f(FilterOutOfRegionClosure,_nv)              \
+      f(G1CMOopClosure,_nv)                        \
+      f(G1RootRegionScanClosure,_nv)               \
+      f(G1Mux2Closure,_nv)                         \
+      f(G1TriggerClosure,_nv)                      \
+      f(G1InvokeIfNotTriggeredClosure,_nv)         \
       f(G1UpdateRSOrPushRefOopClosure,_nv)
 
-#ifdef FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES
-#error "FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES already defined."
-#endif
-
-#define FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f)
-
 #endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1_SPECIALIZED_OOP_CLOSURES_HPP
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -106,18 +106,18 @@
 }
 
 void HeapRegion::setup_heap_region_size(size_t initial_heap_size, size_t max_heap_size) {
-  uintx region_size = G1HeapRegionSize;
+  size_t region_size = G1HeapRegionSize;
   if (FLAG_IS_DEFAULT(G1HeapRegionSize)) {
     size_t average_heap_size = (initial_heap_size + max_heap_size) / 2;
     region_size = MAX2(average_heap_size / HeapRegionBounds::target_number(),
-                       (uintx) HeapRegionBounds::min_size());
+                       HeapRegionBounds::min_size());
   }
 
   int region_size_log = log2_long((jlong) region_size);
   // Recalculate the region size to make sure it's a power of
   // 2. This means that region_size is the largest power of 2 that's
   // <= what we've calculated so far.
-  region_size = ((uintx)1 << region_size_log);
+  region_size = ((size_t)1 << region_size_log);
 
   // Now make sure that we don't go over or under our limits.
   if (region_size < HeapRegionBounds::min_size()) {
@@ -139,7 +139,7 @@
   guarantee(GrainBytes == 0, "we should only set it once");
   // The cast to int is safe, given that we've bounded region_size by
   // MIN_REGION_SIZE and MAX_REGION_SIZE.
-  GrainBytes = (size_t)region_size;
+  GrainBytes = region_size;
 
   guarantee(GrainWords == 0, "we should only set it once");
   GrainWords = GrainBytes >> LogHeapWordSize;
@@ -933,6 +933,16 @@
   _offsets.resize(new_end - bottom());
 }
 
+#ifndef PRODUCT
+void G1OffsetTableContigSpace::mangle_unused_area() {
+  mangle_unused_area_complete();
+}
+
+void G1OffsetTableContigSpace::mangle_unused_area_complete() {
+  SpaceMangler::mangle_region(MemRegion(top(), end()));
+}
+#endif
+
 void G1OffsetTableContigSpace::print() const {
   print_short();
   gclog_or_tty->print_cr(" [" INTPTR_FORMAT ", " INTPTR_FORMAT ", "
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -27,7 +27,6 @@
 
 #include "gc_implementation/g1/g1AllocationContext.hpp"
 #include "gc_implementation/g1/g1BlockOffsetTable.hpp"
-#include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
 #include "gc_implementation/g1/heapRegionType.hpp"
 #include "gc_implementation/g1/survRateGroup.hpp"
 #include "gc_implementation/shared/ageTable.hpp"
@@ -155,6 +154,9 @@
   void set_bottom(HeapWord* value);
   void set_end(HeapWord* value);
 
+  void mangle_unused_area() PRODUCT_RETURN;
+  void mangle_unused_area_complete() PRODUCT_RETURN;
+
   HeapWord* scan_top() const;
   void record_timestamp();
   void reset_gc_time_stamp() { _gc_time_stamp = 0; }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -145,6 +145,24 @@
   }
 }
 
+MemoryUsage HeapRegionManager::get_auxiliary_data_memory_usage() const {
+  size_t used_sz =
+    _prev_bitmap_mapper->committed_size() +
+    _next_bitmap_mapper->committed_size() +
+    _bot_mapper->committed_size() +
+    _cardtable_mapper->committed_size() +
+    _card_counts_mapper->committed_size();
+
+  size_t committed_sz =
+    _prev_bitmap_mapper->reserved_size() +
+    _next_bitmap_mapper->reserved_size() +
+    _bot_mapper->reserved_size() +
+    _cardtable_mapper->reserved_size() +
+    _card_counts_mapper->reserved_size();
+
+  return MemoryUsage(0, used_sz, committed_sz, committed_sz);
+}
+
 uint HeapRegionManager::expand_by(uint num_regions) {
   return expand_at(0, num_regions);
 }
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 #include "gc_implementation/g1/g1BiasedArray.hpp"
 #include "gc_implementation/g1/g1RegionToSpaceMapper.hpp"
 #include "gc_implementation/g1/heapRegionSet.hpp"
+#include "services/memoryUsage.hpp"
 
 class HeapRegion;
 class HeapRegionClosure;
@@ -196,6 +197,8 @@
   // Return the maximum number of regions in the heap.
   uint max_length() const { return (uint)_regions.length(); }
 
+  MemoryUsage get_auxiliary_data_memory_usage() const;
+
   MemRegion reserved() const { return MemRegion(heap_bottom(), heap_end()); }
 
   // Expand the sequence to reflect that the heap has grown. Either create new
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/parNew/parOopClosures.inline.hpp"
@@ -325,7 +326,7 @@
 private:
   ParallelTaskTerminator& _term;
   ParNewGeneration&       _gen;
-  Generation&             _next_gen;
+  Generation&             _old_gen;
  public:
   bool is_valid(int id) const { return id < length(); }
   ParallelTaskTerminator* terminator() { return &_term; }
@@ -338,7 +339,7 @@
   Stack<oop, mtGC>* overflow_stacks,
   size_t desired_plab_sz, ParallelTaskTerminator& term)
   : ResourceArray(sizeof(ParScanThreadState), num_threads),
-    _gen(gen), _next_gen(old_gen), _term(term)
+    _gen(gen), _old_gen(old_gen), _term(term)
 {
   assert(num_threads > 0, "sanity check!");
   assert(ParGCUseLocalOverflow == (overflow_stacks != NULL),
@@ -471,8 +472,8 @@
     _gen.age_table()->merge(local_table);
 
     // Inform old gen that we're done.
-    _next_gen.par_promote_alloc_done(i);
-    _next_gen.par_oop_since_save_marks_iterate_done(i);
+    _old_gen.par_promote_alloc_done(i);
+    _old_gen.par_oop_since_save_marks_iterate_done(i);
   }
 
   if (UseConcMarkSweepGC) {
@@ -574,10 +575,10 @@
   par_scan_state()->end_term_time();
 }
 
-ParNewGenTask::ParNewGenTask(ParNewGeneration* gen, Generation* next_gen,
-                HeapWord* young_old_boundary, ParScanThreadStateSet* state_set) :
+ParNewGenTask::ParNewGenTask(ParNewGeneration* gen, Generation* old_gen,
+                             HeapWord* young_old_boundary, ParScanThreadStateSet* state_set) :
     AbstractGangTask("ParNewGeneration collection"),
-    _gen(gen), _next_gen(next_gen),
+    _gen(gen), _old_gen(old_gen),
     _young_old_boundary(young_old_boundary),
     _state_set(state_set)
   {}
@@ -601,8 +602,6 @@
   // We would need multiple old-gen queues otherwise.
   assert(gch->n_gens() == 2, "Par young collection currently only works with one older gen.");
 
-  Generation* old_gen = gch->next_gen(_gen);
-
   ParScanThreadState& par_scan_state = _state_set->thread_state(worker_id);
   assert(_state_set->is_valid(worker_id), "Should not have been called");
 
@@ -619,7 +618,7 @@
                          true,  // Process younger gens, if any,
                                 // as strong roots.
                          false, // no scope; this is parallel code
-                         SharedHeap::SO_ScavengeCodeCache,
+                         GenCollectedHeap::SO_ScavengeCodeCache,
                          GenCollectedHeap::StrongAndWeakRoots,
                          &par_scan_state.to_space_root_closure(),
                          &par_scan_state.older_gen_closure(),
@@ -763,8 +762,9 @@
 class ParNewRefProcTaskProxy: public AbstractGangTask {
   typedef AbstractRefProcTaskExecutor::ProcessTask ProcessTask;
 public:
-  ParNewRefProcTaskProxy(ProcessTask& task, ParNewGeneration& gen,
-                         Generation& next_gen,
+  ParNewRefProcTaskProxy(ProcessTask& task,
+                         ParNewGeneration& gen,
+                         Generation& old_gen,
                          HeapWord* young_old_boundary,
                          ParScanThreadStateSet& state_set);
 
@@ -776,20 +776,20 @@
 private:
   ParNewGeneration&      _gen;
   ProcessTask&           _task;
-  Generation&            _next_gen;
+  Generation&            _old_gen;
   HeapWord*              _young_old_boundary;
   ParScanThreadStateSet& _state_set;
 };
 
-ParNewRefProcTaskProxy::ParNewRefProcTaskProxy(
-    ProcessTask& task, ParNewGeneration& gen,
-    Generation& next_gen,
-    HeapWord* young_old_boundary,
-    ParScanThreadStateSet& state_set)
+ParNewRefProcTaskProxy::ParNewRefProcTaskProxy(ProcessTask& task,
+                                               ParNewGeneration& gen,
+                                               Generation& old_gen,
+                                               HeapWord* young_old_boundary,
+                                               ParScanThreadStateSet& state_set)
   : AbstractGangTask("ParNewGeneration parallel reference processing"),
     _gen(gen),
     _task(task),
-    _next_gen(next_gen),
+    _old_gen(old_gen),
     _young_old_boundary(young_old_boundary),
     _state_set(state_set)
 {
@@ -893,7 +893,7 @@
   from()->set_next_compaction_space(to());
   gch->set_incremental_collection_failed();
   // Inform the next generation that a promotion failure occurred.
-  _next_gen->promotion_failure_occurred();
+  _old_gen->promotion_failure_occurred();
 
   // Trace promotion failure in the parallel GC threads
   thread_state_set.trace_promotion_failed(gc_tracer());
@@ -927,7 +927,7 @@
   workers->set_active_workers(active_workers);
   assert(gch->n_gens() == 2,
          "Par collection currently only works with single older gen.");
-  _next_gen = gch->next_gen(this);
+  _old_gen = gch->old_gen();
 
   // If the next generation is too full to accommodate worst-case promotion
   // from this generation, pass on collection; let the next generation
@@ -952,8 +952,6 @@
   // Capture heap used before collection (for printing).
   size_t gch_prev_used = gch->used();
 
-  SpecializationStats::clear();
-
   age_table()->clear();
   to()->clear(SpaceDecorator::Mangle);
 
@@ -968,10 +966,10 @@
   // because only those workers go through the termination protocol.
   ParallelTaskTerminator _term(n_workers, task_queues());
   ParScanThreadStateSet thread_state_set(workers->active_workers(),
-                                         *to(), *this, *_next_gen, *task_queues(),
+                                         *to(), *this, *_old_gen, *task_queues(),
                                          _overflow_stacks, desired_plab_sz(), _term);
 
-  ParNewGenTask tsk(this, _next_gen, reserved().end(), &thread_state_set);
+  ParNewGenTask tsk(this, _old_gen, reserved().end(), &thread_state_set);
   gch->set_par_threads(n_workers);
   gch->rem_set()->prepare_for_younger_refs_iterate(true);
   // It turns out that even when we're using 1 thread, doing the work in a
@@ -1073,8 +1071,6 @@
   jlong now = os::javaTimeNanos() / NANOSECS_PER_MILLISEC;
   update_time_of_last_gc(now);
 
-  SpecializationStats::print();
-
   rp->set_enqueuing_is_done(true);
   if (rp->processing_is_mt()) {
     ParNewRefProcTaskExecutor task_executor(*this, thread_state_set);
@@ -1127,14 +1123,6 @@
   return forward_ptr;
 }
 
-#ifdef ASSERT
-bool ParNewGeneration::is_legal_forward_ptr(oop p) {
-  return
-    (p == ClaimedForwardPtr)
-    || Universe::heap()->is_in_reserved(p);
-}
-#endif
-
 void ParNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) {
   if (m->must_be_preserved_for_promotion_failure(obj)) {
     // We should really have separate per-worker stacks, rather
@@ -1191,8 +1179,8 @@
     }
 
     if (!_promotion_failed) {
-      new_obj = _next_gen->par_promote(par_scan_state->thread_num(),
-                                        old, m, sz);
+      new_obj = _old_gen->par_promote(par_scan_state->thread_num(),
+                                      old, m, sz);
     }
 
     if (new_obj == NULL) {
@@ -1209,6 +1197,7 @@
   } else {
     // Is in to-space; do copying ourselves.
     Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)new_obj, sz);
+    assert(Universe::heap()->is_in_reserved(new_obj), "illegal forwarding pointer value.");
     forward_ptr = old->forward_to_atomic(new_obj);
     // Restore the mark word copied above.
     new_obj->set_mark(m);
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
 #define SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
 
+#include "gc_implementation/parNew/parOopClosures.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
 #include "gc_implementation/shared/copyFailedInfo.hpp"
@@ -233,13 +234,13 @@
 class ParNewGenTask: public AbstractGangTask {
  private:
   ParNewGeneration*            _gen;
-  Generation*                  _next_gen;
+  Generation*                  _old_gen;
   HeapWord*                    _young_old_boundary;
   class ParScanThreadStateSet* _state_set;
 
 public:
   ParNewGenTask(ParNewGeneration*      gen,
-                Generation*            next_gen,
+                Generation*            old_gen,
                 HeapWord*              young_old_boundary,
                 ParScanThreadStateSet* state_set);
 
@@ -419,8 +420,6 @@
   }
 
   static oop real_forwardee(oop obj);
-
-  DEBUG_ONLY(static bool is_legal_forward_ptr(oop p);)
 };
 
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARNEWGENERATION_HPP
--- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
 #include "gc_implementation/parNew/parOopClosures.hpp"
 #include "memory/cardTableRS.hpp"
 #include "memory/genCollectedHeap.hpp"
+#include "memory/genOopClosures.inline.hpp"
 
 template <class T> inline void ParScanWeakRefClosure::do_oop_work(T* p) {
   assert (!oopDesc::is_null(*p), "null weak reference?");
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/pcTasks.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "code/codeCache.hpp"
+#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #include "gc_implementation/parallelScavenge/pcTasks.hpp"
 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
 #include "gc_implementation/shared/gcTimer.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #define SHARE_VM_GC_IMPLEMENTATION_PARALLELSCAVENGE_PSMARKSWEEP_HPP
 
 #include "gc_implementation/shared/collectorCounters.hpp"
-#include "gc_implementation/shared/markSweep.inline.hpp"
+#include "gc_implementation/shared/markSweep.hpp"
 #include "utilities/stack.hpp"
 
 class PSAdaptiveSizePolicy;
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,6 @@
 #include "gc_implementation/parallelScavenge/parMarkBitMap.hpp"
 #include "gc_implementation/parallelScavenge/psCompactionManager.hpp"
 #include "gc_implementation/shared/collectorCounters.hpp"
-#include "gc_implementation/shared/markSweep.hpp"
 #include "gc_implementation/shared/mutableSpace.hpp"
 #include "memory/sharedHeap.hpp"
 #include "oops/oop.hpp"
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include "memory/padded.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/oop.psgc.inline.hpp"
+#include "utilities/stack.inline.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psTasks.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -40,6 +40,7 @@
 #include "runtime/thread.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/management.hpp"
+#include "utilities/stack.inline.hpp"
 #include "utilities/taskqueue.hpp"
 
 //
--- a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,3 +63,20 @@
                                      _space->capacity(), CHECK);
   }
 }
+
+void CSpaceCounters::update_capacity() {
+  _capacity->set_value(_space->capacity());
+}
+
+void CSpaceCounters::update_used() {
+  _used->set_value(_space->used());
+}
+
+void CSpaceCounters::update_all() {
+  update_used();
+  update_capacity();
+}
+
+jlong ContiguousSpaceUsedHelper::take_sample(){
+  return _space->used();
+}
--- a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_CSPACECOUNTERS_HPP
 
 #include "gc_implementation/shared/generationCounters.hpp"
-#include "memory/space.inline.hpp"
+#include "memory/space.hpp"
 #include "runtime/perfData.hpp"
 
 // A CSpaceCounters is a holder class for performance counters
@@ -56,18 +56,9 @@
       if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
-  virtual inline void update_capacity() {
-    _capacity->set_value(_space->capacity());
-  }
-
-  virtual inline void update_used() {
-    _used->set_value(_space->used());
-  }
-
-  virtual inline void update_all() {
-    update_used();
-    update_capacity();
-  }
+  virtual void update_capacity();
+  virtual void update_used();
+  virtual void update_all();
 
   const char* name_space() const        { return _name_space; }
 };
@@ -79,9 +70,7 @@
   public:
     ContiguousSpaceUsedHelper(ContiguousSpace* space) : _space(space) { }
 
-    inline jlong take_sample() {
-      return _space->used();
-    }
+    jlong take_sample();
 };
 
 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_CSPACECOUNTERS_HPP
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -84,6 +84,14 @@
 
 void MarkSweep::FollowStackClosure::do_void() { follow_stack(); }
 
+void PreservedMark::adjust_pointer() {
+  MarkSweep::adjust_pointer(&_obj);
+}
+
+void PreservedMark::restore() {
+  _obj->set_mark(_mark);
+}
+
 // We preserve the mark which should be replaced at the end and the location
 // that it will go.  Note that the object that this markOop belongs to isn't
 // currently at that address but it will be after phase4
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
 #define SHARE_VM_GC_IMPLEMENTATION_SHARED_MARKSWEEP_HPP
 
 #include "gc_interface/collectedHeap.hpp"
-#include "memory/universe.hpp"
+#include "memory/genOopClosures.hpp"
+#include "memory/iterator.hpp"
 #include "oops/markOop.hpp"
 #include "oops/oop.hpp"
 #include "runtime/timer.hpp"
@@ -182,13 +183,8 @@
     _mark = mark;
   }
 
-  void adjust_pointer() {
-    MarkSweep::adjust_pointer(&_obj);
-  }
-
-  void restore() {
-    _obj->set_mark(_mark);
-  }
+  void adjust_pointer();
+  void restore();
 };
 
 #endif // SHARE_VM_GC_IMPLEMENTATION_SHARED_MARKSWEEP_HPP
--- a/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/gc_implementation/shared/vmGCOperations.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -98,7 +98,7 @@
   if (!is_init_completed()) {
     vm_exit_during_initialization(
       err_msg("GC triggered before VM initialization completed. Try increasing "
-              "NewSize, current value " UINTX_FORMAT "%s.",
+              "NewSize, current value " SIZE_FORMAT "%s.",
               byte_size_in_proper_unit(NewSize),
               proper_unit_for_byte_size(NewSize)));
   }
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -27,7 +27,7 @@
 #include "memory/cardTableRS.hpp"
 #include "memory/genCollectedHeap.hpp"
 #include "memory/generation.hpp"
-#include "memory/space.hpp"
+#include "memory/space.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/java.hpp"
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -104,15 +104,15 @@
 
   // User inputs from -Xmx and -Xms must be aligned
   _min_heap_byte_size = align_size_up(_min_heap_byte_size, _heap_alignment);
-  uintx aligned_initial_heap_size = align_size_up(InitialHeapSize, _heap_alignment);
-  uintx aligned_max_heap_size = align_size_up(MaxHeapSize, _heap_alignment);
+  size_t aligned_initial_heap_size = align_size_up(InitialHeapSize, _heap_alignment);
+  size_t aligned_max_heap_size = align_size_up(MaxHeapSize, _heap_alignment);
 
   // Write back to flags if the values changed
   if (aligned_initial_heap_size != InitialHeapSize) {
-    FLAG_SET_ERGO(uintx, InitialHeapSize, aligned_initial_heap_size);
+    FLAG_SET_ERGO(size_t, InitialHeapSize, aligned_initial_heap_size);
   }
   if (aligned_max_heap_size != MaxHeapSize) {
-    FLAG_SET_ERGO(uintx, MaxHeapSize, aligned_max_heap_size);
+    FLAG_SET_ERGO(size_t, MaxHeapSize, aligned_max_heap_size);
   }
 
   if (FLAG_IS_CMDLINE(InitialHeapSize) && _min_heap_byte_size != 0 &&
@@ -120,9 +120,9 @@
     vm_exit_during_initialization("Incompatible minimum and initial heap sizes specified");
   }
   if (!FLAG_IS_DEFAULT(InitialHeapSize) && InitialHeapSize > MaxHeapSize) {
-    FLAG_SET_ERGO(uintx, MaxHeapSize, InitialHeapSize);
+    FLAG_SET_ERGO(size_t, MaxHeapSize, InitialHeapSize);
   } else if (!FLAG_IS_DEFAULT(MaxHeapSize) && InitialHeapSize > MaxHeapSize) {
-    FLAG_SET_ERGO(uintx, InitialHeapSize, MaxHeapSize);
+    FLAG_SET_ERGO(size_t, InitialHeapSize, MaxHeapSize);
     if (InitialHeapSize < _min_heap_byte_size) {
       _min_heap_byte_size = InitialHeapSize;
     }
@@ -131,7 +131,7 @@
   _initial_heap_byte_size = InitialHeapSize;
   _max_heap_byte_size = MaxHeapSize;
 
-  FLAG_SET_ERGO(uintx, MinHeapDeltaBytes, align_size_up(MinHeapDeltaBytes, _space_alignment));
+  FLAG_SET_ERGO(size_t, MinHeapDeltaBytes, align_size_up(MinHeapDeltaBytes, _space_alignment));
 
   DEBUG_ONLY(CollectorPolicy::assert_flags();)
 }
@@ -282,18 +282,18 @@
   // All generational heaps have a youngest gen; handle those flags here
 
   // Make sure the heap is large enough for two generations
-  uintx smallest_new_size = young_gen_size_lower_bound();
-  uintx smallest_heap_size = align_size_up(smallest_new_size + align_size_up(_space_alignment, _gen_alignment),
+  size_t smallest_new_size = young_gen_size_lower_bound();
+  size_t smallest_heap_size = align_size_up(smallest_new_size + align_size_up(_space_alignment, _gen_alignment),
                                            _heap_alignment);
   if (MaxHeapSize < smallest_heap_size) {
-    FLAG_SET_ERGO(uintx, MaxHeapSize, smallest_heap_size);
+    FLAG_SET_ERGO(size_t, MaxHeapSize, smallest_heap_size);
     _max_heap_byte_size = MaxHeapSize;
   }
   // If needed, synchronize _min_heap_byte size and _initial_heap_byte_size
   if (_min_heap_byte_size < smallest_heap_size) {
     _min_heap_byte_size = smallest_heap_size;
     if (InitialHeapSize < _min_heap_byte_size) {
-      FLAG_SET_ERGO(uintx, InitialHeapSize, smallest_heap_size);
+      FLAG_SET_ERGO(size_t, InitialHeapSize, smallest_heap_size);
       _initial_heap_byte_size = smallest_heap_size;
     }
   }
@@ -306,8 +306,8 @@
 
   // Now take the actual NewSize into account. We will silently increase NewSize
   // if the user specified a smaller or unaligned value.
-  uintx bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize);
-  bounded_new_size = MAX2(smallest_new_size, (uintx)align_size_down(bounded_new_size, _gen_alignment));
+  size_t bounded_new_size = bound_minus_alignment(NewSize, MaxHeapSize);
+  bounded_new_size = MAX2(smallest_new_size, (size_t)align_size_down(bounded_new_size, _gen_alignment));
   if (bounded_new_size != NewSize) {
     // Do not use FLAG_SET_ERGO to update NewSize here, since this will override
     // if NewSize was set on the command line or not. This information is needed
@@ -320,21 +320,21 @@
   if (!FLAG_IS_DEFAULT(MaxNewSize)) {
     if (MaxNewSize >= MaxHeapSize) {
       // Make sure there is room for an old generation
-      uintx smaller_max_new_size = MaxHeapSize - _gen_alignment;
+      size_t smaller_max_new_size = MaxHeapSize - _gen_alignment;
       if (FLAG_IS_CMDLINE(MaxNewSize)) {
         warning("MaxNewSize (" SIZE_FORMAT "k) is equal to or greater than the entire "
                 "heap (" SIZE_FORMAT "k).  A new max generation size of " SIZE_FORMAT "k will be used.",
                 MaxNewSize/K, MaxHeapSize/K, smaller_max_new_size/K);
       }
-      FLAG_SET_ERGO(uintx, MaxNewSize, smaller_max_new_size);
+      FLAG_SET_ERGO(size_t, MaxNewSize, smaller_max_new_size);
       if (NewSize > MaxNewSize) {
-        FLAG_SET_ERGO(uintx, NewSize, MaxNewSize);
+        FLAG_SET_ERGO(size_t, NewSize, MaxNewSize);
         _initial_young_size = NewSize;
       }
     } else if (MaxNewSize < _initial_young_size) {
-      FLAG_SET_ERGO(uintx, MaxNewSize, _initial_young_size);
+      FLAG_SET_ERGO(size_t, MaxNewSize, _initial_young_size);
     } else if (!is_size_aligned(MaxNewSize, _gen_alignment)) {
-      FLAG_SET_ERGO(uintx, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment));
+      FLAG_SET_ERGO(size_t, MaxNewSize, align_size_down(MaxNewSize, _gen_alignment));
     }
     _max_young_size = MaxNewSize;
   }
@@ -347,7 +347,7 @@
               "A new max generation size of " SIZE_FORMAT "k will be used.",
               NewSize/K, MaxNewSize/K, NewSize/K);
     }
-    FLAG_SET_ERGO(uintx, MaxNewSize, NewSize);
+    FLAG_SET_ERGO(size_t, MaxNewSize, NewSize);
     _max_young_size = MaxNewSize;
   }
 
@@ -369,9 +369,9 @@
     size_t calculated_heapsize = (OldSize / NewRatio) * (NewRatio + 1);
 
     calculated_heapsize = align_size_up(calculated_heapsize, _heap_alignment);
-    FLAG_SET_ERGO(uintx, MaxHeapSize, calculated_heapsize);
+    FLAG_SET_ERGO(size_t, MaxHeapSize, calculated_heapsize);
     _max_heap_byte_size = MaxHeapSize;
-    FLAG_SET_ERGO(uintx, InitialHeapSize, calculated_heapsize);
+    FLAG_SET_ERGO(size_t, InitialHeapSize, calculated_heapsize);
     _initial_heap_byte_size = InitialHeapSize;
   }
 
@@ -380,19 +380,19 @@
     if (_max_heap_size_cmdline) {
       // Somebody has set a maximum heap size with the intention that we should not
       // exceed it. Adjust New/OldSize as necessary.
-      uintx calculated_size = NewSize + OldSize;
+      size_t calculated_size = NewSize + OldSize;
       double shrink_factor = (double) MaxHeapSize / calculated_size;
-      uintx smaller_new_size = align_size_down((uintx)(NewSize * shrink_factor), _gen_alignment);
-      FLAG_SET_ERGO(uintx, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size));
+      size_t smaller_new_size = align_size_down((size_t)(NewSize * shrink_factor), _gen_alignment);
+      FLAG_SET_ERGO(size_t, NewSize, MAX2(young_gen_size_lower_bound(), smaller_new_size));
       _initial_young_size = NewSize;
 
       // OldSize is already aligned because above we aligned MaxHeapSize to
       // _heap_alignment, and we just made sure that NewSize is aligned to
       // _gen_alignment. In initialize_flags() we verified that _heap_alignment
       // is a multiple of _gen_alignment.
-      FLAG_SET_ERGO(uintx, OldSize, MaxHeapSize - NewSize);
+      FLAG_SET_ERGO(size_t, OldSize, MaxHeapSize - NewSize);
     } else {
-      FLAG_SET_ERGO(uintx, MaxHeapSize, align_size_up(NewSize + OldSize, _heap_alignment));
+      FLAG_SET_ERGO(size_t, MaxHeapSize, align_size_up(NewSize + OldSize, _heap_alignment));
       _max_heap_byte_size = MaxHeapSize;
     }
   }
@@ -405,7 +405,7 @@
       // Need to compare against the flag value for max since _max_young_size
       // might not have been set yet.
       if (new_size >= _min_young_size && new_size <= MaxNewSize) {
-        FLAG_SET_ERGO(uintx, NewSize, new_size);
+        FLAG_SET_ERGO(size_t, NewSize, new_size);
         _initial_young_size = NewSize;
       }
     }
@@ -561,15 +561,15 @@
 
   // Write back to flags if necessary.
   if (NewSize != _initial_young_size) {
-    FLAG_SET_ERGO(uintx, NewSize, _initial_young_size);
+    FLAG_SET_ERGO(size_t, NewSize, _initial_young_size);
   }
 
   if (MaxNewSize != _max_young_size) {
-    FLAG_SET_ERGO(uintx, MaxNewSize, _max_young_size);
+    FLAG_SET_ERGO(size_t, MaxNewSize, _max_young_size);
   }
 
   if (OldSize != _initial_old_size) {
-    FLAG_SET_ERGO(uintx, OldSize, _initial_old_size);
+    FLAG_SET_ERGO(size_t, OldSize, _initial_old_size);
   }
 
   if (PrintGCDetails && Verbose) {
@@ -601,7 +601,7 @@
     HandleMark hm; // Discard any handles allocated in each iteration.
 
     // First allocation attempt is lock-free.
-    Generation *young = gch->get_gen(0);
+    Generation *young = gch->young_gen();
     assert(young->supports_inline_contig_alloc(),
       "Otherwise, must do alloc within heap lock");
     if (young->should_allocate(size, is_tlab)) {
@@ -615,8 +615,8 @@
     {
       MutexLocker ml(Heap_lock);
       if (PrintGC && Verbose) {
-        gclog_or_tty->print_cr("TwoGenerationCollectorPolicy::mem_allocate_work:"
-                      " attempting locked slow path allocation");
+        gclog_or_tty->print_cr("GenCollectorPolicy::mem_allocate_work:"
+                               " attempting locked slow path allocation");
       }
       // Note that only large objects get a shot at being
       // allocated in later generations.
@@ -705,7 +705,7 @@
     // Give a warning if we seem to be looping forever.
     if ((QueuedAllocationWarningCount > 0) &&
         (try_count % QueuedAllocationWarningCount == 0)) {
-          warning("TwoGenerationCollectorPolicy::mem_allocate_work retries %d times \n\t"
+          warning("GenCollectorPolicy::mem_allocate_work retries %d times \n\t"
                   " size=" SIZE_FORMAT " %s", try_count, size, is_tlab ? "(TLAB)" : "");
     }
   }
@@ -715,10 +715,14 @@
                                                        bool   is_tlab) {
   GenCollectedHeap *gch = GenCollectedHeap::heap();
   HeapWord* result = NULL;
-  for (int i = number_of_generations() - 1; i >= 0 && result == NULL; i--) {
-    Generation *gen = gch->get_gen(i);
-    if (gen->should_allocate(size, is_tlab)) {
-      result = gen->expand_and_allocate(size, is_tlab);
+  Generation *old = gch->old_gen();
+  if (old->should_allocate(size, is_tlab)) {
+    result = old->expand_and_allocate(size, is_tlab);
+  }
+  if (result == NULL) {
+    Generation *young = gch->young_gen();
+    if (young->should_allocate(size, is_tlab)) {
+      result = young->expand_and_allocate(size, is_tlab);
     }
   }
   assert(result == NULL || gch->is_in_reserved(result), "result not in heap");
@@ -891,7 +895,7 @@
 bool GenCollectorPolicy::should_try_older_generation_allocation(
         size_t word_size) const {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  size_t young_capacity = gch->get_gen(0)->capacity_before_gc();
+  size_t young_capacity = gch->young_gen()->capacity_before_gc();
   return    (word_size > heap_word_size(young_capacity))
          || GC_locker::is_active_and_needs_gc()
          || gch->incremental_collection_failed();
@@ -903,7 +907,7 @@
 //
 
 void MarkSweepPolicy::initialize_alignments() {
-  _space_alignment = _gen_alignment = (uintx)Generation::GenGrain;
+  _space_alignment = _gen_alignment = (size_t)Generation::GenGrain;
   _heap_alignment = compute_heap_alignment();
 }
 
@@ -935,18 +939,18 @@
     // for both min and initial young size if less than min heap.
     flag_value = 20 * M;
     set_basic_flag_values();
-    FLAG_SET_CMDLINE(uintx, NewSize, flag_value);
+    FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
     verify_young_min(flag_value);
 
     set_basic_flag_values();
-    FLAG_SET_CMDLINE(uintx, NewSize, flag_value);
+    FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
     verify_young_initial(flag_value);
 
     // If NewSize is set on command line, but is larger than the min
     // heap size, it should only be used for initial young size.
     flag_value = 80 * M;
     set_basic_flag_values();
-    FLAG_SET_CMDLINE(uintx, NewSize, flag_value);
+    FLAG_SET_CMDLINE(size_t, NewSize, flag_value);
     verify_young_initial(flag_value);
 
     // If NewSize has been ergonomically set, the collector policy
@@ -954,11 +958,11 @@
     // using NewRatio.
     flag_value = 20 * M;
     set_basic_flag_values();
-    FLAG_SET_ERGO(uintx, NewSize, flag_value);
+    FLAG_SET_ERGO(size_t, NewSize, flag_value);
     verify_young_min(flag_value);
 
     set_basic_flag_values();
-    FLAG_SET_ERGO(uintx, NewSize, flag_value);
+    FLAG_SET_ERGO(size_t, NewSize, flag_value);
     verify_scaled_young_initial(InitialHeapSize);
 
     restore_flags();
@@ -974,11 +978,11 @@
     // for both min and initial old size if less than min heap.
     flag_value = 20 * M;
     set_basic_flag_values();
-    FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
+    FLAG_SET_CMDLINE(size_t, OldSize, flag_value);
     verify_old_min(flag_value);
 
     set_basic_flag_values();
-    FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
+    FLAG_SET_CMDLINE(size_t, OldSize, flag_value);
     // Calculate what we expect the flag to be.
     size_t expected_old_initial = align_size_up(InitialHeapSize, heap_alignment) - MaxNewSize;
     verify_old_initial(expected_old_initial);
@@ -989,10 +993,10 @@
     // We intentionally set MaxNewSize + OldSize > MaxHeapSize (see over_size).
     flag_value = 30 * M;
     set_basic_flag_values();
-    FLAG_SET_CMDLINE(uintx, OldSize, flag_value);
+    FLAG_SET_CMDLINE(size_t, OldSize, flag_value);
     size_t over_size = 20*M;
     size_t new_size_value = align_size_up(MaxHeapSize, heap_alignment) - flag_value + over_size;
-    FLAG_SET_CMDLINE(uintx, MaxNewSize, new_size_value);
+    FLAG_SET_CMDLINE(size_t, MaxNewSize, new_size_value);
     // Calculate what we expect the flag to be.
     expected_old_initial = align_size_up(MaxHeapSize, heap_alignment) - MaxNewSize;
     verify_old_initial(expected_old_initial);
@@ -1053,11 +1057,11 @@
   static size_t original_OldSize;
 
   static void set_basic_flag_values() {
-    FLAG_SET_ERGO(uintx, MaxHeapSize, 180 * M);
-    FLAG_SET_ERGO(uintx, InitialHeapSize, 100 * M);
-    FLAG_SET_ERGO(uintx, OldSize, 4 * M);
-    FLAG_SET_ERGO(uintx, NewSize, 1 * M);
-    FLAG_SET_ERGO(uintx, MaxNewSize, 80 * M);
+    FLAG_SET_ERGO(size_t, MaxHeapSize, 180 * M);
+    FLAG_SET_ERGO(size_t, InitialHeapSize, 100 * M);
+    FLAG_SET_ERGO(size_t, OldSize, 4 * M);
+    FLAG_SET_ERGO(size_t, NewSize, 1 * M);
+    FLAG_SET_ERGO(size_t, MaxNewSize, 80 * M);
     Arguments::set_min_heap_size(40 * M);
   }
 
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -226,7 +226,7 @@
 
   compute_space_boundaries(0, SpaceDecorator::Clear, SpaceDecorator::Mangle);
   update_counters();
-  _next_gen = NULL;
+  _old_gen = NULL;
   _tenuring_threshold = MaxTenuringThreshold;
   _pretenure_size_threshold_words = PretenureSizeThreshold >> LogHeapWordSize;
 
@@ -383,8 +383,8 @@
   assert(next_level < gch->_n_gens,
          "DefNewGeneration cannot be an oldest gen");
 
-  Generation* next_gen = gch->get_gen(next_level);
-  size_t old_size = next_gen->capacity();
+  Generation* old_gen = gch->old_gen();
+  size_t old_size = old_gen->capacity();
   size_t new_size_before = _virtual_space.committed_size();
   size_t min_new_size = spec()->init_size();
   size_t max_new_size = reserved().byte_size();
@@ -568,7 +568,7 @@
   DefNewTracer gc_tracer;
   gc_tracer.report_gc_start(gch->gc_cause(), _gc_timer->gc_start());
 
-  _next_gen = gch->next_gen(this);
+  _old_gen = gch->old_gen();
 
   // If the next generation is too full to accommodate promotion
   // from this generation, pass on collection; let the next generation
@@ -590,8 +590,6 @@
 
   gch->trace_heap_before_gc(&gc_tracer);
 
-  SpecializationStats::clear();
-
   // These can be shared for all code paths
   IsAliveClosure is_alive(this);
   ScanWeakRefClosure scan_weak_ref(this);
@@ -628,7 +626,7 @@
                          true,  // Process younger gens, if any,
                                 // as strong roots.
                          true,  // activate StrongRootsScope
-                         SharedHeap::SO_ScavengeCodeCache,
+                         GenCollectedHeap::SO_ScavengeCodeCache,
                          GenCollectedHeap::StrongAndWeakRoots,
                          &fsc_with_no_gc_barrier,
                          &fsc_with_gc_barrier,
@@ -688,7 +686,7 @@
     gch->set_incremental_collection_failed();
 
     // Inform the next generation that a promotion failure occurred.
-    _next_gen->promotion_failure_occurred();
+    _old_gen->promotion_failure_occurred();
     gc_tracer.report_promotion_failed(_promotion_failed_info);
 
     // Reset the PromotionFailureALot counters.
@@ -700,7 +698,6 @@
   // set new iteration safe limit for the survivor spaces
   from()->set_concurrent_iteration_safe_limit(from()->top());
   to()->set_concurrent_iteration_safe_limit(to()->top());
-  SpecializationStats::print();
 
   // We need to use a monotonically non-decreasing time in ms
   // or we will see time-warp warnings and os::javaTimeMillis()
@@ -793,7 +790,7 @@
 
   // Otherwise try allocating obj tenured
   if (obj == NULL) {
-    obj = _next_gen->promote(old, s);
+    obj = _old_gen->promote(old, s);
     if (obj == NULL) {
       handle_promotion_failure(old);
       return old;
@@ -898,11 +895,11 @@
     }
     return false;
   }
-  if (_next_gen == NULL) {
+  if (_old_gen == NULL) {
     GenCollectedHeap* gch = GenCollectedHeap::heap();
-    _next_gen = gch->next_gen(this);
+    _old_gen = gch->old_gen();
   }
-  return _next_gen->promotion_attempt_is_safe(used());
+  return _old_gen->promotion_attempt_is_safe(used());
 }
 
 void DefNewGeneration::gc_epilogue(bool full) {
@@ -1022,8 +1019,7 @@
   return eden();
 }
 
-HeapWord* DefNewGeneration::allocate(size_t word_size,
-                                     bool is_tlab) {
+HeapWord* DefNewGeneration::allocate(size_t word_size, bool is_tlab) {
   // This is the slow-path allocation for the DefNewGeneration.
   // Most allocations are fast-path in compiled code.
   // We try to allocate from the eden.  If that works, we are happy.
@@ -1031,8 +1027,8 @@
   // have to use it here, as well.
   HeapWord* result = eden()->par_allocate(word_size);
   if (result != NULL) {
-    if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
-      _next_gen->sample_eden_chunk();
+    if (CMSEdenChunksRecordAlways && _old_gen != NULL) {
+      _old_gen->sample_eden_chunk();
     }
   } else {
     // If the eden is full and the last collection bailed out, we are running
@@ -1047,8 +1043,8 @@
 HeapWord* DefNewGeneration::par_allocate(size_t word_size,
                                          bool is_tlab) {
   HeapWord* res = eden()->par_allocate(word_size);
-  if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
-    _next_gen->sample_eden_chunk();
+  if (CMSEdenChunksRecordAlways && _old_gen != NULL) {
+    _old_gen->sample_eden_chunk();
   }
   return res;
 }
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,11 +29,14 @@
 #include "gc_implementation/shared/cSpaceCounters.hpp"
 #include "gc_implementation/shared/generationCounters.hpp"
 #include "gc_implementation/shared/copyFailedInfo.hpp"
+#include "memory/generation.hpp"
 #include "utilities/stack.hpp"
 
 class ContiguousSpace;
 class ScanClosure;
 class STWGCTimer;
+class CSpaceCounters;
+class ScanWeakRefClosure;
 
 // DefNewGeneration is a young generation containing eden, from- and
 // to-space.
@@ -42,7 +45,7 @@
   friend class VMStructs;
 
 protected:
-  Generation* _next_gen;
+  Generation* _old_gen;
   uint        _tenuring_threshold;   // Tenuring threshold for next collection.
   ageTable    _age_table;
   // Size of object to pretenure in words; command line provides bytes
--- a/hotspot/src/share/vm/memory/defNewGeneration.inline.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/defNewGeneration.inline.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,10 @@
 #ifndef SHARE_VM_MEMORY_DEFNEWGENERATION_INLINE_HPP
 #define SHARE_VM_MEMORY_DEFNEWGENERATION_INLINE_HPP
 
+#include "gc_interface/collectedHeap.hpp"
 #include "memory/cardTableRS.hpp"
 #include "memory/defNewGeneration.hpp"
+#include "memory/genOopClosures.inline.hpp"
 #include "memory/space.hpp"
 
 // Methods of protected closure types
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,7 @@
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "code/codeCache.hpp"
 #include "code/icBuffer.hpp"
 #include "gc_implementation/shared/collectorCounters.hpp"
 #include "gc_implementation/shared/gcTrace.hpp"
@@ -47,6 +48,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
 #include "runtime/vmThread.hpp"
+#include "services/management.hpp"
 #include "services/memoryService.hpp"
 #include "utilities/vmError.hpp"
 #include "utilities/workgroup.hpp"
@@ -61,7 +63,15 @@
 
 // The set of potentially parallel tasks in root scanning.
 enum GCH_strong_roots_tasks {
-  // We probably want to parallelize both of these internally, but for now...
+  GCH_PS_Universe_oops_do,
+  GCH_PS_JNIHandles_oops_do,
+  GCH_PS_ObjectSynchronizer_oops_do,
+  GCH_PS_FlatProfiler_oops_do,
+  GCH_PS_Management_oops_do,
+  GCH_PS_SystemDictionary_oops_do,
+  GCH_PS_ClassLoaderDataGraph_oops_do,
+  GCH_PS_jvmti_oops_do,
+  GCH_PS_CodeCache_oops_do,
   GCH_PS_younger_gens,
   // Leave this one last.
   GCH_PS_NumElements
@@ -71,13 +81,9 @@
   SharedHeap(policy),
   _rem_set(NULL),
   _gen_policy(policy),
-  _gen_process_roots_tasks(new SubTasksDone(GCH_PS_NumElements)),
+  _process_strong_tasks(new SubTasksDone(GCH_PS_NumElements)),
   _full_collections_completed(0)
 {
-  if (_gen_process_roots_tasks == NULL ||
-      !_gen_process_roots_tasks->valid()) {
-    vm_exit_during_initialization("Failed necessary allocation.");
-  }
   assert(policy != NULL, "Sanity check");
 }
 
@@ -177,18 +183,17 @@
   SharedHeap::post_initialize();
   GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
   guarantee(policy->is_generation_policy(), "Illegal policy type");
-  assert((get_gen(0)->kind() == Generation::DefNew) ||
-         (get_gen(0)->kind() == Generation::ParNew),
+  assert((_young_gen->kind() == Generation::DefNew) ||
+         (_young_gen->kind() == Generation::ParNew),
     "Wrong youngest generation type");
-  DefNewGeneration* def_new_gen = (DefNewGeneration*)get_gen(0);
+  DefNewGeneration* def_new_gen = (DefNewGeneration*)_young_gen;
 
-  Generation* old_gen = get_gen(1);
-  assert(old_gen->kind() == Generation::ConcurrentMarkSweep ||
-         old_gen->kind() == Generation::MarkSweepCompact,
+  assert(_old_gen->kind() == Generation::ConcurrentMarkSweep ||
+         _old_gen->kind() == Generation::MarkSweepCompact,
     "Wrong generation kind");
 
   policy->initialize_size_policy(def_new_gen->eden()->capacity(),
-                                 old_gen->capacity(),
+                                 _old_gen->capacity(),
                                  def_new_gen->from()->capacity());
   policy->initialize_gc_policy_counters();
 }
@@ -570,29 +575,137 @@
 
 void GenCollectedHeap::set_par_threads(uint t) {
   SharedHeap::set_par_threads(t);
-  _gen_process_roots_tasks->set_n_threads(t);
+  set_n_termination(t);
+}
+
+void GenCollectedHeap::set_n_termination(uint t) {
+  _process_strong_tasks->set_n_threads(t);
 }
 
-void GenCollectedHeap::
-gen_process_roots(int level,
-                  bool younger_gens_as_roots,
-                  bool activate_scope,
-                  SharedHeap::ScanningOption so,
-                  OopsInGenClosure* not_older_gens,
-                  OopsInGenClosure* weak_roots,
-                  OopsInGenClosure* older_gens,
-                  CLDClosure* cld_closure,
-                  CLDClosure* weak_cld_closure,
-                  CodeBlobClosure* code_closure) {
+#ifdef ASSERT
+class AssertNonScavengableClosure: public OopClosure {
+public:
+  virtual void do_oop(oop* p) {
+    assert(!Universe::heap()->is_in_partial_collection(*p),
+      "Referent should not be scavengable.");  }
+  virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
+};
+static AssertNonScavengableClosure assert_is_non_scavengable_closure;
+#endif
+
+void GenCollectedHeap::process_roots(bool activate_scope,
+                                     ScanningOption so,
+                                     OopClosure* strong_roots,
+                                     OopClosure* weak_roots,
+                                     CLDClosure* strong_cld_closure,
+                                     CLDClosure* weak_cld_closure,
+                                     CodeBlobClosure* code_roots) {
+  StrongRootsScope srs(this, activate_scope);
 
   // General roots.
-  SharedHeap::process_roots(activate_scope, so,
-                            not_older_gens, weak_roots,
-                            cld_closure, weak_cld_closure,
-                            code_closure);
+  assert(_strong_roots_parity != 0, "must have called prologue code");
+  assert(code_roots != NULL, "code root closure should always be set");
+  // _n_termination for _process_strong_tasks should be set up stream
+  // in a method not running in a GC worker.  Otherwise the GC worker
+  // could be trying to change the termination condition while the task
+  // is executing in another GC worker.
+
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_ClassLoaderDataGraph_oops_do)) {
+    ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
+  }
+
+  // Some CLDs contained in the thread frames should be considered strong.
+  // Don't process them if they will be processed during the ClassLoaderDataGraph phase.
+  CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
+  // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
+  CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
+
+  Threads::possibly_parallel_oops_do(strong_roots, roots_from_clds_p, roots_from_code_p);
+
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_Universe_oops_do)) {
+    Universe::oops_do(strong_roots);
+  }
+  // Global (strong) JNI handles
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_JNIHandles_oops_do)) {
+    JNIHandles::oops_do(strong_roots);
+  }
+
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_ObjectSynchronizer_oops_do)) {
+    ObjectSynchronizer::oops_do(strong_roots);
+  }
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_FlatProfiler_oops_do)) {
+    FlatProfiler::oops_do(strong_roots);
+  }
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_Management_oops_do)) {
+    Management::oops_do(strong_roots);
+  }
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_jvmti_oops_do)) {
+    JvmtiExport::oops_do(strong_roots);
+  }
+
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_SystemDictionary_oops_do)) {
+    SystemDictionary::roots_oops_do(strong_roots, weak_roots);
+  }
+
+  // All threads execute the following. A specific chunk of buckets
+  // from the StringTable are the individual tasks.
+  if (weak_roots != NULL) {
+    if (CollectedHeap::use_parallel_gc_threads()) {
+      StringTable::possibly_parallel_oops_do(weak_roots);
+    } else {
+      StringTable::oops_do(weak_roots);
+    }
+  }
+
+  if (!_process_strong_tasks->is_task_claimed(GCH_PS_CodeCache_oops_do)) {
+    if (so & SO_ScavengeCodeCache) {
+      assert(code_roots != NULL, "must supply closure for code cache");
+
+      // We only visit parts of the CodeCache when scavenging.
+      CodeCache::scavenge_root_nmethods_do(code_roots);
+    }
+    if (so & SO_AllCodeCache) {
+      assert(code_roots != NULL, "must supply closure for code cache");
+
+      // CMSCollector uses this to do intermediate-strength collections.
+      // We scan the entire code cache, since CodeCache::do_unloading is not called.
+      CodeCache::blobs_do(code_roots);
+    }
+    // Verify that the code cache contents are not subject to
+    // movement by a scavenging collection.
+    DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations));
+    DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
+  }
+
+}
+
+void GenCollectedHeap::gen_process_roots(int level,
+                                         bool younger_gens_as_roots,
+                                         bool activate_scope,
+                                         ScanningOption so,
+                                         bool only_strong_roots,
+                                         OopsInGenClosure* not_older_gens,
+                                         OopsInGenClosure* older_gens,
+                                         CLDClosure* cld_closure) {
+  const bool is_adjust_phase = !only_strong_roots && !younger_gens_as_roots;
+
+  bool is_moving_collection = false;
+  if (level == 0 || is_adjust_phase) {
+    // young collections are always moving
+    is_moving_collection = true;
+  }
+
+  MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection);
+  OopsInGenClosure* weak_roots = only_strong_roots ? NULL : not_older_gens;
+  CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
+
+  process_roots(activate_scope, so,
+                not_older_gens, weak_roots,
+                cld_closure, weak_cld_closure,
+                &mark_code_closure);
 
   if (younger_gens_as_roots) {
-    if (!_gen_process_roots_tasks->is_task_claimed(GCH_PS_younger_gens)) {
+    if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
       if (level == 1) {
         not_older_gens->set_generation(_young_gen);
         _young_gen->oop_iterate(not_older_gens);
@@ -608,43 +721,18 @@
     older_gens->reset_generation();
   }
 
-  _gen_process_roots_tasks->all_tasks_completed();
+  _process_strong_tasks->all_tasks_completed();
 }
 
-void GenCollectedHeap::
-gen_process_roots(int level,
-                  bool younger_gens_as_roots,
-                  bool activate_scope,
-                  SharedHeap::ScanningOption so,
-                  bool only_strong_roots,
-                  OopsInGenClosure* not_older_gens,
-                  OopsInGenClosure* older_gens,
-                  CLDClosure* cld_closure) {
 
-  const bool is_adjust_phase = !only_strong_roots && !younger_gens_as_roots;
-
-  bool is_moving_collection = false;
-  if (level == 0 || is_adjust_phase) {
-    // young collections are always moving
-    is_moving_collection = true;
-  }
-
-  MarkingCodeBlobClosure mark_code_closure(not_older_gens, is_moving_collection);
-  CodeBlobClosure* code_closure = &mark_code_closure;
-
-  gen_process_roots(level,
-                    younger_gens_as_roots,
-                    activate_scope, so,
-                    not_older_gens, only_strong_roots ? NULL : not_older_gens,
-                    older_gens,
-                    cld_closure, only_strong_roots ? NULL : cld_closure,
-                    code_closure);
-
-}
+class AlwaysTrueClosure: public BoolObjectClosure {
+public:
+  bool do_object_b(oop p) { return true; }
+};
+static AlwaysTrueClosure always_true;
 
 void GenCollectedHeap::gen_process_weak_roots(OopClosure* root_closure) {
-  SharedHeap::process_weak_roots(root_closure);
-  // "Local" "weak" refs
+  JNIHandles::weak_oops_do(&always_true, root_closure);
   _young_gen->ref_processor()->weak_oops_do(root_closure);
   _old_gen->ref_processor()->weak_oops_do(root_closure);
 }
@@ -1113,10 +1201,10 @@
 
 void GenCollectedHeap::print_tracing_info() const {
   if (TraceYoungGenTime) {
-    get_gen(0)->print_summary_info();
+    _young_gen->print_summary_info();
   }
   if (TraceOldGenTime) {
-    get_gen(1)->print_summary_info();
+    _old_gen->print_summary_info();
   }
 }
 
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -85,8 +85,7 @@
 
   // Data structure for claiming the (potentially) parallel tasks in
   // (gen-specific) roots processing.
-  SubTasksDone* _gen_process_roots_tasks;
-  SubTasksDone* gen_process_roots_tasks() { return _gen_process_roots_tasks; }
+  SubTasksDone* _process_strong_tasks;
 
   // Collects the given generation.
   void collect_generation(Generation* gen, bool full, size_t size, bool is_tlab,
@@ -373,27 +372,6 @@
   // collection.
   virtual bool is_maximal_no_gc() const;
 
-  // Return the generation before "gen".
-  Generation* prev_gen(Generation* gen) const {
-    guarantee(gen->level() == 1, "Out of bounds");
-    return _young_gen;
-  }
-
-  // Return the generation after "gen".
-  Generation* next_gen(Generation* gen) const {
-    guarantee(gen->level() == 0, "Out of bounds");
-    return _old_gen;
-  }
-
-  Generation* get_gen(int i) const {
-    guarantee(i == 0 || i == 1, "Out of bounds");
-    if (i == 0) {
-      return _young_gen;
-    } else {
-      return _old_gen;
-    }
-  }
-
   int n_gens() const {
     assert(_n_gens == gen_policy()->number_of_generations(), "Sanity");
     return _n_gens;
@@ -408,6 +386,7 @@
   static GenCollectedHeap* heap();
 
   void set_par_threads(uint t);
+  void set_n_termination(uint t);
 
   // Invoke the "do_oop" method of one of the closures "not_older_gens"
   // or "older_gens" on root locations for the generation at
@@ -421,11 +400,25 @@
   // The "so" argument determines which of the roots
   // the closure is applied to:
   // "SO_None" does none;
+  enum ScanningOption {
+    SO_None                =  0x0,
+    SO_AllCodeCache        =  0x8,
+    SO_ScavengeCodeCache   = 0x10
+  };
+
  private:
+  void process_roots(bool activate_scope,
+                     ScanningOption so,
+                     OopClosure* strong_roots,
+                     OopClosure* weak_roots,
+                     CLDClosure* strong_cld_closure,
+                     CLDClosure* weak_cld_closure,
+                     CodeBlobClosure* code_roots);
+
   void gen_process_roots(int level,
                          bool younger_gens_as_roots,
                          bool activate_scope,
-                         SharedHeap::ScanningOption so,
+                         ScanningOption so,
                          OopsInGenClosure* not_older_gens,
                          OopsInGenClosure* weak_roots,
                          OopsInGenClosure* older_gens,
@@ -440,7 +433,7 @@
   void gen_process_roots(int level,
                          bool younger_gens_as_roots,
                          bool activate_scope,
-                         SharedHeap::ScanningOption so,
+                         ScanningOption so,
                          bool only_strong_roots,
                          OopsInGenClosure* not_older_gens,
                          OopsInGenClosure* older_gens,
@@ -486,7 +479,7 @@
     assert(heap()->collector_policy()->is_generation_policy(),
            "the following definition may not be suitable for an n(>2)-generation system");
     return incremental_collection_failed() ||
-           (consult_young && !get_gen(0)->collection_attempt_is_safe());
+           (consult_young && !_young_gen->collection_attempt_is_safe());
   }
 
   // If a generation bails out of an incremental collection,
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -50,6 +50,7 @@
 #include "runtime/vmThread.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/events.hpp"
+#include "utilities/stack.inline.hpp"
 
 void GenMarkSweep::invoke_at_safepoint(int level, ReferenceProcessor* rp, bool clear_all_softrefs) {
   guarantee(level == 1, "We always collect both old and young.");
@@ -109,20 +110,16 @@
 
   deallocate_stacks();
 
-  // If compaction completely evacuated all generations younger than this
-  // one, then we can clear the card table.  Otherwise, we must invalidate
+  // If compaction completely evacuated the young generation then we
+  // can clear the card table.  Otherwise, we must invalidate
   // it (consider all cards dirty).  In the future, we might consider doing
   // compaction within generations only, and doing card-table sliding.
-  bool all_empty = true;
-  for (int i = 0; all_empty && i < level; i++) {
-    Generation* g = gch->get_gen(i);
-    all_empty = all_empty && gch->get_gen(i)->used() == 0;
-  }
   GenRemSet* rs = gch->rem_set();
-  Generation* old_gen = gch->get_gen(level);
+  Generation* old_gen = gch->old_gen();
+
   // Clear/invalidate below make use of the "prev_used_regions" saved earlier.
-  if (all_empty) {
-    // We've evacuated all generations below us.
+  if (gch->young_gen()->used() == 0) {
+    // We've evacuated the young generation.
     rs->clear_into_younger(old_gen);
   } else {
     // Invalidate the cards corresponding to the currently used
@@ -157,9 +154,8 @@
 
 void GenMarkSweep::allocate_stacks() {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  // Scratch request on behalf of oldest generation; will do no
-  // allocation.
-  ScratchBlock* scratch = gch->gather_scratch(gch->get_gen(gch->_n_gens-1), 0);
+  // Scratch request on behalf of old generation; will do no allocation.
+  ScratchBlock* scratch = gch->gather_scratch(gch->old_gen(), 0);
 
   // $$$ To cut a corner, we'll only use the first scratch block, and then
   // revert to malloc.
@@ -188,7 +184,7 @@
 }
 
 void GenMarkSweep::mark_sweep_phase1(int level,
-                                  bool clear_all_softrefs) {
+                                     bool clear_all_softrefs) {
   // Recursively traverse all live objects and mark them
   GCTraceTime tm("phase 1", PrintGC && Verbose, true, _gc_timer, _gc_tracer->gc_id());
   trace(" 1");
@@ -199,7 +195,8 @@
   // use OopsInGenClosure constructor which takes a generation,
   // as the Universe has not been created when the static constructors
   // are run.
-  follow_root_closure.set_orig_generation(gch->get_gen(level));
+  assert(level == 1, "We don't use mark-sweep on young generations");
+  follow_root_closure.set_orig_generation(gch->old_gen());
 
   // Need new claim bits before marking starts.
   ClassLoaderDataGraph::clear_claimed_marks();
@@ -207,7 +204,7 @@
   gch->gen_process_roots(level,
                          false, // Younger gens are not roots.
                          true,  // activate StrongRootsScope
-                         SharedHeap::SO_None,
+                         GenCollectedHeap::SO_None,
                          GenCollectedHeap::StrongRootsOnly,
                          &follow_root_closure,
                          &follow_root_closure,
@@ -287,12 +284,13 @@
   // use OopsInGenClosure constructor which takes a generation,
   // as the Universe has not been created when the static constructors
   // are run.
-  adjust_pointer_closure.set_orig_generation(gch->get_gen(level));
+  assert(level == 1, "We don't use mark-sweep on young generations.");
+  adjust_pointer_closure.set_orig_generation(gch->old_gen());
 
   gch->gen_process_roots(level,
                          false, // Younger gens are not roots.
                          true,  // activate StrongRootsScope
-                         SharedHeap::SO_AllCodeCache,
+                         GenCollectedHeap::SO_AllCodeCache,
                          GenCollectedHeap::StrongAndWeakRoots,
                          &adjust_pointer_closure,
                          &adjust_pointer_closure,
--- a/hotspot/src/share/vm/memory/generation.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/generation.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -153,9 +153,8 @@
 
 Generation* Generation::next_gen() const {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  int next = level() + 1;
-  if (next < gch->_n_gens) {
-    return gch->get_gen(next);
+  if (level() == 0) {
+    return gch->old_gen();
   } else {
     return NULL;
   }
--- a/hotspot/src/share/vm/memory/heapInspection.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -33,6 +33,7 @@
 #include "runtime/os.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
+#include "utilities/stack.inline.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/memory/metaspace.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/metaspace.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -3131,7 +3131,7 @@
 void Metaspace::initialize_class_space(ReservedSpace rs) {
   // The reserved space size may be bigger because of alignment, esp with UseLargePages
   assert(rs.size() >= CompressedClassSpaceSize,
-         err_msg(SIZE_FORMAT " != " UINTX_FORMAT, rs.size(), CompressedClassSpaceSize));
+         err_msg(SIZE_FORMAT " != " SIZE_FORMAT, rs.size(), CompressedClassSpaceSize));
   assert(using_class_space(), "Must be using class space");
   _class_space_list = new VirtualSpaceList(rs);
   _chunk_manager_class = new ChunkManager(SpecializedChunk, ClassSmallChunk, ClassMediumChunk);
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -410,7 +410,7 @@
 
     // Split up and initialize the misc code and data spaces
     ReservedSpace* shared_rs = MetaspaceShared::shared_rs();
-    int metadata_size = SharedReadOnlySize+SharedReadWriteSize;
+    size_t metadata_size = SharedReadOnlySize + SharedReadWriteSize;
     ReservedSpace shared_ro_rw = shared_rs->first_part(metadata_size);
     ReservedSpace misc_section = shared_rs->last_part(metadata_size);
 
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -32,7 +32,6 @@
 #include "runtime/atomic.inline.hpp"
 #include "runtime/fprofiler.hpp"
 #include "runtime/java.hpp"
-#include "services/management.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/workgroup.hpp"
 
@@ -40,32 +39,12 @@
 
 SharedHeap* SharedHeap::_sh;
 
-// The set of potentially parallel tasks in root scanning.
-enum SH_process_roots_tasks {
-  SH_PS_Universe_oops_do,
-  SH_PS_JNIHandles_oops_do,
-  SH_PS_ObjectSynchronizer_oops_do,
-  SH_PS_FlatProfiler_oops_do,
-  SH_PS_Management_oops_do,
-  SH_PS_SystemDictionary_oops_do,
-  SH_PS_ClassLoaderDataGraph_oops_do,
-  SH_PS_jvmti_oops_do,
-  SH_PS_CodeCache_oops_do,
-  // Leave this one last.
-  SH_PS_NumElements
-};
-
 SharedHeap::SharedHeap(CollectorPolicy* policy_) :
   CollectedHeap(),
   _collector_policy(policy_),
-  _strong_roots_scope(NULL),
   _strong_roots_parity(0),
-  _process_strong_tasks(new SubTasksDone(SH_PS_NumElements)),
   _workers(NULL)
 {
-  if (_process_strong_tasks == NULL || !_process_strong_tasks->valid()) {
-    vm_exit_during_initialization("Failed necessary allocation.");
-  }
   _sh = this;  // ch is static, should be set only once.
   if (UseConcMarkSweepGC || UseG1GC) {
     _workers = new FlexibleWorkGang("GC Thread", ParallelGCThreads,
@@ -79,14 +58,6 @@
   }
 }
 
-int SharedHeap::n_termination() {
-  return _process_strong_tasks->n_threads();
-}
-
-void SharedHeap::set_n_termination(int t) {
-  _process_strong_tasks->set_n_threads(t);
-}
-
 bool SharedHeap::heap_lock_held_for_gc() {
   Thread* t = Thread::current();
   return    Heap_lock->owned_by_self()
@@ -97,31 +68,6 @@
 void SharedHeap::set_par_threads(uint t) {
   assert(t == 0 || !UseSerialGC, "Cannot have parallel threads");
   _n_par_threads = t;
-  _process_strong_tasks->set_n_threads(t);
-}
-
-#ifdef ASSERT
-class AssertNonScavengableClosure: public OopClosure {
-public:
-  virtual void do_oop(oop* p) {
-    assert(!Universe::heap()->is_in_partial_collection(*p),
-      "Referent should not be scavengable.");  }
-  virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
-};
-static AssertNonScavengableClosure assert_is_non_scavengable_closure;
-#endif
-
-SharedHeap::StrongRootsScope* SharedHeap::active_strong_roots_scope() const {
-  return _strong_roots_scope;
-}
-void SharedHeap::register_strong_roots_scope(SharedHeap::StrongRootsScope* scope) {
-  assert(_strong_roots_scope == NULL, "Should only have one StrongRootsScope active");
-  assert(scope != NULL, "Illegal argument");
-  _strong_roots_scope = scope;
-}
-void SharedHeap::unregister_strong_roots_scope(SharedHeap::StrongRootsScope* scope) {
-  assert(_strong_roots_scope == scope, "Wrong scope unregistered");
-  _strong_roots_scope = NULL;
 }
 
 void SharedHeap::change_strong_roots_parity() {
@@ -135,174 +81,15 @@
 }
 
 SharedHeap::StrongRootsScope::StrongRootsScope(SharedHeap* heap, bool activate)
-  : MarkScope(activate), _sh(heap), _n_workers_done_with_threads(0)
+  : MarkScope(activate), _sh(heap)
 {
   if (_active) {
-    _sh->register_strong_roots_scope(this);
     _sh->change_strong_roots_parity();
     // Zero the claimed high water mark in the StringTable
     StringTable::clear_parallel_claimed_index();
   }
 }
 
-SharedHeap::StrongRootsScope::~StrongRootsScope() {
-  if (_active) {
-    _sh->unregister_strong_roots_scope(this);
-  }
-}
-
-Monitor* SharedHeap::StrongRootsScope::_lock = new Monitor(Mutex::leaf, "StrongRootsScope lock", false, Monitor::_safepoint_check_never);
-
-void SharedHeap::StrongRootsScope::mark_worker_done_with_threads(uint n_workers) {
-  // The Thread work barrier is only needed by G1 Class Unloading.
-  // No need to use the barrier if this is single-threaded code.
-  if (UseG1GC && ClassUnloadingWithConcurrentMark && n_workers > 0) {
-    uint new_value = (uint)Atomic::add(1, &_n_workers_done_with_threads);
-    if (new_value == n_workers) {
-      // This thread is last. Notify the others.
-      MonitorLockerEx ml(_lock, Mutex::_no_safepoint_check_flag);
-      _lock->notify_all();
-    }
-  }
-}
-
-void SharedHeap::StrongRootsScope::wait_until_all_workers_done_with_threads(uint n_workers) {
-  assert(UseG1GC,                          "Currently only used by G1");
-  assert(ClassUnloadingWithConcurrentMark, "Currently only needed when doing G1 Class Unloading");
-
-  // No need to use the barrier if this is single-threaded code.
-  if (n_workers > 0 && (uint)_n_workers_done_with_threads != n_workers) {
-    MonitorLockerEx ml(_lock, Mutex::_no_safepoint_check_flag);
-    while ((uint)_n_workers_done_with_threads != n_workers) {
-      _lock->wait(Mutex::_no_safepoint_check_flag, 0, false);
-    }
-  }
-}
-
-void SharedHeap::process_roots(bool activate_scope,
-                               ScanningOption so,
-                               OopClosure* strong_roots,
-                               OopClosure* weak_roots,
-                               CLDClosure* strong_cld_closure,
-                               CLDClosure* weak_cld_closure,
-                               CodeBlobClosure* code_roots) {
-  StrongRootsScope srs(this, activate_scope);
-
-  // General roots.
-  assert(_strong_roots_parity != 0, "must have called prologue code");
-  assert(code_roots != NULL, "code root closure should always be set");
-  // _n_termination for _process_strong_tasks should be set up stream
-  // in a method not running in a GC worker.  Otherwise the GC worker
-  // could be trying to change the termination condition while the task
-  // is executing in another GC worker.
-
-  // Iterating over the CLDG and the Threads are done early to allow G1 to
-  // first process the strong CLDs and nmethods and then, after a barrier,
-  // let the thread process the weak CLDs and nmethods.
-
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_ClassLoaderDataGraph_oops_do)) {
-    ClassLoaderDataGraph::roots_cld_do(strong_cld_closure, weak_cld_closure);
-  }
-
-  // Some CLDs contained in the thread frames should be considered strong.
-  // Don't process them if they will be processed during the ClassLoaderDataGraph phase.
-  CLDClosure* roots_from_clds_p = (strong_cld_closure != weak_cld_closure) ? strong_cld_closure : NULL;
-  // Only process code roots from thread stacks if we aren't visiting the entire CodeCache anyway
-  CodeBlobClosure* roots_from_code_p = (so & SO_AllCodeCache) ? NULL : code_roots;
-
-  Threads::possibly_parallel_oops_do(strong_roots, roots_from_clds_p, roots_from_code_p);
-
-  // This is the point where this worker thread will not find more strong CLDs/nmethods.
-  // Report this so G1 can synchronize the strong and weak CLDs/nmethods processing.
-  active_strong_roots_scope()->mark_worker_done_with_threads(n_par_threads());
-
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_Universe_oops_do)) {
-    Universe::oops_do(strong_roots);
-  }
-  // Global (strong) JNI handles
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_JNIHandles_oops_do))
-    JNIHandles::oops_do(strong_roots);
-
-  if (!_process_strong_tasks-> is_task_claimed(SH_PS_ObjectSynchronizer_oops_do))
-    ObjectSynchronizer::oops_do(strong_roots);
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_FlatProfiler_oops_do))
-    FlatProfiler::oops_do(strong_roots);
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_Management_oops_do))
-    Management::oops_do(strong_roots);
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_jvmti_oops_do))
-    JvmtiExport::oops_do(strong_roots);
-
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_SystemDictionary_oops_do)) {
-    SystemDictionary::roots_oops_do(strong_roots, weak_roots);
-  }
-
-  // All threads execute the following. A specific chunk of buckets
-  // from the StringTable are the individual tasks.
-  if (weak_roots != NULL) {
-    if (CollectedHeap::use_parallel_gc_threads()) {
-      StringTable::possibly_parallel_oops_do(weak_roots);
-    } else {
-      StringTable::oops_do(weak_roots);
-    }
-  }
-
-  if (!_process_strong_tasks->is_task_claimed(SH_PS_CodeCache_oops_do)) {
-    if (so & SO_ScavengeCodeCache) {
-      assert(code_roots != NULL, "must supply closure for code cache");
-
-      // We only visit parts of the CodeCache when scavenging.
-      CodeCache::scavenge_root_nmethods_do(code_roots);
-    }
-    if (so & SO_AllCodeCache) {
-      assert(code_roots != NULL, "must supply closure for code cache");
-
-      // CMSCollector uses this to do intermediate-strength collections.
-      // We scan the entire code cache, since CodeCache::do_unloading is not called.
-      CodeCache::blobs_do(code_roots);
-    }
-    // Verify that the code cache contents are not subject to
-    // movement by a scavenging collection.
-    DEBUG_ONLY(CodeBlobToOopClosure assert_code_is_non_scavengable(&assert_is_non_scavengable_closure, !CodeBlobToOopClosure::FixRelocations));
-    DEBUG_ONLY(CodeCache::asserted_non_scavengable_nmethods_do(&assert_code_is_non_scavengable));
-  }
-
-  _process_strong_tasks->all_tasks_completed();
-}
-
-void SharedHeap::process_all_roots(bool activate_scope,
-                                   ScanningOption so,
-                                   OopClosure* roots,
-                                   CLDClosure* cld_closure,
-                                   CodeBlobClosure* code_closure) {
-  process_roots(activate_scope, so,
-                roots, roots,
-                cld_closure, cld_closure,
-                code_closure);
-}
-
-void SharedHeap::process_strong_roots(bool activate_scope,
-                                      ScanningOption so,
-                                      OopClosure* roots,
-                                      CLDClosure* cld_closure,
-                                      CodeBlobClosure* code_closure) {
-  process_roots(activate_scope, so,
-                roots, NULL,
-                cld_closure, NULL,
-                code_closure);
-}
-
-
-class AlwaysTrueClosure: public BoolObjectClosure {
-public:
-  bool do_object_b(oop p) { return true; }
-};
-static AlwaysTrueClosure always_true;
-
-void SharedHeap::process_weak_roots(OopClosure* root_closure) {
-  // Global (weak) JNI handles
-  JNIHandles::weak_oops_do(&always_true, root_closure);
-}
-
 void SharedHeap::set_barrier_set(BarrierSet* bs) {
   _barrier_set = bs;
   // Cached barrier set for fast access in oops
--- a/hotspot/src/share/vm/memory/sharedHeap.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/sharedHeap.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -61,18 +61,18 @@
 //    counts the number of tasks that have been done and then reset
 //    the SubTasksDone so that it can be used again.  When the number of
 //    tasks is set to the number of GC workers, then _n_threads must
-//    be set to the number of active GC workers. G1CollectedHeap,
-//    HRInto_G1RemSet, GenCollectedHeap and SharedHeap have SubTasksDone.
-//    This seems too many.
+//    be set to the number of active GC workers. G1RootProcessor and
+//    GenCollectedHeap have SubTasksDone.
 //    3) SequentialSubTasksDone has an _n_threads that is used in
 //    a way similar to SubTasksDone and has the same dependency on the
 //    number of active GC workers.  CompactibleFreeListSpace and Space
 //    have SequentialSubTasksDone's.
-// Example of using SubTasksDone and SequentialSubTasksDone
-// G1CollectedHeap::g1_process_roots()
-//  to SharedHeap::process_roots() and uses
-//  SubTasksDone* _process_strong_tasks to claim tasks.
-//  process_roots() calls
+//
+// Examples of using SubTasksDone and SequentialSubTasksDone:
+//  G1RootProcessor and GenCollectedHeap::process_roots() use
+//  SubTasksDone* _process_strong_tasks to claim tasks for workers
+//
+//  GenCollectedHeap::gen_process_roots() calls
 //      rem_set()->younger_refs_iterate()
 //  to scan the card table and which eventually calls down into
 //  CardTableModRefBS::par_non_clean_card_iterate_work().  This method
@@ -104,10 +104,6 @@
   friend class VM_GC_Operation;
   friend class VM_CGC_Operation;
 
-private:
-  // For claiming strong_roots tasks.
-  SubTasksDone* _process_strong_tasks;
-
 protected:
   // There should be only a single instance of "SharedHeap" in a program.
   // This is enforced with the protected constructor below, which will also
@@ -140,7 +136,6 @@
   static SharedHeap* heap() { return _sh; }
 
   void set_barrier_set(BarrierSet* bs);
-  SubTasksDone* process_strong_tasks() { return _process_strong_tasks; }
 
   // Does operations required after initialization has been done.
   virtual void post_initialize();
@@ -193,69 +188,19 @@
   // strong_roots_prologue calls change_strong_roots_parity, if
   // parallel tasks are enabled.
   class StrongRootsScope : public MarkingCodeBlobClosure::MarkScope {
-    // Used to implement the Thread work barrier.
-    static Monitor* _lock;
-
     SharedHeap*   _sh;
-    volatile jint _n_workers_done_with_threads;
 
    public:
     StrongRootsScope(SharedHeap* heap, bool activate = true);
-    ~StrongRootsScope();
-
-    // Mark that this thread is done with the Threads work.
-    void mark_worker_done_with_threads(uint n_workers);
-    // Wait until all n_workers are done with the Threads work.
-    void wait_until_all_workers_done_with_threads(uint n_workers);
   };
   friend class StrongRootsScope;
 
-  // The current active StrongRootScope
-  StrongRootsScope* _strong_roots_scope;
-
-  StrongRootsScope* active_strong_roots_scope() const;
-
  private:
-  void register_strong_roots_scope(StrongRootsScope* scope);
-  void unregister_strong_roots_scope(StrongRootsScope* scope);
   void change_strong_roots_parity();
 
  public:
-  enum ScanningOption {
-    SO_None                =  0x0,
-    SO_AllCodeCache        =  0x8,
-    SO_ScavengeCodeCache   = 0x10
-  };
-
   FlexibleWorkGang* workers() const { return _workers; }
 
-  // Invoke the "do_oop" method the closure "roots" on all root locations.
-  // The "so" argument determines which roots the closure is applied to:
-  // "SO_None" does none;
-  // "SO_AllCodeCache" applies the closure to all elements of the CodeCache.
-  // "SO_ScavengeCodeCache" applies the closure to elements on the scavenge root list in the CodeCache.
-  void process_roots(bool activate_scope,
-                     ScanningOption so,
-                     OopClosure* strong_roots,
-                     OopClosure* weak_roots,
-                     CLDClosure* strong_cld_closure,
-                     CLDClosure* weak_cld_closure,
-                     CodeBlobClosure* code_roots);
-  void process_all_roots(bool activate_scope,
-                         ScanningOption so,
-                         OopClosure* roots,
-                         CLDClosure* cld_closure,
-                         CodeBlobClosure* code_roots);
-  void process_strong_roots(bool activate_scope,
-                            ScanningOption so,
-                            OopClosure* roots,
-                            CLDClosure* cld_closure,
-                            CodeBlobClosure* code_roots);
-
-
-  // Apply "root_closure" to the JNI weak roots..
-  void process_weak_roots(OopClosure* root_closure);
-
   // The functions below are helper functions that a subclass of
   // "SharedHeap" can use in the implementation of its virtual
   // functions.
@@ -270,9 +215,6 @@
   // (such as process roots) subsequently.
   virtual void set_par_threads(uint t);
 
-  int n_termination();
-  void set_n_termination(int t);
-
   //
   // New methods from CollectedHeap
   //
@@ -284,8 +226,4 @@
                              size_t capacity);
 };
 
-inline SharedHeap::ScanningOption operator|(SharedHeap::ScanningOption so0, SharedHeap::ScanningOption so1) {
-  return static_cast<SharedHeap::ScanningOption>(static_cast<int>(so0) | static_cast<int>(so1));
-}
-
 #endif // SHARE_VM_MEMORY_SHAREDHEAP_HPP
--- a/hotspot/src/share/vm/memory/space.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/space.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -26,7 +26,6 @@
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "gc_implementation/shared/liveRange.hpp"
-#include "gc_implementation/shared/markSweep.hpp"
 #include "gc_implementation/shared/spaceDecorator.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "memory/blockOffsetTable.inline.hpp"
@@ -353,15 +352,6 @@
 void ContiguousSpace::mangle_unused_area_complete() {
   mangler()->mangle_unused_area_complete();
 }
-void ContiguousSpace::mangle_region(MemRegion mr) {
-  // Although this method uses SpaceMangler::mangle_region() which
-  // is not specific to a space, the when the ContiguousSpace version
-  // is called, it is always with regard to a space and this
-  // bounds checking is appropriate.
-  MemRegion space_mr(bottom(), end());
-  assert(space_mr.contains(mr), "Mangling outside space");
-  SpaceMangler::mangle_region(mr);
-}
 #endif  // NOT_PRODUCT
 
 void CompactibleSpace::initialize(MemRegion mr,
@@ -388,7 +378,7 @@
     cp->space->set_compaction_top(compact_top);
     cp->space = cp->space->next_compaction_space();
     if (cp->space == NULL) {
-      cp->gen = GenCollectedHeap::heap()->prev_gen(cp->gen);
+      cp->gen = GenCollectedHeap::heap()->young_gen();
       assert(cp->gen != NULL, "compaction must succeed");
       cp->space = cp->gen->first_compaction_space();
       assert(cp->space != NULL, "generation must have a first compaction space");
--- a/hotspot/src/share/vm/memory/space.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/space.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -128,11 +128,10 @@
 
   // For detecting GC bugs.  Should only be called at GC boundaries, since
   // some unused space may be used as scratch space during GC's.
-  // Default implementation does nothing. We also call this when expanding
-  // a space to satisfy an allocation request. See bug #4668531
-  virtual void mangle_unused_area() {}
-  virtual void mangle_unused_area_complete() {}
-  virtual void mangle_region(MemRegion mr) {}
+  // We also call this when expanding a space to satisfy an allocation
+  // request. See bug #4668531
+  virtual void mangle_unused_area() = 0;
+  virtual void mangle_unused_area_complete() = 0;
 
   // Testers
   bool is_empty() const              { return used() == 0; }
@@ -196,7 +195,7 @@
   // structure supporting these calls, possibly speeding up future calls.
   // The default implementation, however, is simply to call the const
   // version.
-  inline virtual HeapWord* block_start(const void* p);
+  virtual HeapWord* block_start(const void* p);
 
   // Requires "addr" to be the start of a chunk, and returns its size.
   // "addr + size" is required to be the start of a new chunk, or the end
@@ -559,8 +558,6 @@
   void mangle_unused_area() PRODUCT_RETURN;
   // Mangle [top, end)
   void mangle_unused_area_complete() PRODUCT_RETURN;
-  // Mangle the given MemRegion.
-  void mangle_region(MemRegion mr) PRODUCT_RETURN;
 
   // Do some sparse checking on the area that should have been mangled.
   void check_mangled_unused_area(HeapWord* limit) PRODUCT_RETURN;
--- a/hotspot/src/share/vm/memory/specialized_oop_closures.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#include "precompiled.hpp"
-#include "memory/specialized_oop_closures.hpp"
-#include "utilities/ostream.hpp"
-
-// For keeping stats on effectiveness.
-#ifndef PRODUCT
-#if ENABLE_SPECIALIZATION_STATS
-
-int SpecializationStats::_numCallsAll;
-
-int SpecializationStats::_numCallsTotal[NUM_Kinds];
-int SpecializationStats::_numCalls_nv[NUM_Kinds];
-
-int SpecializationStats::_numDoOopCallsTotal[NUM_Kinds];
-int SpecializationStats::_numDoOopCalls_nv[NUM_Kinds];
-
-void SpecializationStats::clear() {
-  _numCallsAll = 0;
-  for (int k = ik; k < NUM_Kinds; k++) {
-    _numCallsTotal[k] = 0;
-    _numCalls_nv[k] = 0;
-
-    _numDoOopCallsTotal[k] = 0;
-    _numDoOopCalls_nv[k] = 0;
-  }
-}
-
-void SpecializationStats::print() {
-  const char* header_format = "    %20s %10s %11s %10s";
-  const char* line_format   = "    %20s %10d %11d %9.2f%%";
-  int all_numCallsTotal =
-    _numCallsTotal[ik] + _numCallsTotal[irk] + _numCallsTotal[oa];
-  int all_numCalls_nv =
-    _numCalls_nv[ik] + _numCalls_nv[irk] + _numCalls_nv[oa];
-  gclog_or_tty->print_cr("\nOf %d oop_oop_iterate calls %d (%6.3f%%) are in (ik, irk, oa).",
-                _numCallsAll, all_numCallsTotal,
-                100.0 * (float)all_numCallsTotal / (float)_numCallsAll);
-  // irk calls are double-counted.
-  int real_ik_numCallsTotal = _numCallsTotal[ik] - _numCallsTotal[irk];
-  int real_ik_numCalls_nv   = _numCalls_nv[ik]   - _numCalls_nv[irk];
-  gclog_or_tty->print_cr("");
-  gclog_or_tty->print_cr(header_format, "oop_oop_iterate:", "calls", "non-virtual", "pct");
-  gclog_or_tty->print_cr(header_format,
-                "----------",
-                "----------",
-                "-----------",
-                "----------");
-  gclog_or_tty->print_cr(line_format, "all",
-                all_numCallsTotal,
-                all_numCalls_nv,
-                100.0 * (float)all_numCalls_nv / (float)all_numCallsTotal);
-  gclog_or_tty->print_cr(line_format, "ik",
-                real_ik_numCallsTotal, real_ik_numCalls_nv,
-                100.0 * (float)real_ik_numCalls_nv /
-                (float)real_ik_numCallsTotal);
-  gclog_or_tty->print_cr(line_format, "irk",
-                _numCallsTotal[irk], _numCalls_nv[irk],
-                100.0 * (float)_numCalls_nv[irk] / (float)_numCallsTotal[irk]);
-  gclog_or_tty->print_cr(line_format, "oa",
-                _numCallsTotal[oa], _numCalls_nv[oa],
-                100.0 * (float)_numCalls_nv[oa] / (float)_numCallsTotal[oa]);
-
-
-  gclog_or_tty->print_cr("");
-  gclog_or_tty->print_cr(header_format, "do_oop:", "calls", "non-virtual", "pct");
-  gclog_or_tty->print_cr(header_format,
-                "----------",
-                "----------",
-                "-----------",
-                "----------");
-  int all_numDoOopCallsTotal =
-    _numDoOopCallsTotal[ik] + _numDoOopCallsTotal[irk] + _numDoOopCallsTotal[oa];
-  int all_numDoOopCalls_nv =
-    _numDoOopCalls_nv[ik] + _numDoOopCalls_nv[irk] + _numDoOopCalls_nv[oa];
-  gclog_or_tty->print_cr(line_format, "all",
-                all_numDoOopCallsTotal, all_numDoOopCalls_nv,
-                100.0 * (float)all_numDoOopCalls_nv /
-                (float)all_numDoOopCallsTotal);
-  const char* kind_names[] = { "ik", "irk", "oa" };
-  for (int k = ik; k < NUM_Kinds; k++) {
-    gclog_or_tty->print_cr(line_format, kind_names[k],
-                  _numDoOopCallsTotal[k], _numDoOopCalls_nv[k],
-                  (_numDoOopCallsTotal[k] > 0 ?
-                   100.0 * (float)_numDoOopCalls_nv[k] /
-                   (float)_numDoOopCallsTotal[k]
-                   : 0.0));
-  }
-}
-
-#endif  // ENABLE_SPECIALIZATION_STATS
-#endif  // !PRODUCT
--- a/hotspot/src/share/vm/memory/specialized_oop_closures.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/specialized_oop_closures.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -60,21 +60,15 @@
 // This macro applies an argument macro to all OopClosures for which we
 // want specialized bodies of "oop_oop_iterate".  The arguments to "f" are:
 //   "f(closureType, non_virtual)"
-// where "closureType" is the name of the particular subclass of OopClosure,
+// where "closureType" is the name of the particular subclass of ExtendedOopClosure,
 // and "non_virtual" will be the string "_nv" if the closure type should
 // have its "do_oop" method invoked non-virtually, or else the
-// string "_v".  ("OopClosure" itself will be the only class in the latter
+// string "_v".  ("ExtendedOopClosure" itself will be the only class in the latter
 // category.)
 
 // This is split into several because of a Visual C++ 6.0 compiler bug
 // where very long macros cause the compiler to crash
 
-// Some other heap might define further specialized closures.
-#ifndef FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES
-#define FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f) \
-        /* None */
-#endif
-
 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_S(f)       \
   f(ScanClosure,_nv)                                    \
   f(FastScanClosure,_nv)                                \
@@ -94,7 +88,7 @@
   SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_P(f)
 
 #if INCLUDE_ALL_GCS
-#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)       \
+#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f)     \
   f(MarkRefsIntoAndScanClosure,_nv)                     \
   f(Par_MarkRefsIntoAndScanClosure,_nv)                 \
   f(PushAndMarkClosure,_nv)                             \
@@ -102,8 +96,13 @@
   f(PushOrMarkClosure,_nv)                              \
   f(Par_PushOrMarkClosure,_nv)                          \
   f(CMSKeepAliveClosure,_nv)                            \
-  f(CMSInnerParMarkAndPushClosure,_nv)                  \
-  FURTHER_SPECIALIZED_OOP_OOP_ITERATE_CLOSURES(f)
+  f(CMSInnerParMarkAndPushClosure,_nv)
+#endif
+
+#if INCLUDE_ALL_GCS
+#define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)       \
+  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_CMS(f)           \
+  SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_G1(f)
 #else  // INCLUDE_ALL_GCS
 #define SPECIALIZED_OOP_OOP_ITERATE_CLOSURES_2(f)
 #endif // INCLUDE_ALL_GCS
@@ -144,13 +143,6 @@
 // The "root_class" is the most general class to define; this may be
 // "OopClosure" in some applications and "OopsInGenClosure" in others.
 
-
-// Some other heap might define further specialized closures.
-#ifndef FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES
-#define FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f) \
-        /* None */
-#endif
-
 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_S(f) \
   f(ScanClosure,_nv)                                     \
   f(FastScanClosure,_nv)
@@ -158,8 +150,7 @@
 #if INCLUDE_ALL_GCS
 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f) \
   f(ParScanWithBarrierClosure,_nv)                       \
-  f(ParScanWithoutBarrierClosure,_nv)                    \
-  FURTHER_SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f)
+  f(ParScanWithoutBarrierClosure,_nv)
 #else  // INCLUDE_ALL_GCS
 #define SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES_YOUNG_P(f)
 #endif // INCLUDE_ALL_GCS
@@ -174,93 +165,9 @@
 // We separate these out, because sometime the general one has
 // a different definition from the specialized ones, and sometimes it
 // doesn't.
-// NOTE:   One of the valid criticisms of this
-// specialize-oop_oop_iterate-for-specific-closures idiom is that it is
-// easy to have a silent performance bug: if you fail to de-virtualize,
-// things still work, just slower.  The "SpecializationStats" mode is
-// intended to at least make such a failure easy to detect.
-// *Not* using the ALL_SINCE_SAVE_MARKS_CLOSURES(f) macro defined
-// below means that *only* closures for which oop_oop_iterate specializations
-// exist above may be applied to "oops_since_save_marks".  That is,
-// this form of the performance bug is caught statically.  When you add
-// a definition for the general type, this property goes away.
-// Make sure you test with SpecializationStats to find such bugs
-// when introducing a new closure where you don't want virtual dispatch.
 
 #define ALL_SINCE_SAVE_MARKS_CLOSURES(f)                \
   f(OopsInGenClosure,_v)                                \
   SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(f)
 
-// For keeping stats on effectiveness.
-#define ENABLE_SPECIALIZATION_STATS 0
-
-
-class SpecializationStats {
-public:
-  enum Kind {
-    ik,             // InstanceKlass
-    irk,            // InstanceRefKlass
-    oa,             // ObjArrayKlass
-    NUM_Kinds
-  };
-
-#if ENABLE_SPECIALIZATION_STATS
-private:
-  static bool _init;
-  static bool _wrapped;
-  static jint _numCallsAll;
-
-  static jint _numCallsTotal[NUM_Kinds];
-  static jint _numCalls_nv[NUM_Kinds];
-
-  static jint _numDoOopCallsTotal[NUM_Kinds];
-  static jint _numDoOopCalls_nv[NUM_Kinds];
-public:
-#endif
-  static void clear()  PRODUCT_RETURN;
-
-  static inline void record_call()  PRODUCT_RETURN;
-  static inline void record_iterate_call_v(Kind k)  PRODUCT_RETURN;
-  static inline void record_iterate_call_nv(Kind k)  PRODUCT_RETURN;
-  static inline void record_do_oop_call_v(Kind k)  PRODUCT_RETURN;
-  static inline void record_do_oop_call_nv(Kind k)  PRODUCT_RETURN;
-
-  static void print() PRODUCT_RETURN;
-};
-
-#ifndef PRODUCT
-#if ENABLE_SPECIALIZATION_STATS
-
-inline void SpecializationStats::record_call() {
-  Atomic::inc(&_numCallsAll);
-}
-inline void SpecializationStats::record_iterate_call_v(Kind k) {
-  Atomic::inc(&_numCallsTotal[k]);
-}
-inline void SpecializationStats::record_iterate_call_nv(Kind k) {
-  Atomic::inc(&_numCallsTotal[k]);
-  Atomic::inc(&_numCalls_nv[k]);
-}
-
-inline void SpecializationStats::record_do_oop_call_v(Kind k) {
-  Atomic::inc(&_numDoOopCallsTotal[k]);
-}
-inline void SpecializationStats::record_do_oop_call_nv(Kind k) {
-  Atomic::inc(&_numDoOopCallsTotal[k]);
-  Atomic::inc(&_numDoOopCalls_nv[k]);
-}
-
-#else   // !ENABLE_SPECIALIZATION_STATS
-
-inline void SpecializationStats::record_call() {}
-inline void SpecializationStats::record_iterate_call_v(Kind k) {}
-inline void SpecializationStats::record_iterate_call_nv(Kind k) {}
-inline void SpecializationStats::record_do_oop_call_v(Kind k) {}
-inline void SpecializationStats::record_do_oop_call_nv(Kind k) {}
-inline void SpecializationStats::clear() {}
-inline void SpecializationStats::print() {}
-
-#endif  // ENABLE_SPECIALIZATION_STATS
-#endif  // !PRODUCT
-
 #endif // SHARE_VM_MEMORY_SPECIALIZED_OOP_CLOSURES_HPP
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -178,7 +178,6 @@
                                 bool   is_tlab) {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
 
-  SpecializationStats::clear();
   // Temporarily expand the span of our ref processor, so
   // refs discovery is over the entire heap, not just this generation
   ReferenceProcessorSpanMutator
@@ -195,8 +194,6 @@
   gc_timer->register_gc_end();
 
   gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
-
-  SpecializationStats::print();
 }
 
 HeapWord*
--- a/hotspot/src/share/vm/oops/cpCache.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/cpCache.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -35,9 +35,6 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-# include "gc_implementation/parallelScavenge/psPromotionManager.hpp"
-#endif // INCLUDE_ALL_GCS
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
--- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -30,6 +30,7 @@
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/iterator.inline.hpp"
 #include "memory/oopFactory.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/instanceClassLoaderKlass.hpp"
 #include "oops/instanceMirrorKlass.hpp"
@@ -54,7 +55,6 @@
 int InstanceClassLoaderKlass::                                                  \
 oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) {                  \
   /* Get size before changing pointers */                                       \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
   int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure);           \
                                                                                 \
   if_do_metadata_checked(closure, nv_suffix) {                                  \
@@ -74,7 +74,6 @@
 int InstanceClassLoaderKlass::                                                  \
 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) {        \
   /* Get size before changing pointers */                                       \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
   int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \
   return size;                                                                  \
 }
@@ -87,8 +86,6 @@
 oop_oop_iterate##nv_suffix##_m(oop obj,                                         \
                                OopClosureType* closure,                         \
                                MemRegion mr) {                                  \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
-                                                                                \
   int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr);   \
                                                                                 \
   if_do_metadata_checked(closure, nv_suffix) {                                  \
--- a/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceClassLoaderKlass.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_OOPS_INSTANCECLASSLOADERKLASS_HPP
 #define SHARE_VM_OOPS_INSTANCECLASSLOADERKLASS_HPP
 
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/instanceKlass.hpp"
 #include "utilities/macros.hpp"
 
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -38,6 +38,7 @@
 #include "memory/iterator.inline.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/oopFactory.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/fieldStreams.hpp"
 #include "oops/instanceClassLoaderKlass.hpp"
 #include "oops/instanceKlass.hpp"
@@ -2209,15 +2210,12 @@
 #define InstanceKlass_OOP_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)        \
                                                                              \
 int InstanceKlass::oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) { \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\
   /* header */                                                          \
   if_do_metadata_checked(closure, nv_suffix) {                          \
     closure->do_klass##nv_suffix(obj->klass());                         \
   }                                                                     \
   InstanceKlass_OOP_MAP_ITERATE(                                        \
     obj,                                                                \
-    SpecializationStats::                                               \
-      record_do_oop_call##nv_suffix(SpecializationStats::ik);           \
     (closure)->do_oop##nv_suffix(p),                                    \
     assert_is_in_closed_subset)                                         \
   return size_helper();                                                 \
@@ -2228,14 +2226,11 @@
                                                                                 \
 int InstanceKlass::oop_oop_iterate_backwards##nv_suffix(oop obj,                \
                                               OopClosureType* closure) {        \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik); \
-                                                                                \
   assert_should_ignore_metadata(closure, nv_suffix);                            \
                                                                                 \
   /* instance variables */                                                      \
   InstanceKlass_OOP_MAP_REVERSE_ITERATE(                                        \
     obj,                                                                        \
-    SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::ik);\
     (closure)->do_oop##nv_suffix(p),                                            \
     assert_is_in_closed_subset)                                                 \
    return size_helper();                                                        \
@@ -2247,7 +2242,6 @@
 int InstanceKlass::oop_oop_iterate##nv_suffix##_m(oop obj,              \
                                                   OopClosureType* closure, \
                                                   MemRegion mr) {          \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::ik);\
   if_do_metadata_checked(closure, nv_suffix) {                           \
     if (mr.contains(obj)) {                                              \
       closure->do_klass##nv_suffix(obj->klass());                        \
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -27,6 +27,7 @@
 
 #include "classfile/classLoaderData.hpp"
 #include "memory/referenceType.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/annotations.hpp"
 #include "oops/constMethod.hpp"
 #include "oops/fieldInfo.hpp"
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -30,6 +30,7 @@
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/iterator.inline.hpp"
 #include "memory/oopFactory.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/instanceMirrorKlass.hpp"
 #include "oops/instanceOop.hpp"
@@ -250,8 +251,6 @@
 int InstanceMirrorKlass::                                                             \
 oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) {                        \
   /* Get size before changing pointers */                                             \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
-                                                                                      \
   InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure);                            \
                                                                                       \
   if_do_metadata_checked(closure, nv_suffix) {                                        \
@@ -275,8 +274,6 @@
 int InstanceMirrorKlass::                                                             \
 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) {              \
   /* Get size before changing pointers */                                             \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
-                                                                                      \
   InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure);                  \
                                                                                       \
   if (UseCompressedOops) {                                                            \
@@ -294,8 +291,6 @@
 oop_oop_iterate##nv_suffix##_m(oop obj,                                               \
                                OopClosureType* closure,                               \
                                MemRegion mr) {                                        \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);      \
-                                                                                      \
   InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr);                    \
                                                                                       \
   if_do_metadata_checked(closure, nv_suffix) {                                        \
--- a/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceMirrorKlass.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,7 @@
 #define SHARE_VM_OOPS_INSTANCEMIRRORKLASS_HPP
 
 #include "classfile/systemDictionary.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/instanceKlass.hpp"
 #include "runtime/handles.hpp"
 #include "utilities/macros.hpp"
--- a/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -30,6 +30,7 @@
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "memory/genCollectedHeap.hpp"
 #include "memory/genOopClosures.inline.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/instanceRefKlass.hpp"
 #include "oops/oop.inline.hpp"
 #include "utilities/preserveException.hpp"
@@ -260,7 +261,6 @@
       return size;                                                              \
     } else if (contains(referent_addr)) {                                       \
       /* treat referent as normal oop */                                        \
-      SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\
       closure->do_oop##nv_suffix(referent_addr);                                \
     }                                                                           \
   }                                                                             \
@@ -276,7 +276,6 @@
                                  INTPTR_FORMAT, disc_addr);                     \
         }                                                                       \
       )                                                                         \
-      SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk);\
       closure->do_oop##nv_suffix(disc_addr);                                    \
     }                                                                           \
   } else {                                                                      \
@@ -293,7 +292,6 @@
   }                                                                             \
   /* treat next as normal oop */                                                \
   if (contains(next_addr)) {                                                    \
-    SpecializationStats::record_do_oop_call##nv_suffix(SpecializationStats::irk); \
     closure->do_oop##nv_suffix(next_addr);                                      \
   }                                                                             \
   return size;                                                                  \
@@ -309,8 +307,6 @@
 int InstanceRefKlass::                                                          \
 oop_oop_iterate##nv_suffix(oop obj, OopClosureType* closure) {                  \
   /* Get size before changing pointers */                                       \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
-                                                                                \
   int size = InstanceKlass::oop_oop_iterate##nv_suffix(obj, closure);           \
                                                                                 \
   if (UseCompressedOops) {                                                      \
@@ -326,8 +322,6 @@
 int InstanceRefKlass::                                                          \
 oop_oop_iterate_backwards##nv_suffix(oop obj, OopClosureType* closure) {        \
   /* Get size before changing pointers */                                       \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
-                                                                                \
   int size = InstanceKlass::oop_oop_iterate_backwards##nv_suffix(obj, closure); \
                                                                                 \
   if (UseCompressedOops) {                                                      \
@@ -345,8 +339,6 @@
 oop_oop_iterate##nv_suffix##_m(oop obj,                                         \
                                OopClosureType* closure,                         \
                                MemRegion mr) {                                  \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::irk);\
-                                                                                \
   int size = InstanceKlass::oop_oop_iterate##nv_suffix##_m(obj, closure, mr);   \
   if (UseCompressedOops) {                                                      \
     InstanceRefKlass_SPECIALIZED_OOP_ITERATE(narrowOop, nv_suffix, mr.contains); \
--- a/hotspot/src/share/vm/oops/instanceRefKlass.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/instanceRefKlass.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
 #define SHARE_VM_OOPS_INSTANCEREFKLASS_HPP
 
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/instanceKlass.hpp"
 #include "utilities/macros.hpp"
 
--- a/hotspot/src/share/vm/oops/klass.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/klass.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -39,8 +39,8 @@
 #include "runtime/atomic.inline.hpp"
 #include "runtime/orderAccess.inline.hpp"
 #include "trace/traceMacros.hpp"
-#include "utilities/stack.hpp"
 #include "utilities/macros.hpp"
+#include "utilities/stack.inline.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/parallelScavenge/psParallelCompact.hpp"
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -32,6 +32,7 @@
 #include "memory/iterator.inline.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/resourceArea.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "memory/universe.inline.hpp"
 #include "oops/instanceKlass.hpp"
 #include "oops/klass.inline.hpp"
@@ -479,7 +480,6 @@
                                                                                 \
 int ObjArrayKlass::oop_oop_iterate##nv_suffix(oop obj,                          \
                                               OopClosureType* closure) {        \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \
   assert (obj->is_array(), "obj must be array");                                \
   objArrayOop a = objArrayOop(obj);                                             \
   /* Get size before changing pointers. */                                      \
@@ -497,7 +497,6 @@
 int ObjArrayKlass::oop_oop_iterate##nv_suffix##_m(oop obj,                      \
                                                   OopClosureType* closure,      \
                                                   MemRegion mr) {               \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \
   assert(obj->is_array(), "obj must be array");                                 \
   objArrayOop a  = objArrayOop(obj);                                            \
   /* Get size before changing pointers. */                                      \
@@ -519,7 +518,6 @@
 int ObjArrayKlass::oop_oop_iterate_range##nv_suffix(oop obj,                    \
                                                   OopClosureType* closure,      \
                                                   int start, int end) {         \
-  SpecializationStats::record_iterate_call##nv_suffix(SpecializationStats::oa); \
   assert(obj->is_array(), "obj must be array");                                 \
   objArrayOop a  = objArrayOop(obj);                                            \
   /* Get size before changing pointers. */                                      \
--- a/hotspot/src/share/vm/oops/objArrayOop.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/objArrayOop.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/objArrayKlass.hpp"
 #include "oops/objArrayOop.hpp"
 #include "oops/oop.inline.hpp"
@@ -46,7 +47,6 @@
 #define ObjArrayOop_OOP_ITERATE_DEFN(OopClosureType, nv_suffix)                    \
                                                                                    \
 int objArrayOopDesc::oop_iterate_range(OopClosureType* blk, int start, int end) {  \
-  SpecializationStats::record_call();                                              \
   return ((ObjArrayKlass*)klass())->oop_oop_iterate_range##nv_suffix(this, blk, start, end); \
 }
 
--- a/hotspot/src/share/vm/oops/objArrayOop.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/objArrayOop.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_OOPS_OBJARRAYOOP_HPP
 #define SHARE_VM_OOPS_OBJARRAYOOP_HPP
 
+#include "memory/specialized_oop_closures.hpp"
 #include "oops/arrayOop.hpp"
 
 // An objArrayOop is an array containing oops.
--- a/hotspot/src/share/vm/oops/oop.inline.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -630,6 +630,30 @@
   return cas_set_mark(m, compare) == compare;
 }
 
+#if INCLUDE_ALL_GCS
+inline oop oopDesc::forward_to_atomic(oop p) {
+  markOop oldMark = mark();
+  markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p);
+  markOop curMark;
+
+  assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable");
+  assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this.");
+
+  while (!oldMark->is_marked()) {
+    curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark);
+    assert(is_forwarded(), "object should have been forwarded");
+    if (curMark == oldMark) {
+      return NULL;
+    }
+    // If the CAS was unsuccessful then curMark->is_marked()
+    // should return true as another thread has CAS'd in another
+    // forwarding pointer.
+    oldMark = curMark;
+  }
+  return forwardee();
+}
+#endif
+
 // Note that the forwardee is not the same thing as the displaced_mark.
 // The forwardee is used when copying during scavenge and mark-sweep.
 // It does need to clear the low two locking- and GC-related bits.
@@ -692,12 +716,10 @@
 #define OOP_ITERATE_DEFN(OopClosureType, nv_suffix)                        \
                                                                            \
 inline int oopDesc::oop_iterate(OopClosureType* blk) {                     \
-  SpecializationStats::record_call();                                      \
   return klass()->oop_oop_iterate##nv_suffix(this, blk);               \
 }                                                                          \
                                                                            \
 inline int oopDesc::oop_iterate(OopClosureType* blk, MemRegion mr) {       \
-  SpecializationStats::record_call();                                      \
   return klass()->oop_oop_iterate##nv_suffix##_m(this, blk, mr);       \
 }
 
@@ -721,7 +743,6 @@
 #define OOP_ITERATE_BACKWARDS_DEFN(OopClosureType, nv_suffix)              \
                                                                            \
 inline int oopDesc::oop_iterate_backwards(OopClosureType* blk) {           \
-  SpecializationStats::record_call();                                      \
   return klass()->oop_oop_iterate_backwards##nv_suffix(this, blk);     \
 }
 
--- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -54,28 +54,4 @@
   klass()->oop_follow_contents(cm, this);
 }
 
-inline oop oopDesc::forward_to_atomic(oop p) {
-  assert(ParNewGeneration::is_legal_forward_ptr(p),
-         "illegal forwarding pointer value.");
-  markOop oldMark = mark();
-  markOop forwardPtrMark = markOopDesc::encode_pointer_as_mark(p);
-  markOop curMark;
-
-  assert(forwardPtrMark->decode_pointer() == p, "encoding must be reversable");
-  assert(sizeof(markOop) == sizeof(intptr_t), "CAS below requires this.");
-
-  while (!oldMark->is_marked()) {
-    curMark = (markOop)Atomic::cmpxchg_ptr(forwardPtrMark, &_mark, oldMark);
-    assert(is_forwarded(), "object should have been forwarded");
-    if (curMark == oldMark) {
-      return NULL;
-    }
-    // If the CAS was unsuccessful then curMark->is_marked()
-    // should return true as another thread has CAS'd in another
-    // forwarding pointer.
-    oldMark = curMark;
-  }
-  return forwardee();
-}
-
 #endif // SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
--- a/hotspot/src/share/vm/opto/graphKit.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/opto/graphKit.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1518,7 +1518,6 @@
   BarrierSet* bs = Universe::heap()->barrier_set();
   set_control(ctl);
   switch (bs->kind()) {
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       g1_write_barrier_pre(do_load, obj, adr, adr_idx, val, val_type, pre_val, bt);
       break;
@@ -1537,7 +1536,6 @@
 bool GraphKit::can_move_pre_barrier() const {
   BarrierSet* bs = Universe::heap()->barrier_set();
   switch (bs->kind()) {
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       return true; // Can move it if no safepoint
 
@@ -1563,7 +1561,6 @@
   BarrierSet* bs = Universe::heap()->barrier_set();
   set_control(ctl);
   switch (bs->kind()) {
-    case BarrierSet::G1SATBCT:
     case BarrierSet::G1SATBCTLogging:
       g1_write_barrier_post(store, obj, adr, adr_idx, val, bt, use_precise);
       break;
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -135,8 +135,6 @@
 # include "memory/resourceArea.hpp"
 # include "memory/sharedHeap.hpp"
 # include "memory/space.hpp"
-# include "memory/space.inline.hpp"
-# include "memory/specialized_oop_closures.hpp"
 # include "memory/threadLocalAllocBuffer.hpp"
 # include "memory/threadLocalAllocBuffer.inline.hpp"
 # include "memory/universe.hpp"
@@ -310,7 +308,6 @@
 # include "gc_implementation/g1/g1BlockOffsetTable.inline.hpp"
 # include "gc_implementation/g1/g1OopClosures.hpp"
 # include "gc_implementation/g1/g1_globals.hpp"
-# include "gc_implementation/g1/g1_specialized_oop_closures.hpp"
 # include "gc_implementation/g1/ptrQueue.hpp"
 # include "gc_implementation/g1/satbQueue.hpp"
 # include "gc_implementation/parNew/parOopClosures.hpp"
--- a/hotspot/src/share/vm/prims/jvm.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/prims/jvm.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -402,7 +402,7 @@
       PUTPROP(props, "sun.nio.MaxDirectMemorySize", "-1");
     } else {
       char as_chars[256];
-      jio_snprintf(as_chars, sizeof(as_chars), UINTX_FORMAT, MaxDirectMemorySize);
+      jio_snprintf(as_chars, sizeof(as_chars), SIZE_FORMAT, MaxDirectMemorySize);
       PUTPROP(props, "sun.nio.MaxDirectMemorySize", as_chars);
     }
   }
--- a/hotspot/src/share/vm/prims/whitebox.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/prims/whitebox.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -295,6 +295,12 @@
   return hr->is_humongous();
 WB_END
 
+WB_ENTRY(jlong, WB_G1NumMaxRegions(JNIEnv* env, jobject o))
+  G1CollectedHeap* g1 = G1CollectedHeap::heap();
+  size_t nr = g1->max_regions();
+  return (jlong)nr;
+WB_END
+
 WB_ENTRY(jlong, WB_G1NumFreeRegions(JNIEnv* env, jobject o))
   G1CollectedHeap* g1 = G1CollectedHeap::heap();
   size_t nr = g1->num_free_regions();
@@ -318,6 +324,14 @@
 WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o))
   return (jint)HeapRegion::GrainBytes;
 WB_END
+
+WB_ENTRY(jobject, WB_G1AuxiliaryMemoryUsage(JNIEnv* env))
+  ResourceMark rm(THREAD);
+  G1CollectedHeap* g1h = G1CollectedHeap::heap();
+  MemoryUsage usage = g1h->get_auxiliary_data_memory_usage();
+  Handle h = MemoryService::create_MemoryUsage_obj(usage, CHECK_NULL);
+  return JNIHandles::make_local(env, h());
+WB_END
 #endif // INCLUDE_ALL_GCS
 
 #if INCLUDE_NMT
@@ -1305,9 +1319,12 @@
 #if INCLUDE_ALL_GCS
   {CC"g1InConcurrentMark", CC"()Z",                   (void*)&WB_G1InConcurrentMark},
   {CC"g1IsHumongous",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
+  {CC"g1NumMaxRegions",    CC"()J",                   (void*)&WB_G1NumMaxRegions  },
   {CC"g1NumFreeRegions",   CC"()J",                   (void*)&WB_G1NumFreeRegions  },
   {CC"g1RegionSize",       CC"()I",                   (void*)&WB_G1RegionSize      },
   {CC"g1StartConcMarkCycle",       CC"()Z",           (void*)&WB_G1StartMarkCycle  },
+  {CC"g1AuxiliaryMemoryUsage", CC"()Ljava/lang/management/MemoryUsage;",
+                                                      (void*)&WB_G1AuxiliaryMemoryUsage  },
 #endif // INCLUDE_ALL_GCS
 #if INCLUDE_NMT
   {CC"NMTMalloc",           CC"(J)J",                 (void*)&WB_NMTMalloc          },
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -67,16 +67,16 @@
   }                                                                   \
 } while(0)
 
-char**  Arguments::_jvm_flags_array             = NULL;
-int     Arguments::_num_jvm_flags               = 0;
-char**  Arguments::_jvm_args_array              = NULL;
-int     Arguments::_num_jvm_args                = 0;
+char** Arguments::_jvm_flags_array              = NULL;
+int    Arguments::_num_jvm_flags                = 0;
+char** Arguments::_jvm_args_array               = NULL;
+int    Arguments::_num_jvm_args                 = 0;
 char*  Arguments::_java_command                 = NULL;
 SystemProperty* Arguments::_system_properties   = NULL;
 const char*  Arguments::_gc_log_filename        = NULL;
 bool   Arguments::_has_profile                  = false;
 size_t Arguments::_conservative_max_heap_alignment = 0;
-uintx  Arguments::_min_heap_size                = 0;
+size_t Arguments::_min_heap_size                = 0;
 uintx  Arguments::_min_heap_free_ratio          = 0;
 uintx  Arguments::_max_heap_free_ratio          = 0;
 Arguments::Mode Arguments::_mode                = _mixed;
@@ -1343,9 +1343,9 @@
     // NewSize was set on the command line and it is larger than
     // preferred_max_new_size.
     if (!FLAG_IS_DEFAULT(NewSize)) {   // NewSize explicitly set at command-line
-      FLAG_SET_ERGO(uintx, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
+      FLAG_SET_ERGO(size_t, MaxNewSize, MAX2(NewSize, preferred_max_new_size));
     } else {
-      FLAG_SET_ERGO(uintx, MaxNewSize, preferred_max_new_size);
+      FLAG_SET_ERGO(size_t, MaxNewSize, preferred_max_new_size);
     }
     if (PrintGCDetails && Verbose) {
       // Too early to use gclog_or_tty
@@ -1368,8 +1368,8 @@
       // Unless explicitly requested otherwise, make young gen
       // at least min_new, and at most preferred_max_new_size.
       if (FLAG_IS_DEFAULT(NewSize)) {
-        FLAG_SET_ERGO(uintx, NewSize, MAX2(NewSize, min_new));
-        FLAG_SET_ERGO(uintx, NewSize, MIN2(preferred_max_new_size, NewSize));
+        FLAG_SET_ERGO(size_t, NewSize, MAX2(NewSize, min_new));
+        FLAG_SET_ERGO(size_t, NewSize, MIN2(preferred_max_new_size, NewSize));
         if (PrintGCDetails && Verbose) {
           // Too early to use gclog_or_tty
           tty->print_cr("CMS ergo set NewSize: " SIZE_FORMAT, NewSize);
@@ -1379,7 +1379,7 @@
       // so it's NewRatio x of NewSize.
       if (FLAG_IS_DEFAULT(OldSize)) {
         if (max_heap > NewSize) {
-          FLAG_SET_ERGO(uintx, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
+          FLAG_SET_ERGO(size_t, OldSize, MIN2(NewRatio*NewSize, max_heap - NewSize));
           if (PrintGCDetails && Verbose) {
             // Too early to use gclog_or_tty
             tty->print_cr("CMS ergo set OldSize: " SIZE_FORMAT, OldSize);
@@ -1410,7 +1410,7 @@
       // OldPLAB sizing manually turned off: Use a larger default setting,
       // unless it was manually specified. This is because a too-low value
       // will slow down scavenges.
-      FLAG_SET_ERGO(uintx, OldPLABSize, CFLS_LAB::_default_static_old_plab_size); // default value before 6631166
+      FLAG_SET_ERGO(size_t, OldPLABSize, CFLS_LAB::_default_static_old_plab_size); // default value before 6631166
     } else {
       FLAG_SET_DEFAULT(OldPLABSize, CFLS_LAB::_default_dynamic_old_plab_size); // old CMSParPromoteBlocksToClaim default
     }
@@ -1612,7 +1612,7 @@
 
 void Arguments::select_gc() {
   if (!gc_selected()) {
-    ArgumentsExt::select_gc_ergonomically();
+    select_gc_ergonomically();
   }
 }
 
@@ -1790,7 +1790,7 @@
 }
 
 // Use static initialization to get the default before parsing
-static const uintx DefaultHeapBaseMinAddress = HeapBaseMinAddress;
+static const size_t DefaultHeapBaseMinAddress = HeapBaseMinAddress;
 
 void Arguments::set_heap_size() {
   if (!FLAG_IS_DEFAULT(DefaultMaxRAMFraction)) {
@@ -1830,14 +1830,14 @@
           // matches compressed oops printing flags
           if (PrintCompressedOopsMode || (PrintMiscellaneous && Verbose)) {
             jio_fprintf(defaultStream::error_stream(),
-                        "HeapBaseMinAddress must be at least " UINTX_FORMAT
-                        " (" UINTX_FORMAT "G) which is greater than value given "
-                        UINTX_FORMAT "\n",
+                        "HeapBaseMinAddress must be at least " SIZE_FORMAT
+                        " (" SIZE_FORMAT "G) which is greater than value given "
+                        SIZE_FORMAT "\n",
                         DefaultHeapBaseMinAddress,
                         DefaultHeapBaseMinAddress/G,
                         HeapBaseMinAddress);
           }
-          FLAG_SET_ERGO(uintx, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
+          FLAG_SET_ERGO(size_t, HeapBaseMinAddress, DefaultHeapBaseMinAddress);
         }
       }
 
@@ -1862,7 +1862,7 @@
       // Cannot use gclog_or_tty yet.
       tty->print_cr("  Maximum heap size " SIZE_FORMAT, (size_t) reasonable_max);
     }
-    FLAG_SET_ERGO(uintx, MaxHeapSize, (uintx)reasonable_max);
+    FLAG_SET_ERGO(size_t, MaxHeapSize, (size_t)reasonable_max);
   }
 
   // If the minimum or initial heap_size have not been set or requested to be set
@@ -1884,14 +1884,14 @@
 
       if (PrintGCDetails && Verbose) {
         // Cannot use gclog_or_tty yet.
-        tty->print_cr("  Initial heap size " SIZE_FORMAT, (uintx)reasonable_initial);
+        tty->print_cr("  Initial heap size " SIZE_FORMAT, (size_t)reasonable_initial);
       }
-      FLAG_SET_ERGO(uintx, InitialHeapSize, (uintx)reasonable_initial);
+      FLAG_SET_ERGO(size_t, InitialHeapSize, (size_t)reasonable_initial);
     }
     // If the minimum heap size has not been set (via -Xms),
     // synchronize with InitialHeapSize to avoid errors with the default value.
     if (min_heap_size() == 0) {
-      set_min_heap_size(MIN2((uintx)reasonable_minimum, InitialHeapSize));
+      set_min_heap_size(MIN2((size_t)reasonable_minimum, InitialHeapSize));
       if (PrintGCDetails && Verbose) {
         // Cannot use gclog_or_tty yet.
         tty->print_cr("  Minimum heap size " SIZE_FORMAT, min_heap_size());
@@ -2037,7 +2037,7 @@
   }
 
   if (UseGCLogFileRotation && (GCLogFileSize != 0) && (GCLogFileSize < 8*K)) {
-    FLAG_SET_CMDLINE(uintx, GCLogFileSize, 8*K);
+    FLAG_SET_CMDLINE(size_t, GCLogFileSize, 8*K);
     jio_fprintf(defaultStream::output_stream(),
                 "GCLogFileSize changed to minimum 8K\n");
   }
@@ -2121,7 +2121,7 @@
 }
 
 // Check consistency of GC selection
-bool Arguments::check_gc_consistency_user() {
+bool Arguments::check_gc_consistency() {
   check_gclog_consistency();
   // Ensure that the user has not selected conflicting sets
   // of collectors.
@@ -2265,7 +2265,7 @@
     FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
   }
 
-  status = status && check_gc_consistency_user();
+  status = status && check_gc_consistency();
   status = status && check_stack_pages();
 
   status = status && verify_percentage(CMSIncrementalSafetyFactor,
@@ -2394,7 +2394,7 @@
 
   status = status && verify_min_value(LogEventsBufferEntries, 1, "LogEventsBufferEntries");
 
-  status = status && verify_min_value(HeapSizePerGCThread, (uintx) os::vm_page_size(), "HeapSizePerGCThread");
+  status = status && verify_min_value(HeapSizePerGCThread, (size_t) os::vm_page_size(), "HeapSizePerGCThread");
 
   status = status && verify_min_value(GCTaskTimeStampEntries, 1, "GCTaskTimeStampEntries");
 
@@ -2809,8 +2809,8 @@
         describe_range_error(errcode);
         return JNI_EINVAL;
       }
-      FLAG_SET_CMDLINE(uintx, MaxNewSize, (uintx)long_initial_young_size);
-      FLAG_SET_CMDLINE(uintx, NewSize, (uintx)long_initial_young_size);
+      FLAG_SET_CMDLINE(size_t, MaxNewSize, (size_t)long_initial_young_size);
+      FLAG_SET_CMDLINE(size_t, NewSize, (size_t)long_initial_young_size);
     // -Xms
     } else if (match_option(option, "-Xms", &tail)) {
       julong long_initial_heap_size = 0;
@@ -2822,10 +2822,10 @@
         describe_range_error(errcode);
         return JNI_EINVAL;
       }
-      set_min_heap_size((uintx)long_initial_heap_size);
+      set_min_heap_size((size_t)long_initial_heap_size);
       // Currently the minimum size and the initial heap sizes are the same.
       // Can be overridden with -XX:InitialHeapSize.
-      FLAG_SET_CMDLINE(uintx, InitialHeapSize, (uintx)long_initial_heap_size);
+      FLAG_SET_CMDLINE(size_t, InitialHeapSize, (size_t)long_initial_heap_size);
     // -Xmx
     } else if (match_option(option, "-Xmx", &tail) || match_option(option, "-XX:MaxHeapSize=", &tail)) {
       julong long_max_heap_size = 0;
@@ -2836,7 +2836,7 @@
         describe_range_error(errcode);
         return JNI_EINVAL;
       }
-      FLAG_SET_CMDLINE(uintx, MaxHeapSize, (uintx)long_max_heap_size);
+      FLAG_SET_CMDLINE(size_t, MaxHeapSize, (size_t)long_max_heap_size);
     // Xmaxf
     } else if (match_option(option, "-Xmaxf", &tail)) {
       char* err;
@@ -2977,7 +2977,7 @@
       FLAG_SET_CMDLINE(bool, BackgroundCompilation, false);
       FLAG_SET_CMDLINE(intx, DeferThrSuspendLoopCount, 1);
       FLAG_SET_CMDLINE(bool, UseTLAB, false);
-      FLAG_SET_CMDLINE(uintx, NewSizeThreadIncrease, 16 * K);  // 20Kb per thread added to new generation
+      FLAG_SET_CMDLINE(size_t, NewSizeThreadIncrease, 16 * K);  // 20Kb per thread added to new generation
 
       // -Xinternalversion
     } else if (match_option(option, "-Xinternalversion")) {
@@ -3138,16 +3138,16 @@
       initHeapSize = limit_by_allocatable_memory(initHeapSize);
 
       if (FLAG_IS_DEFAULT(MaxHeapSize)) {
-         FLAG_SET_CMDLINE(uintx, MaxHeapSize, initHeapSize);
-         FLAG_SET_CMDLINE(uintx, InitialHeapSize, initHeapSize);
+         FLAG_SET_CMDLINE(size_t, MaxHeapSize, initHeapSize);
+         FLAG_SET_CMDLINE(size_t, InitialHeapSize, initHeapSize);
          // Currently the minimum size and the initial heap sizes are the same.
          set_min_heap_size(initHeapSize);
       }
       if (FLAG_IS_DEFAULT(NewSize)) {
          // Make the young generation 3/8ths of the total heap.
-         FLAG_SET_CMDLINE(uintx, NewSize,
+         FLAG_SET_CMDLINE(size_t, NewSize,
                                 ((julong)MaxHeapSize / (julong)8) * (julong)3);
-         FLAG_SET_CMDLINE(uintx, MaxNewSize, NewSize);
+         FLAG_SET_CMDLINE(size_t, MaxNewSize, NewSize);
       }
 
 #ifndef _ALLBSD_SOURCE  // UseLargePages is not yet supported on BSD.
@@ -3155,14 +3155,14 @@
 #endif
 
       // Increase some data structure sizes for efficiency
-      FLAG_SET_CMDLINE(uintx, BaseFootPrintEstimate, MaxHeapSize);
+      FLAG_SET_CMDLINE(size_t, BaseFootPrintEstimate, MaxHeapSize);
       FLAG_SET_CMDLINE(bool, ResizeTLAB, false);
-      FLAG_SET_CMDLINE(uintx, TLABSize, 256*K);
+      FLAG_SET_CMDLINE(size_t, TLABSize, 256*K);
 
       // See the OldPLABSize comment below, but replace 'after promotion'
       // with 'after copying'.  YoungPLABSize is the size of the survivor
       // space per-gc-thread buffers.  The default is 4kw.
-      FLAG_SET_CMDLINE(uintx, YoungPLABSize, 256*K);      // Note: this is in words
+      FLAG_SET_CMDLINE(size_t, YoungPLABSize, 256*K);      // Note: this is in words
 
       // OldPLABSize is the size of the buffers in the old gen that
       // UseParallelGC uses to promote live data that doesn't fit in the
@@ -3177,7 +3177,7 @@
       // locality.  A minor effect may be that larger PLABs reduce the
       // number of PLAB allocation events during gc.  The value of 8kw
       // was arrived at by experimenting with specjbb.
-      FLAG_SET_CMDLINE(uintx, OldPLABSize, 8*K);  // Note: this is in words
+      FLAG_SET_CMDLINE(size_t, OldPLABSize, 8*K);  // Note: this is in words
 
       // Enable parallel GC and adaptive generation sizing
       FLAG_SET_CMDLINE(bool, UseParallelGC, true);
@@ -3256,7 +3256,7 @@
       jio_fprintf(defaultStream::error_stream(),
         "Please use -XX:MarkStackSize in place of "
         "-XX:CMSMarkStackSize or -XX:G1MarkStackSize in the future\n");
-      FLAG_SET_CMDLINE(uintx, MarkStackSize, stack_size);
+      FLAG_SET_CMDLINE(size_t, MarkStackSize, stack_size);
     } else if (match_option(option, "-XX:CMSMarkStackSizeMax=", &tail)) {
       julong max_stack_size = 0;
       ArgsRange errcode = parse_memory_size(tail, &max_stack_size, 1);
@@ -3270,7 +3270,7 @@
       jio_fprintf(defaultStream::error_stream(),
          "Please use -XX:MarkStackSizeMax in place of "
          "-XX:CMSMarkStackSizeMax in the future\n");
-      FLAG_SET_CMDLINE(uintx, MarkStackSizeMax, max_stack_size);
+      FLAG_SET_CMDLINE(size_t, MarkStackSizeMax, max_stack_size);
     } else if (match_option(option, "-XX:ParallelMarkingThreads=", &tail) ||
                match_option(option, "-XX:ParallelCMSThreads=", &tail)) {
       uintx conc_threads = 0;
@@ -3293,7 +3293,7 @@
         describe_range_error(errcode);
         return JNI_EINVAL;
       }
-      FLAG_SET_CMDLINE(uintx, MaxDirectMemorySize, max_direct_memory_size);
+      FLAG_SET_CMDLINE(size_t, MaxDirectMemorySize, max_direct_memory_size);
 #if !INCLUDE_MANAGEMENT
     } else if (match_option(option, "-XX:+ManagementServer")) {
         jio_fprintf(defaultStream::error_stream(),
@@ -3900,7 +3900,7 @@
   set_shared_spaces_flags();
 
   // Check the GC selections again.
-  if (!ArgumentsExt::check_gc_consistency_ergo()) {
+  if (!check_gc_consistency()) {
     return JNI_EINVAL;
   }
 
--- a/hotspot/src/share/vm/runtime/arguments.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -477,8 +477,7 @@
   static bool verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_heap_free_ratio);
 
   // Check for consistency in the selection of the garbage collector.
-  static bool check_gc_consistency_user();        // Check user-selected gc
-  static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc
+  static bool check_gc_consistency();        // Check user-selected gc
   static void check_deprecated_gc_flags();
   // Check consistency or otherwise of VM argument settings
   static bool check_vm_args_consistency();
@@ -531,8 +530,8 @@
   static bool has_profile()                 { return _has_profile; }
 
   // -Xms
-  static uintx min_heap_size()              { return _min_heap_size; }
-  static void  set_min_heap_size(uintx v)   { _min_heap_size = v;  }
+  static size_t min_heap_size()             { return _min_heap_size; }
+  static void  set_min_heap_size(size_t v)  { _min_heap_size = v;  }
 
   // Returns the original values of -XX:MinHeapFreeRatio and -XX:MaxHeapFreeRatio
   static uintx min_heap_free_ratio()        { return _min_heap_free_ratio; }
@@ -618,10 +617,6 @@
   return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || UseSerialGC;
 }
 
-bool Arguments::check_gc_consistency_ergo() {
-  return check_gc_consistency_user();
-}
-
 // Disable options not supported in this release, with a warning if they
 // were explicitly requested on the command-line
 #define UNSUPPORTED_OPTION(opt, description)                    \
--- a/hotspot/src/share/vm/runtime/arguments_ext.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -30,9 +30,7 @@
 
 class ArgumentsExt: AllStatic {
 public:
-  static inline void select_gc_ergonomically();
   static inline void set_gc_specific_flags();
-  static inline bool check_gc_consistency_ergo();
   // The argument processing extension. Returns true if there is
   // no additional parsing needed in Arguments::parse() for the option.
   // Otherwise returns false.
@@ -40,16 +38,8 @@
   static inline void report_unsupported_options() { }
 };
 
-void ArgumentsExt::select_gc_ergonomically() {
-  Arguments::select_gc_ergonomically();
-}
-
 void ArgumentsExt::set_gc_specific_flags() {
   Arguments::set_gc_specific_flags();
 }
 
-bool ArgumentsExt::check_gc_consistency_ergo() {
-  return Arguments::check_gc_consistency_ergo();
-}
-
 #endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP
--- a/hotspot/src/share/vm/runtime/globals.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/runtime/globals.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -193,19 +193,19 @@
 define_pd_global(intx, OnStackReplacePercentage,     0);
 define_pd_global(bool, ResizeTLAB,                   false);
 define_pd_global(intx, FreqInlineSize,               0);
-define_pd_global(intx, NewSizeThreadIncrease,        4*K);
+define_pd_global(size_t, NewSizeThreadIncrease,      4*K);
 define_pd_global(intx, InlineClassNatives,           true);
 define_pd_global(intx, InlineUnsafeOps,              true);
 define_pd_global(intx, InitialCodeCacheSize,         160*K);
 define_pd_global(intx, ReservedCodeCacheSize,        32*M);
 define_pd_global(intx, NonProfiledCodeHeapSize,      0);
 define_pd_global(intx, ProfiledCodeHeapSize,         0);
-define_pd_global(intx, NonNMethodCodeHeapSize,        32*M);
+define_pd_global(intx, NonNMethodCodeHeapSize,       32*M);
 
 define_pd_global(intx, CodeCacheExpansionSize,       32*K);
 define_pd_global(intx, CodeCacheMinBlockLength,      1);
 define_pd_global(intx, CodeCacheMinimumUseSpace,     200*K);
-define_pd_global(uintx,MetaspaceSize,    ScaleForWordSize(4*M));
+define_pd_global(size_t, MetaspaceSize,              ScaleForWordSize(4*M));
 define_pd_global(bool, NeverActAsServerClassMachine, true);
 define_pd_global(uint64_t,MaxRAM,                    1ULL*G);
 #define CI_COMPILER_COUNT 0
@@ -468,7 +468,7 @@
 // notproduct flags are settable / visible only during development and are not declared in the PRODUCT version
 
 // A flag must be declared with one of the following types:
-// bool, intx, uintx, ccstr, double, or uint64_t.
+// bool, intx, uintx, size_t, ccstr, double, or uint64_t.
 // The type "ccstr" is an alias for "const char*" and is used
 // only in this file, because the macrology requires single-token type names.
 
@@ -540,7 +540,7 @@
   notproduct(bool, CheckCompressedOops, true,                               \
           "Generate checks in encoding/decoding code in debug VM")          \
                                                                             \
-  product_pd(uintx, HeapBaseMinAddress,                                     \
+  product_pd(size_t, HeapBaseMinAddress,                                    \
           "OS specific low limit for heap base address")                    \
                                                                             \
   product(uintx, HeapSearchSteps, 3 PPC64_ONLY(+17),                        \
@@ -606,7 +606,7 @@
   product(bool, UseNUMAInterleaving, false,                                 \
           "Interleave memory across NUMA nodes if available")               \
                                                                             \
-  product(uintx, NUMAInterleaveGranularity, 2*M,                            \
+  product(size_t, NUMAInterleaveGranularity, 2*M,                           \
           "Granularity to use for NUMA interleaving on Windows OS")         \
                                                                             \
   product(bool, ForceNUMA, false,                                           \
@@ -617,7 +617,7 @@
           "computing exponentially decaying average for "                   \
           "AdaptiveNUMAChunkSizing")                                        \
                                                                             \
-  product(uintx, NUMASpaceResizeRate, 1*G,                                  \
+  product(size_t, NUMASpaceResizeRate, 1*G,                                 \
           "Do not reallocate more than this amount per collection")         \
                                                                             \
   product(bool, UseAdaptiveNUMAChunkSizing, true,                           \
@@ -641,10 +641,10 @@
   product(bool, UseSHA, false,                                              \
           "Control whether SHA instructions can be used on SPARC")          \
                                                                             \
-  product(uintx, LargePageSizeInBytes, 0,                                   \
+  product(size_t, LargePageSizeInBytes, 0,                                  \
           "Large page size (0 to let VM choose the page size)")             \
                                                                             \
-  product(uintx, LargePageHeapSizeThreshold, 128*M,                         \
+  product(size_t, LargePageHeapSizeThreshold, 128*M,                        \
           "Use large pages if maximum heap is at least this big")           \
                                                                             \
   product(bool, ForceTimeHighResolution, false,                             \
@@ -966,11 +966,11 @@
           "directory) of the dump file (defaults to java_pid<pid>.hprof "   \
           "in the working directory)")                                      \
                                                                             \
-  develop(uintx, SegmentedHeapDumpThreshold, 2*G,                           \
+  develop(size_t, SegmentedHeapDumpThreshold, 2*G,                          \
           "Generate a segmented heap dump (JAVA PROFILE 1.0.2 format) "     \
           "when the heap usage is larger than this")                        \
                                                                             \
-  develop(uintx, HeapDumpSegmentSize, 1*G,                                  \
+  develop(size_t, HeapDumpSegmentSize, 1*G,                                 \
           "Approximate segment size when generating a segmented heap dump") \
                                                                             \
   develop(bool, BreakAtWarning, false,                                      \
@@ -1468,7 +1468,7 @@
           "Force dynamic selection of the number of "                       \
           "parallel threads parallel gc will use to aid debugging")         \
                                                                             \
-  product(uintx, HeapSizePerGCThread, ScaleForWordSize(64*M),               \
+  product(size_t, HeapSizePerGCThread, ScaleForWordSize(64*M),              \
           "Size of heap (bytes) per GC thread used in calculating the "     \
           "number of GC threads")                                           \
                                                                             \
@@ -1485,10 +1485,10 @@
   product(uintx, ConcGCThreads, 0,                                          \
           "Number of threads concurrent gc will use")                       \
                                                                             \
-  product(uintx, YoungPLABSize, 4096,                                       \
+  product(size_t, YoungPLABSize, 4096,                                      \
           "Size of young gen promotion LAB's (in HeapWords)")               \
                                                                             \
-  product(uintx, OldPLABSize, 1024,                                         \
+  product(size_t, OldPLABSize, 1024,                                        \
           "Size of old gen promotion LAB's (in HeapWords), or Number        \
           of blocks to attempt to claim when refilling CMS LAB's")          \
                                                                             \
@@ -1607,11 +1607,11 @@
   product(bool, PrintOldPLAB, false,                                        \
           "Print (old gen) promotion LAB's sizing decisions")               \
                                                                             \
-  product(uintx, CMSOldPLABMin, 16,                                         \
+  product(size_t, CMSOldPLABMin, 16,                                        \
           "Minimum size of CMS gen promotion LAB caches per worker "        \
           "per block size")                                                 \
                                                                             \
-  product(uintx, CMSOldPLABMax, 1024,                                       \
+  product(size_t, CMSOldPLABMax, 1024,                                      \
           "Maximum size of CMS gen promotion LAB caches per worker "        \
           "per block size")                                                 \
                                                                             \
@@ -1634,7 +1634,7 @@
   product(bool, AlwaysPreTouch, false,                                      \
           "Force all freshly committed pages to be pre-touched")            \
                                                                             \
-  product_pd(uintx, CMSYoungGenPerWorker,                                   \
+  product_pd(size_t, CMSYoungGenPerWorker,                                  \
           "The maximum size of young gen chosen by default per GC worker "  \
           "thread available")                                               \
                                                                             \
@@ -1726,10 +1726,10 @@
   develop(bool, CMSOverflowEarlyRestoration, false,                         \
           "Restore preserved marks early")                                  \
                                                                             \
-  product(uintx, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M),              \
+  product(size_t, MarkStackSize, NOT_LP64(32*K) LP64_ONLY(4*M),             \
           "Size of marking stack")                                          \
                                                                             \
-  product(uintx, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M),          \
+  product(size_t, MarkStackSizeMax, NOT_LP64(4*M) LP64_ONLY(512*M),         \
           "Maximum size of marking stack")                                  \
                                                                             \
   notproduct(bool, CMSMarkStackOverflowALot, false,                         \
@@ -1752,10 +1752,10 @@
           "Time that we sleep between iterations when not given "           \
           "enough work per iteration")                                      \
                                                                             \
-  product(uintx, CMSRescanMultiple, 32,                                     \
+  product(size_t, CMSRescanMultiple, 32,                                    \
           "Size (in cards) of CMS parallel rescan task")                    \
                                                                             \
-  product(uintx, CMSConcMarkMultiple, 32,                                   \
+  product(size_t, CMSConcMarkMultiple, 32,                                  \
           "Size (in cards) of CMS concurrent MT marking task")              \
                                                                             \
   product(bool, CMSAbortSemantics, false,                                   \
@@ -1822,7 +1822,7 @@
   product(uintx, CMSRemarkVerifyVariant, 1,                                 \
           "Choose variant (1,2) of verification following remark")          \
                                                                             \
-  product(uintx, CMSScheduleRemarkEdenSizeThreshold, 2*M,                   \
+  product(size_t, CMSScheduleRemarkEdenSizeThreshold, 2*M,                  \
           "If Eden size is below this, do not try to schedule remark")      \
                                                                             \
   product(uintx, CMSScheduleRemarkEdenPenetration, 50,                      \
@@ -1856,7 +1856,7 @@
   product(bool, CMSYield, true,                                             \
           "Yield between steps of CMS")                                     \
                                                                             \
-  product(uintx, CMSBitMapYieldQuantum, 10*M,                               \
+  product(size_t, CMSBitMapYieldQuantum, 10*M,                              \
           "Bitmap operations should process at most this many bits "        \
           "between yields")                                                 \
                                                                             \
@@ -2036,7 +2036,7 @@
   product_pd(uint64_t, MaxRAM,                                              \
           "Real memory size (in bytes) used to set maximum heap size")      \
                                                                             \
-  product(uintx, ErgoHeapSizeLimit, 0,                                      \
+  product(size_t, ErgoHeapSizeLimit, 0,                                     \
           "Maximum ergonomically set heap size (in bytes); zero means use " \
           "MaxRAM / MaxRAMFraction")                                        \
                                                                             \
@@ -2179,7 +2179,7 @@
   product(uintx, InitialSurvivorRatio, 8,                                   \
           "Initial ratio of young generation/survivor space size")          \
                                                                             \
-  product(uintx, BaseFootPrintEstimate, 256*M,                              \
+  product(size_t, BaseFootPrintEstimate, 256*M,                             \
           "Estimate of footprint other than Java Heap")                     \
                                                                             \
   product(bool, UseGCOverheadLimit, true,                                   \
@@ -2330,7 +2330,7 @@
   develop(bool, TraceClassLoaderData, false,                                \
           "Trace class loader loader_data lifetime")                        \
                                                                             \
-  product(uintx, InitialBootClassLoaderMetaspaceSize,                       \
+  product(size_t, InitialBootClassLoaderMetaspaceSize,                      \
           NOT_LP64(2200*K) LP64_ONLY(4*M),                                  \
           "Initial size of the boot class loader data metaspace")           \
                                                                             \
@@ -2420,7 +2420,7 @@
           "Number of gclog files in rotation "                              \
           "(default: 0, no rotation)")                                      \
                                                                             \
-  product(uintx, GCLogFileSize, 8*K,                                        \
+  product(size_t, GCLogFileSize, 8*K,                                       \
           "GC log file size, requires UseGCLogFileRotation. "               \
           "Set to 0 to only trigger rotation via jcmd")                     \
                                                                             \
@@ -2958,11 +2958,11 @@
   notproduct(ccstrlist, SuppressErrorAt, "",                                \
           "List of assertions (file:line) to muzzle")                       \
                                                                             \
-  notproduct(uintx, HandleAllocationLimit, 1024,                            \
+  notproduct(size_t, HandleAllocationLimit, 1024,                           \
           "Threshold for HandleMark allocation when +TraceHandleAllocation "\
           "is used")                                                        \
                                                                             \
-  develop(uintx, TotalHandleAllocationLimit, 1024,                          \
+  develop(size_t, TotalHandleAllocationLimit, 1024,                         \
           "Threshold for total handle allocation when "                     \
           "+TraceHandleAllocation is used")                                 \
                                                                             \
@@ -3106,30 +3106,30 @@
           "Number of times to spin wait before inflation")                  \
                                                                             \
   /* gc parameters */                                                       \
-  product(uintx, InitialHeapSize, 0,                                        \
+  product(size_t, InitialHeapSize, 0,                                       \
           "Initial heap size (in bytes); zero means use ergonomics")        \
                                                                             \
-  product(uintx, MaxHeapSize, ScaleForWordSize(96*M),                       \
+  product(size_t, MaxHeapSize, ScaleForWordSize(96*M),                      \
           "Maximum heap size (in bytes)")                                   \
                                                                             \
-  product(uintx, OldSize, ScaleForWordSize(4*M),                            \
+  product(size_t, OldSize, ScaleForWordSize(4*M),                           \
           "Initial tenured generation size (in bytes)")                     \
                                                                             \
-  product(uintx, NewSize, ScaleForWordSize(1*M),                            \
+  product(size_t, NewSize, ScaleForWordSize(1*M),                           \
           "Initial new generation size (in bytes)")                         \
                                                                             \
-  product(uintx, MaxNewSize, max_uintx,                                     \
+  product(size_t, MaxNewSize, max_uintx,                                    \
           "Maximum new generation size (in bytes), max_uintx means set "    \
           "ergonomically")                                                  \
                                                                             \
-  product(uintx, PretenureSizeThreshold, 0,                                 \
+  product(size_t, PretenureSizeThreshold, 0,                                \
           "Maximum size in bytes of objects allocated in DefNew "           \
           "generation; zero means no maximum")                              \
                                                                             \
-  product(uintx, TLABSize, 0,                                               \
+  product(size_t, TLABSize, 0,                                              \
           "Starting TLAB size (in bytes); zero means set ergonomically")    \
                                                                             \
-  product(uintx, MinTLABSize, 2*K,                                          \
+  product(size_t, MinTLABSize, 2*K,                                         \
           "Minimum allowed TLAB size (in bytes)")                           \
                                                                             \
   product(uintx, TLABAllocationWeight, 35,                                  \
@@ -3150,17 +3150,17 @@
   product(uintx, NewRatio, 2,                                               \
           "Ratio of old/new generation sizes")                              \
                                                                             \
-  product_pd(uintx, NewSizeThreadIncrease,                                  \
+  product_pd(size_t, NewSizeThreadIncrease,                                 \
           "Additional size added to desired new generation size per "       \
           "non-daemon thread (in bytes)")                                   \
                                                                             \
-  product_pd(uintx, MetaspaceSize,                                          \
+  product_pd(size_t, MetaspaceSize,                                         \
           "Initial size of Metaspaces (in bytes)")                          \
                                                                             \
-  product(uintx, MaxMetaspaceSize, max_uintx,                               \
+  product(size_t, MaxMetaspaceSize, max_uintx,                              \
           "Maximum size of Metaspaces (in bytes)")                          \
                                                                             \
-  product(uintx, CompressedClassSpaceSize, 1*G,                             \
+  product(size_t, CompressedClassSpaceSize, 1*G,                            \
           "Maximum size of class area in Metaspace when compressed "        \
           "class pointers are used")                                        \
                                                                             \
@@ -3177,10 +3177,10 @@
   product(intx, SoftRefLRUPolicyMSPerMB, 1000,                              \
           "Number of milliseconds per MB of free space in the heap")        \
                                                                             \
-  product(uintx, MinHeapDeltaBytes, ScaleForWordSize(128*K),                \
+  product(size_t, MinHeapDeltaBytes, ScaleForWordSize(128*K),               \
           "The minimum change in heap space due to GC (in bytes)")          \
                                                                             \
-  product(uintx, MinMetaspaceExpansion, ScaleForWordSize(256*K),            \
+  product(size_t, MinMetaspaceExpansion, ScaleForWordSize(256*K),           \
           "The minimum expansion of Metaspace (in bytes)")                  \
                                                                             \
   product(uintx, MinMetaspaceFreeRatio,    40,                              \
@@ -3191,7 +3191,7 @@
           "The maximum percentage of Metaspace free after GC to avoid "     \
           "shrinking")                                                      \
                                                                             \
-  product(uintx, MaxMetaspaceExpansion, ScaleForWordSize(4*M),              \
+  product(size_t, MaxMetaspaceExpansion, ScaleForWordSize(4*M),             \
           "The maximum expansion of Metaspace without full GC (in bytes)")  \
                                                                             \
   product(uintx, QueuedAllocationWarningCount, 0,                           \
@@ -3282,10 +3282,10 @@
   product_pd(intx, CompilerThreadStackSize,                                 \
           "Compiler Thread Stack Size (in Kbytes)")                         \
                                                                             \
-  develop_pd(uintx, JVMInvokeMethodSlack,                                   \
+  develop_pd(size_t, JVMInvokeMethodSlack,                                  \
           "Stack space (bytes) required for JVM_InvokeMethod to complete")  \
                                                                             \
-  product(uintx, ThreadSafetyMargin, 50*M,                                  \
+  product(size_t, ThreadSafetyMargin, 50*M,                                 \
           "Thread safety margin is used on fixed-stack LinuxThreads (on "   \
           "Linux/x86 only) to prevent heap-stack collision. Set to 0 to "   \
           "disable this feature")                                           \
@@ -3673,7 +3673,7 @@
                                                                             \
   /* Properties for Java libraries  */                                      \
                                                                             \
-  product(uintx, MaxDirectMemorySize, 0,                                    \
+  product(size_t, MaxDirectMemorySize, 0,                                   \
           "Maximum total size of NIO direct-buffer allocations")            \
                                                                             \
   /* Flags used for temporary code during development  */                   \
@@ -3777,10 +3777,10 @@
           "If PrintSharedArchiveAndExit is true, also print the shared "    \
           "dictionary")                                                     \
                                                                             \
-  product(uintx, SharedReadWriteSize,  NOT_LP64(12*M) LP64_ONLY(16*M),      \
+  product(size_t, SharedReadWriteSize,  NOT_LP64(12*M) LP64_ONLY(16*M),     \
           "Size of read-write space for metadata (in bytes)")               \
                                                                             \
-  product(uintx, SharedReadOnlySize,  NOT_LP64(12*M) LP64_ONLY(16*M),       \
+  product(size_t, SharedReadOnlySize,  NOT_LP64(12*M) LP64_ONLY(16*M),      \
           "Size of read-only space for metadata (in bytes)")                \
                                                                             \
   product(uintx, SharedMiscDataSize,    NOT_LP64(2*M) LP64_ONLY(4*M),       \
--- a/hotspot/src/share/vm/runtime/handles.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/runtime/handles.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -83,7 +83,7 @@
   }
 
   // The thread local handle areas should not get very large
-  if (TraceHandleAllocation && handles_visited > TotalHandleAllocationLimit) {
+  if (TraceHandleAllocation && (size_t)handles_visited > TotalHandleAllocationLimit) {
 #ifdef ASSERT
     warning("%d: Visited in HandleMark : %d",
       _nof_handlemarks, handles_visited);
--- a/hotspot/src/share/vm/runtime/thread.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/runtime/thread.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -87,8 +87,9 @@
 #include "utilities/defaultStream.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/preserveException.hpp"
-#include "utilities/macros.hpp"
+#include "utilities/workgroup.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 #include "gc_implementation/g1/concurrentMarkThread.inline.hpp"
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -536,7 +536,7 @@
   nonstatic_field(ContiguousSpace,             _concurrent_iteration_safe_limit,              HeapWord*)                             \
   nonstatic_field(ContiguousSpace,             _saved_mark_word,                              HeapWord*)                             \
                                                                                                                                      \
-  nonstatic_field(DefNewGeneration,            _next_gen,                                     Generation*)                           \
+  nonstatic_field(DefNewGeneration,            _old_gen,                                      Generation*)                           \
   nonstatic_field(DefNewGeneration,            _tenuring_threshold,                           uint)                                  \
   nonstatic_field(DefNewGeneration,            _age_table,                                    ageTable)                              \
   nonstatic_field(DefNewGeneration,            _eden_space,                                   ContiguousSpace*)                      \
--- a/hotspot/src/share/vm/services/heapDumper.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/services/heapDumper.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1721,7 +1721,7 @@
   // Write the file header - use 1.0.2 for large heaps, otherwise 1.0.1
   size_t used = ch->used();
   const char* header;
-  if (used > (size_t)SegmentedHeapDumpThreshold) {
+  if (used > SegmentedHeapDumpThreshold) {
     set_segmented_dump();
     header = "JAVA PROFILE 1.0.2";
   } else {
--- a/hotspot/src/share/vm/services/lowMemoryDetector.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/services/lowMemoryDetector.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -28,6 +28,7 @@
 #include "memory/allocation.hpp"
 #include "services/memoryPool.hpp"
 #include "services/memoryService.hpp"
+#include "services/memoryUsage.hpp"
 
 // Low Memory Detection Support
 // Two memory alarms in the JDK (we called them sensors).
--- a/hotspot/src/share/vm/services/memoryPool.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryPool.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -25,7 +25,9 @@
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
+#include "memory/defNewGeneration.hpp"
 #include "memory/metaspace.hpp"
+#include "memory/space.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
@@ -34,8 +36,11 @@
 #include "services/management.hpp"
 #include "services/memoryManager.hpp"
 #include "services/memoryPool.hpp"
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
-#include "utilities/globalDefinitions.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
+#endif
 
 MemoryPool::MemoryPool(const char* name,
                        PoolType type,
@@ -187,6 +192,10 @@
                       support_usage_threshold), _space(space) {
 }
 
+size_t ContiguousSpacePool::used_in_bytes() {
+  return space()->used();
+}
+
 MemoryUsage ContiguousSpacePool::get_memory_usage() {
   size_t maxSize   = (available_for_allocation() ? max_size() : 0);
   size_t used      = used_in_bytes();
@@ -204,6 +213,14 @@
                       support_usage_threshold), _gen(gen) {
 }
 
+size_t SurvivorContiguousSpacePool::used_in_bytes() {
+  return _gen->from()->used();
+}
+
+size_t SurvivorContiguousSpacePool::committed_in_bytes() {
+  return _gen->from()->capacity();
+}
+
 MemoryUsage SurvivorContiguousSpacePool::get_memory_usage() {
   size_t maxSize = (available_for_allocation() ? max_size() : 0);
   size_t used    = used_in_bytes();
@@ -222,6 +239,10 @@
                       support_usage_threshold), _space(space) {
 }
 
+size_t CompactibleFreeListSpacePool::used_in_bytes() {
+  return _space->used();
+}
+
 MemoryUsage CompactibleFreeListSpacePool::get_memory_usage() {
   size_t maxSize   = (available_for_allocation() ? max_size() : 0);
   size_t used      = used_in_bytes();
@@ -239,6 +260,10 @@
                       support_usage_threshold), _gen(gen) {
 }
 
+size_t GenerationPool::used_in_bytes() {
+  return _gen->used();
+}
+
 MemoryUsage GenerationPool::get_memory_usage() {
   size_t used      = used_in_bytes();
   size_t committed = _gen->capacity();
--- a/hotspot/src/share/vm/services/memoryPool.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryPool.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -25,15 +25,9 @@
 #ifndef SHARE_VM_SERVICES_MEMORYPOOL_HPP
 #define SHARE_VM_SERVICES_MEMORYPOOL_HPP
 
-#include "gc_implementation/shared/mutableSpace.hpp"
-#include "memory/defNewGeneration.hpp"
 #include "memory/heap.hpp"
-#include "memory/space.hpp"
 #include "services/memoryUsage.hpp"
 #include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
-#endif // INCLUDE_ALL_GCS
 
 // A memory pool represents the memory area that the VM manages.
 // The Java virtual machine has at least one memory pool
@@ -43,6 +37,8 @@
 // both heap and non-heap memory.
 
 // Forward declaration
+class CompactibleFreeListSpace;
+class ContiguousSpace;
 class MemoryManager;
 class SensorInfo;
 class Generation;
@@ -162,7 +158,7 @@
 
   ContiguousSpace* space()              { return _space; }
   MemoryUsage get_memory_usage();
-  size_t used_in_bytes()                { return space()->used(); }
+  size_t used_in_bytes();
 };
 
 class SurvivorContiguousSpacePool : public CollectedMemoryPool {
@@ -178,12 +174,8 @@
 
   MemoryUsage get_memory_usage();
 
-  size_t used_in_bytes() {
-    return _gen->from()->used();
-  }
-  size_t committed_in_bytes() {
-    return _gen->from()->capacity();
-  }
+  size_t used_in_bytes();
+  size_t committed_in_bytes();
 };
 
 #if INCLUDE_ALL_GCS
@@ -198,7 +190,7 @@
                                bool support_usage_threshold);
 
   MemoryUsage get_memory_usage();
-  size_t used_in_bytes()            { return _space->used(); }
+  size_t used_in_bytes();
 };
 #endif // INCLUDE_ALL_GCS
 
@@ -210,7 +202,7 @@
   GenerationPool(Generation* gen, const char* name, PoolType type, bool support_usage_threshold);
 
   MemoryUsage get_memory_usage();
-  size_t used_in_bytes()                { return _gen->used(); }
+  size_t used_in_bytes();
 };
 
 class CodeHeapPool: public MemoryPool {
--- a/hotspot/src/share/vm/services/memoryService.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryService.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -160,8 +160,8 @@
   _managers_list->append(_minor_gc_manager);
   _managers_list->append(_major_gc_manager);
 
-  add_generation_memory_pool(heap->get_gen(minor), _major_gc_manager, _minor_gc_manager);
-  add_generation_memory_pool(heap->get_gen(major), _major_gc_manager);
+  add_generation_memory_pool(heap->young_gen(), _major_gc_manager, _minor_gc_manager);
+  add_generation_memory_pool(heap->old_gen(), _major_gc_manager);
 }
 
 #if INCLUDE_ALL_GCS
--- a/hotspot/src/share/vm/services/memoryService.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/services/memoryService.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,13 +57,6 @@
     init_code_heap_pools_size = 9
   };
 
-  // index for minor and major generations
-  enum {
-    minor = 0,
-    major = 1,
-    n_gens = 2
-  };
-
   static GrowableArray<MemoryPool*>*    _pools_list;
   static GrowableArray<MemoryManager*>* _managers_list;
 
--- a/hotspot/src/share/vm/utilities/debug.cpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/utilities/debug.cpp	Wed Jul 05 20:27:20 2017 +0200
@@ -273,7 +273,7 @@
 }
 
 void report_insufficient_metaspace(size_t required_size) {
-  warning("\nThe MaxMetaspaceSize of " UINTX_FORMAT " bytes is not large enough.\n"
+  warning("\nThe MaxMetaspaceSize of " SIZE_FORMAT " bytes is not large enough.\n"
           "Either don't specify the -XX:MaxMetaspaceSize=<size>\n"
           "or increase the size to at least " SIZE_FORMAT ".\n",
           MaxMetaspaceSize, required_size);
--- a/hotspot/src/share/vm/utilities/debug.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/utilities/debug.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -222,9 +222,8 @@
 template<bool x> struct STATIC_ASSERT_FAILURE;
 template<> struct STATIC_ASSERT_FAILURE<true> { enum { value = 1 }; };
 
-#define STATIC_ASSERT(Cond)                             \
-  typedef char STATIC_ASSERT_FAILURE_ ## __LINE__ [     \
-    STATIC_ASSERT_FAILURE< (Cond) >::value ]
+#define STATIC_ASSERT(Cond) \
+  typedef char STATIC_ASSERT_DUMMY_TYPE[ STATIC_ASSERT_FAILURE< (Cond) >::value ]
 
 // out of shared space reporting
 enum SharedSpaceType {
--- a/hotspot/src/share/vm/utilities/ostream.hpp	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/src/share/vm/utilities/ostream.hpp	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -250,7 +250,7 @@
   /* If "force" sets true, force log file rotation from outside JVM */
   bool should_rotate(bool force) {
     return force ||
-             ((GCLogFileSize != 0) && ((uintx)_bytes_written >= GCLogFileSize));
+             ((GCLogFileSize != 0) && (_bytes_written >= (jlong)GCLogFileSize));
   }
 };
 
--- a/hotspot/test/TEST.ROOT	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/TEST.ROOT	Wed Jul 05 20:27:20 2017 +0200
@@ -32,5 +32,5 @@
 groups=TEST.groups [closed/TEST.groups]
 requires.properties=sun.arch.data.model
 
-# Tests using jtreg 4.1 b10 features
-requiredVersion=4.1 b10
+# Tests using jtreg 4.1 b11 features
+requiredVersion=4.1 b11
--- a/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arguments/CheckCompileThresholdScaling.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8059604
  * @summary "Add CompileThresholdScaling flag to control when methods are first compiled (with +/-TieredCompilation)"
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main CheckCompileThresholdScaling
  */
 
--- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnSupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify processing of UseBMI1Instructions option on CPU with
  *          BMI1 feature support.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseBMI1InstructionsOnSupportedCPU
  *        BMISupportedCPUTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arguments/TestUseBMI1InstructionsOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify processing of UseBMI1Instructions option on CPU without
  *          BMI1 feature support.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseBMI1InstructionsOnUnsupportedCPU
  *        BMIUnsupportedCPUTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnSupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify processing of UseCountLeadingZerosInstruction option
  *          on CPU with LZCNT support.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseCountLeadingZerosInstructionOnSupportedCPU
  *        BMISupportedCPUTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arguments/TestUseCountLeadingZerosInstructionOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify processing of UseCountLeadingZerosInstruction option
  *          on CPU without LZCNT support.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseCountLeadingZerosInstructionOnUnsupportedCPU
  *        BMIUnsupportedCPUTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnSupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify processing of UseCountTrailingZerosInstruction option
  *          on CPU with TZCNT (BMI1 feature) support.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseCountTrailingZerosInstructionOnSupportedCPU
  *        BMISupportedCPUTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arguments/TestUseCountTrailingZerosInstructionOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify processing of UseCountTrailingZerosInstruction option
  *          on CPU without TZCNT instruction (BMI1 feature) support.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseCountTrailingZerosInstructionOnUnsupportedCPU
  *        BMIUnsupportedCPUTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInitDeopt.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @bug 8072016
  * @summary Infinite deoptimization/recompilation cycles in case of arraycopy with tightly coupled allocation
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestArrayCopyNoInitDeopt
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform
--- a/hotspot/test/compiler/c1/6932496/Test6932496.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c1/6932496/Test6932496.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @test
  * @bug 6932496
  * @summary incorrect deopt of jsr subroutine on 64 bit c1
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @run main/othervm -Xcomp -XX:CompileOnly=Test.test Test6932496
  */
 import java.lang.reflect.Method;
--- a/hotspot/test/compiler/c2/6589834/Test_ia32.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/6589834/Test_ia32.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,10 @@
  * @summary Safepoint placed between stack pointer increment and decrement leads
  *          to interpreter's stack corruption after deoptimization.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build ClassFileInstaller sun.hotspot.WhiteBox com.oracle.java.testlibrary.*
  *        Test_ia32 InlinedArrayCloneTestCase
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/c2/6852078/Test6852078.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/6852078/Test6852078.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 6852078
  * @summary Disable SuperWord optimization for unsafe read/write
  *
+ * @modules java.corba/com.sun.corba.se.impl.encoding
+ *          java.corba/com.sun.jndi.toolkit.corba
  * @run main Test6852078
  */
 
--- a/hotspot/test/compiler/c2/6857159/Test6857159.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/6857159/Test6857159.java	Wed Jul 05 20:27:20 2017 +0200
@@ -27,6 +27,8 @@
  * @bug 6857159
  * @summary local schedule failed with checkcast of Thread.currentThread()
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/compiler/c2/6968348/Test6968348.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/6968348/Test6968348.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @bug 6968348
  * @summary Byteswapped memory access can point to wrong location after JIT
  *
+ * @modules java.base/sun.misc
  * @run main Test6968348
  */
 
--- a/hotspot/test/compiler/c2/7047069/Test7047069.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/7047069/Test7047069.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @bug 7047069
  * @summary Array can dynamically change size when assigned to an object field
  *
+ * @modules java.desktop
  * @run main/othervm -Xbatch Test7047069
  */
 
--- a/hotspot/test/compiler/c2/7068051/Test7068051.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/7068051/Test7068051.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440
  * @library /testlibrary
  *
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -showversion -Xbatch Test7068051
  */
 
--- a/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @test
  * @bug 7190310
  * @summary Inlining WeakReference.get(), and hoisting $referent may lead to non-terminating loops
+ * @modules java.base/sun.misc
  * @run main/othervm -Xbatch Test7190310_unsafe
  */
 
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
  *
+ * @modules java.base/sun.misc
  * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeCAS
  * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeCAS
  */
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
  *
+ * @modules java.base/sun.misc
  * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeOrdered
  * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeOrdered
  */
--- a/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @bug 8004867
  * @summary VM crashing with assert "share/vm/opto/node.hpp:357 - assert(i < _max) failed: oob"
  *
+ * @modules java.base/sun.misc
  * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:-OptimizeFill TestIntUnsafeVolatile
  * @run main/othervm/timeout=300 -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation -XX:+OptimizeFill TestIntUnsafeVolatile
  */
--- a/hotspot/test/compiler/c2/8005956/PolynomialRoot.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/c2/8005956/PolynomialRoot.java	Wed Jul 05 20:27:20 2017 +0200
@@ -14,6 +14,8 @@
 * @bug 8005956
 * @summary C2: assert(!def_outside->member(r)) failed: Use of external LRG overlaps the same LRG defined in this block
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 * @run main/timeout=300 PolynomialRoot
 */
 
--- a/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
  * @bug 8054402
  * @summary "Tests unloading of anonymous classes."
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
  * @compile TestAnonymousClassUnloading.java
  * @run main ClassFileInstaller TestAnonymousClassUnloading
  *                              sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/CheckReservedInitialCodeCacheSizeArgOrder.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  *          InitialCodeCacheSize are passed to the VM is irrelevant.
  * @library /testlibrary
  *
+ * @modules java.base/sun.misc
+ *          java.management
  */
 import com.oracle.java.testlibrary.*;
 
--- a/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/CheckSegmentedCodeCache.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
  * @bug 8015774
  * @library /testlibrary /../../test/lib
  * @summary "Checks VM options related to the segmented code cache"
+ * @modules java.base/sun.misc
+ *          java.management
  * @build CheckSegmentedCodeCache
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/CheckUpperLimit.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/CheckUpperLimit.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Test ensures that the ReservedCodeCacheSize is at most MAXINT
  * @library /testlibrary
  *
+ * @modules java.base/sun.misc
+ *          java.management
  */
 import com.oracle.java.testlibrary.*;
 
--- a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
  * @test OverflowCodeCacheTest
  * @bug 8059550
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build OverflowCodeCacheTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/cli/TestSegmentedCodeCacheOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,10 @@
  * @bug 8015774
  * @summary Verify SegmentedCodeCache option's processing
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build TestSegmentedCodeCacheOption com.oracle.java.testlibrary.*
  * @run main TestSegmentedCodeCacheOption
  */
--- a/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/cli/codeheapsize/TestCodeHeapSizeOptions.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,10 @@
  * @bug 8015774
  * @summary Verify processing of options related to code heaps sizing.
  * @library /testlibrary .. /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build TestCodeHeapSizeOptions com.oracle.java.testlibrary.* codeheapsize.*
  *        common.*
  * @run main/timeout=240 codeheapsize.TestCodeHeapSizeOptions
--- a/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/cli/printcodecache/TestPrintCodeCacheOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,10 @@
  * @bug 8015774
  * @summary Verify that PrintCodeCache option print correct information.
  * @library /testlibrary .. /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build TestPrintCodeCacheOption com.oracle.java.testlibrary.*
  *        printcodecache.* common.*
  * @run main/timeout=240 printcodecache.TestPrintCodeCacheOption
--- a/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/BeanTypeTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 /**
  * @test BeanTypeTest
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build BeanTypeTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/CodeHeapBeanPresenceTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 /**
  * @test CodeHeapBeanPresenceTest
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build CodeHeapBeanPresenceTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/GetUsageTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/GetUsageTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
 /*
  * @test GetUsageTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build GetUsageTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/InitialAndMaxUsageTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
 /*
  * @test InitialAndMaxUsageTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build InitialAndMaxUsageTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/ManagerNamesTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 /**
  * @test ManagerNamesTest
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build ManagerNamesTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/MemoryPoolsPresenceTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
 /**
  * @test MemoryPoolsPresenceTest
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build MemoryPoolsPresenceTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/PeakUsageTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 /*
  * @test PeakUsageTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build PeakUsageTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/ThresholdNotificationsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,8 @@
 /*
  * @test ThresholdNotificationsTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build ThresholdNotificationsTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededSeveralTimesTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /*
  * @test UsageThresholdExceededSeveralTimesTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build UsageThresholdExceededTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdExceededTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 /*
  * @test UsageThresholdExceededTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build UsageThresholdExceededTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdIncreasedTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 /*
  * @test UsageThresholdIncreasedTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build UsageThresholdIncreasedTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/jmx/UsageThresholdNotExceededTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
 /*
  * @test UsageThresholdNotExceededTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build UsageThresholdNotExceededTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *     sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/stress/OverloadCompileQueueTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
 /*
  * @test OverloadCompileQueueTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @ignore 8071905
  * @build OverloadCompileQueueTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/stress/RandomAllocationTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 /*
  * @test RandomAllocationTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build RandomAllocationTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codecache/stress/UnexpectedDeoptimizationTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 /*
  * @test UnexpectedDeoptimizationTest
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build UnexpectedDeoptimizationTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/codegen/6896617/Test6896617.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codegen/6896617/Test6896617.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
  * @bug 6896617
  * @summary Optimize sun.nio.cs.ISO_8859_1$Encode.encodeArrayLoop() with SSE instructions on x86
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.base/sun.nio.cs
+ *          java.management
  * @run main/othervm/timeout=1200 -Xbatch -Xmx256m Test6896617
  *
  */
--- a/hotspot/test/compiler/codegen/7100757/Test7100757.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codegen/7100757/Test7100757.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 7100757
  * @summary The BitSet.nextSetBit() produces incorrect result in 32bit VM on Sparc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/timeout=300 Test7100757
  */
 
--- a/hotspot/test/compiler/codegen/7184394/TestAESMain.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codegen/7184394/TestAESMain.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary add intrinsics to use AES instructions
  * @library /testlibrary
  *
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC TestAESMain
  * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencInputOffset=1 TestAESMain
  * @run main/othervm/timeout=600 -Xbatch -DcheckOutput=true -Dmode=CBC -DencOutputOffset=1 TestAESMain
--- a/hotspot/test/compiler/codegen/8011901/Test8011901.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/codegen/8011901/Test8011901.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 8011901
  * @summary instruct xaddL_no_res shouldn't allow 64 bit constants.
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:-BackgroundCompilation Test8011901
  *
  */
--- a/hotspot/test/compiler/cpuflags/RestoreMXCSR.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/cpuflags/RestoreMXCSR.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
  * @bug 8020433
  * @summary Crash when using -XX:+RestoreMXCSROnJNICalls
  * @library /testlibrary
- *
+ * @modules java.base/sun.misc
+ *          java.management
  */
 import com.oracle.java.testlibrary.*;
 
--- a/hotspot/test/compiler/debug/VerifyAdapterSharing.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/debug/VerifyAdapterSharing.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
  * @bug 8030783
  * @summary Regression test for 8026478
  * @library /testlibrary
- *
+ * @modules java.base/sun.misc
+ *          java.management
  */
 import com.oracle.java.testlibrary.*;
 
--- a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
  * @bug 8050079
  * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java
  * @run main TestMonomorphicObjectCall
  */
--- a/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,7 @@
  * @test
  * @bug 8038048
  * @summary assert(null_obj->escape_state() == PointsToNode::NoEscape,etc)
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+DoEscapeAnalysis -XX:-TieredCompilation -Xbatch TestUnsafePutAddressNullObjMustNotEscape
  * @author Richard Reingruber richard DOT reingruber AT sap DOT com
  */
--- a/hotspot/test/compiler/floatingpoint/TestPow2.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/floatingpoint/TestPow2.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 8063086
  * @summary X^2 special case for C2 yields different result than interpreter
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @modules java.management
  * @build TestPow2
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
--- a/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of ANDN instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestAndnI BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestAndnL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of ANDN instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestAndnL BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSI instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestBlsiI BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsiL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSI instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestBlsiL BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSMSK instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestBlsmskI BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsmskL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSMSK instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestBlsmskL BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSR instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestBlsrI BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestBlsrL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of BLSR instruction
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestBlsrL BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestLzcntI BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestLzcntL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestLzcntL BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestTzcntI BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/TestTzcntL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that results of computations are the same w/
  *          and w/o usage of intrinsic
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestTzcntL BMITestRunner Expr
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AddnTestI
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/AddnTestL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AddnTestL
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build BlsiTestI
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsiTestL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build BlsiTestL
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build BlsmskTestI
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsmskTestL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build BlsmskTestL
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build BlsrTestI
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/BlsrTestL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build BlsrTestL
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build LZcntTestI
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/LZcntTestL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build LZcntTestL
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TZcntTestI
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/bmi/verifycode/TZcntTestL.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8031321
  * @library /testlibrary /../../test/lib /compiler/whitebox ..
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TZcntTestL
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/classcast/NullCheckDroppingsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8054492
  * @summary "Casting can result in redundant null checks in generated code"
  * @library /testlibrary /../../test/lib /testlibrary/com/oracle/java/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build NullCheckDroppingsTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8024924
  * @summary Test constant addExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile AddExactIConstantTest.java Verify.java
  * @run main AddExactIConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoadTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8024924
  * @summary Test non constant addExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile AddExactILoadTest.java Verify.java
  * @run main AddExactILoadTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactILoopDependentTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8024924
  * @summary Test non constant addExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile AddExactILoopDependentTest.java Verify.java
  * @run main AddExactILoopDependentTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactINonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8024924
  * @summary Test non constant addExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile AddExactINonConstantTest.java Verify.java
  * @run main AddExactINonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactIRepeatTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8025657
  * @summary Test repeating addExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile AddExactIRepeatTest.java Verify.java
  * @run main AddExactIRepeatTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test constant addExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile AddExactLConstantTest.java Verify.java
  * @run main AddExactLConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/AddExactLNonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test non constant addExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile AddExactLNonConstantTest.java Verify.java
  * @run main AddExactLNonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactITest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test decrementExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile DecExactITest.java Verify.java
  * @run main DecExactITest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/DecExactLTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test decrementExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile DecExactLTest.java Verify.java
  * @run main DecExactLTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactITest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test incrementExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile IncExactITest.java Verify.java
  * @run main IncExactITest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/IncExactLTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test incrementExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile IncExactLTest.java Verify.java
  * @run main IncExactLTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test constant multiplyExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile MulExactIConstantTest.java Verify.java
  * @run main MulExactIConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoadTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test multiplyExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile MulExactILoadTest.java Verify.java
  * @run main MulExactILoadTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactILoopDependentTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test loop dependent multiplyExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile MulExactILoopDependentTest.java Verify.java
  * @run main MulExactILoopDependentTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactINonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test non constant multiplyExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile MulExactINonConstantTest.java Verify.java
  * @run main MulExactINonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactIRepeatTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test repeating multiplyExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile MulExactIRepeatTest.java Verify.java
  * @run main MulExactIRepeatTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test constant mulExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile MulExactLConstantTest.java Verify.java
  * @run main MulExactLConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/MulExactLNonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test non constant mulExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile MulExactLNonConstantTest.java Verify.java
  * @run main MulExactLNonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactIConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test constant negExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile NegExactIConstantTest.java Verify.java
  * @run main NegExactIConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoadTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test negExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile NegExactILoadTest.java Verify.java
  * @run main NegExactILoadTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactILoopDependentTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test negExact loop dependent
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile NegExactILoopDependentTest.java Verify.java
  * @run main NegExactILoopDependentTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactINonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test non constant negExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile NegExactINonConstantTest.java Verify.java
  * @run main NegExactINonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test constant negExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile NegExactLConstantTest.java Verify.java
  * @run main NegExactLConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/NegExactLNonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test constant negExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile NegExactLNonConstantTest.java Verify.java
  * @run main NegExactLNonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactICondTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test subtractExact as condition
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactICondTest.java Verify.java
  * @run main SubExactICondTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test constant subtractExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactIConstantTest.java Verify.java
  * @run main SubExactIConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoadTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test non constant subtractExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactILoadTest.java Verify.java
  * @run main SubExactILoadTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactILoopDependentTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test non constant subtractExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactILoopDependentTest.java Verify.java
  * @run main SubExactILoopDependentTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactINonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test non constant subtractExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactINonConstantTest.java Verify.java
  * @run main SubExactINonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactIRepeatTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026844
  * @summary Test repeating subtractExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactIRepeatTest.java Verify.java
  * @run main SubExactIRepeatTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8027353
  * @summary Test constant subtractExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactLConstantTest.java Verify.java
  * @run main SubExactLConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/SubExactLNonConstantTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8027353
  * @summary Test non constant subtractExact
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile SubExactLNonConstantTest.java Verify.java
  * @run main SubExactLNonConstantTest
  *
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactIntTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AddExactIntTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/AddExactLongTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AddExactLongTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactIntTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build DecrementExactIntTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/DecrementExactLongTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build DecrementExactLongTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactIntTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build IncrementExactIntTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/IncrementExactLongTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build IncrementExactLongTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactIntTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build MultiplyExactIntTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/MultiplyExactLongTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build MultiplyExactLongTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactIntTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build NegateExactIntTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/NegateExactLongTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build NegateExactLongTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactIntTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build SubtractExactIntTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/mathexact/sanity/SubtractExactLongTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @library /testlibrary /../../test/lib /compiler/whitebox
  *          /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build SubtractExactLongTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnSupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA1Intrinsics option processing on supported CPU,
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHA1IntrinsicsOptionOnSupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA1IntrinsicsOptionOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA1Intrinsics option processing on unsupported CPU,
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHA1IntrinsicsOptionOnUnsupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnSupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA256Intrinsics option processing on supported CPU,
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHA256IntrinsicsOptionOnSupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA256IntrinsicsOptionOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA256Intrinsics option processing on unsupported CPU,
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHA256IntrinsicsOptionOnUnsupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnSupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA512Intrinsics option processing on supported CPU.
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHA512IntrinsicsOptionOnSupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHA512IntrinsicsOptionOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA512Intrinsics option processing on unsupported CPU,
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHA512IntrinsicsOptionOnUnsupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnSupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA option processing on supported CPU,
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHAOptionOnSupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/cli/TestUseSHAOptionOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify UseSHA option processing on unsupported CPU.
  * @library /testlibrary /../../test/lib /compiler/testlibrary testcases
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseSHAOptionOnUnsupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1Intrinsics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8035968
  * @summary Verify that SHA-1 intrinsic is actually used.
  * @library /testlibrary /../../test/lib /compiler/testlibrary ../
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestSHA intrinsics.Verifier TestSHA1Intrinsics
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA1MultiBlockIntrinsics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8035968
  * @summary Verify that SHA-1 multi block intrinsic is actually used.
  * @library /testlibrary /../../test/lib /compiler/testlibrary ../
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestSHA intrinsics.Verifier TestSHA1MultiBlockIntrinsics
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256Intrinsics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8035968
  * @summary Verify that SHA-256 intrinsic is actually used.
  * @library /testlibrary /../../test/lib /compiler/testlibrary ../
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestSHA intrinsics.Verifier TestSHA256Intrinsics
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA256MultiBlockIntrinsics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8035968
  * @summary Verify that SHA-256 multi block intrinsic is actually used.
  * @library /testlibrary /../../test/lib /compiler/testlibrary ../
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestSHA intrinsics.Verifier TestSHA256MultiBlockIntrinsics
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512Intrinsics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8035968
  * @summary Verify that SHA-512 intrinsic is actually used.
  * @library /testlibrary /../../test/lib /compiler/testlibrary ../
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestSHA intrinsics.Verifier TestSHA512Intrinsics
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/sha/sanity/TestSHA512MultiBlockIntrinsics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8035968
  * @summary Verify that SHA-512 multi block intrinsic is actually used.
  * @library /testlibrary /../../test/lib /compiler/testlibrary ../
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestSHA intrinsics.Verifier TestSHA512MultiBlockIntrinsics
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/intrinsics/unsafe/UnsafeGetAddressTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 6653795
  * @summary C2 intrinsic for Unsafe.getAddress performs pointer sign extension on 32-bit systems
+ * @modules java.base/sun.misc
  * @run main UnsafeGetAddressTest
  *
  */
--- a/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/jsr292/ConcurrentClassLoadingTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8022595
  * @summary JSR292: deadlock during class loading of MethodHandles, MethodHandleImpl & MethodHandleNatives
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm ConcurrentClassLoadingTest
  */
 import com.oracle.java.testlibrary.Utils;
--- a/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @test
  * @bug 8026124
  * @summary Javascript file provoked assertion failure in linkResolver.cpp
- *
+ * @modules jdk.scripting.nashorn/jdk.nashorn.tools
  * @run main/othervm CreatesInterfaceDotEqualsCallInfo
  */
 
--- a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
  * @test
  * @bug 8042235
  * @summary redefining method used by multiple MethodHandles crashes VM
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.compiler
+ *          java.instrument
+ *          java.management
  * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
  * @run main RedefineMethodUsedByMultipleMethodHandles
  */
--- a/hotspot/test/compiler/jsr292/VMAnonymousClasses.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/jsr292/VMAnonymousClasses.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /**
  * @test
  * @bug 8058828
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
  * @run main/bootclasspath -Xbatch VMAnonymousClasses
  */
 
--- a/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/jsr292/methodHandleExceptions/TestAMEnotNPE.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
  * @test @bug 8025260 8016839
  * @summary Ensure that AbstractMethodError and IllegalAccessError are thrown appropriately, not NullPointerException
  *
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @compile -XDignore.symbol.file TestAMEnotNPE.java ByteClassLoader.java p/C.java p/Dok.java p/E.java p/F.java p/I.java p/Tdirect.java p/Treflect.java
  *
  * @run main/othervm TestAMEnotNPE
--- a/hotspot/test/compiler/oracle/CheckCompileCommandOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/oracle/CheckCompileCommandOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
  * @bug 8055286 8056964 8059847 8069035
  * @summary "Checks parsing of -XX:CompileCommand=option"
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main CheckCompileCommandOption
  */
 
--- a/hotspot/test/compiler/oracle/TestCompileCommand.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/oracle/TestCompileCommand.java	Wed Jul 05 20:27:20 2017 +0200
@@ -31,6 +31,8 @@
  * @bug 8069389
  * @summary "Regression tests of -XX:CompileCommand"
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main TestCompileCommand
  */
 
--- a/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/osr/TestOSRWithNonEmptyStack.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,7 @@
  * @test
  * @bug 8051344
  * @summary Force OSR compilation with non-empty stack at the OSR entry point.
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @compile -XDignore.symbol.file TestOSRWithNonEmptyStack.java
  * @run main/othervm -XX:CompileOnly=TestCase.test TestOSRWithNonEmptyStack
  */
--- a/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass/Launcher.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,9 @@
  * @test
  * @bug 8038636
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.instrument
+ *          java.management
  * @build Agent
  * @run main ClassFileInstaller Agent
  * @run main Launcher
--- a/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/profiling/spectrapredefineclass_classloaders/Launcher.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,9 @@
  * @test
  * @bug 8040237
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.instrument
+ *          java.management
  * @build Agent Test A B
  * @run main ClassFileInstaller Agent
  * @run main Launcher
--- a/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rangechecks/TestRangeCheckSmearing.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8066103
  * @summary C2's range check smearing allows out of bound array accesses
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRangeCheckSmearing
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify PrintPreciseRTMLockingStatistics on CPUs with
  *          rtm support and on VM with rtm locking support,
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPrintPreciseRTMLockingStatisticsOptionOnSupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify PrintPreciseRTMLockingStatistics on CPUs without
  *          rtm support and/or unsupported VM.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPrintPreciseRTMLockingStatisticsOptionOnUnsupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnSupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify RTMAbortRatio option processing on CPU with rtm
  *          support and on VM with rtm locking support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMAbortRatioOptionOnSupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortRatioOptionOnUnsupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify RTMAbortRatio option processing on CPU without rtm
  *          support or on VM that does not support rtm locking.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMAbortRatioOptionOnUnsupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMAbortThresholdOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify processing of RTMAbortThreshold option.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMAbortThresholdOption
  * @run main/othervm TestRTMAbortThresholdOption
  */
--- a/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingCalculationDelayOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify processing of RTMLockingCalculationDelay option.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMLockingCalculationDelayOption
  * @run main/othervm TestRTMLockingCalculationDelayOption
  */
--- a/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMLockingThresholdOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify processing of RTMLockingThreshold option.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMLockingThresholdOption
  * @run main/othervm TestRTMLockingThresholdOption
  */
--- a/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMRetryCountOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify processing of RTMRetryCount option.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMRetryCountOption
  * @run main/othervm TestRTMRetryCountOption
  */
--- a/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMSpinLoopCountOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify processing of RTMSpinLoopCount option.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMSpinLoopCountOption
  * @run main/othervm TestRTMSpinLoopCountOption
  */
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnSupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify RTMTotalCountIncrRate option processing on CPU with
  *          rtm support and on VM with rtm locking support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMTotalCountIncrRateOptionOnSupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestRTMTotalCountIncrRateOptionOnUnsupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,8 @@
  * @summary Verify RTMTotalCountIncrRate option processing on CPU without
  *          rtm support and/or on VM without rtm locking support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMTotalCountIncrRateOptionOnUnsupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnSupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify UseRTMDeopt option processing on CPUs with rtm support
  *          when rtm locking is supported by VM.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMDeoptOptionOnSupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMDeoptOptionOnUnsupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify UseRTMDeopt option processing on CPUs without rtm support
  *          or on VMs without rtm locking support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMDeoptOptionOnUnsupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnSupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify UseRTMForStackLocks option processing on CPU with
  *          rtm support when VM supports rtm locking.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMForStackLocksOptionOnSupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMForStackLocksOptionOnUnsupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify UseRTMForStackLocks option processing on CPUs without
  *          rtm support and/or on VMs without rtm locking support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMForStackLocksOptionOnUnsupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnSupportedConfig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify UseRTMLocking option processing on CPU with rtm support and
  *          on VM with rtm-locking support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMLockingOptionOnSupportedConfig
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedCPU.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify UseRTMLocking option processing on CPU without
  *          rtm support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMLockingOptionOnUnsupportedCPU
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionOnUnsupportedVM.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify UseRTMLocking option processing on CPU with rtm support
  *          in case when VM should not support this option.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMLockingOptionOnUnsupportedVM
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMLockingOptionWithBiasedLocking.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify processing of UseRTMLocking and UseBiasedLocking
  *          options combination on CPU and VM with rtm support.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMLockingOptionWithBiasedLocking
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/cli/TestUseRTMXendForLockBusyOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify processing of UseRTMXendForLockBusy option.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMXendForLockBusyOption
  * @run main/othervm TestUseRTMXendForLockBusyOption
  */
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortRatio.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that RTMAbortRatio affects amount of aborts before
  *          deoptimization.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMAbortRatio
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAbortThreshold.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that RTMAbortThreshold option affects
  *          amount of aborts after which abort ratio is calculated.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMAbortThreshold
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMAfterNonRTMDeopt.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
  *          method's RTM state. And if we don't use RTMDeopt, then
  *          RTM state remain the same after such deoptimization.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMAfterNonRTMDeopt
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnHighAbortRatio.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that on high abort ratio method will be recompiled
  *          without rtm locking.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMDeoptOnHighAbortRatio
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMDeoptOnLowAbortRatio.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify that on low abort ratio method will be recompiled.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMDeoptOnLowAbortRatio
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingCalculationDelay.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that RTMLockingCalculationDelay affect when
  *          abort ratio calculation is started.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMLockingCalculationDelay
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMLockingThreshold.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that RTMLockingThreshold affects rtm state transition
  *          ProfileRTM => UseRTM.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMLockingThreshold
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMRetryCount.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify that RTMRetryCount affects actual amount of retries.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMRetryCount
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMSpinLoopCount.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that RTMSpinLoopCount affects time spent
  *          between locking attempts.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMSpinLoopCount
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestRTMTotalCountIncrRate.java	Wed Jul 05 20:27:20 2017 +0200
@@ -28,6 +28,8 @@
  * @summary Verify that RTMTotalCountIncrRate option affects
  *          RTM locking statistics.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestRTMTotalCountIncrRate
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMAfterLockInflation.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that rtm locking is used for stack locks before
  *          inflation and after it used for inflated locks.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMAfterLockInflation
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMDeopt.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that UseRTMDeopt affects uncommon trap installation in
  *          copmpiled methods with synchronized block.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMDeopt
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForInflatedLocks.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify that rtm locking is used for inflated locks.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMForInflatedLocks
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMForStackLocks.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8031320
  * @summary Verify that rtm locking is used for stack locks.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMForStackLocks
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/locking/TestUseRTMXendForLockBusy.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that UseRTMXendForLockBusy option affects
  *          method behaviour if lock is busy.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMXendForLockBusy
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/method_options/TestNoRTMLockElidingOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Verify that NoRTMLockEliding option could be applied to
  *          specified method and that such method will not use rtm.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestNoRTMLockElidingOption
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/method_options/TestUseRTMLockElidingOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
  *          specified method and that such method will not be deoptimized
  *          on high abort ratio.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestUseRTMLockElidingOption
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/rtm/print/TestPrintPreciseRTMLockingStatistics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
  *          different types. Test also verify that VM output does not
  *          contain rtm locking statistics when it should not.
  * @library /testlibrary /../../test/lib /compiler/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPrintPreciseRTMLockingStatistics
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/runtime/8010927/Test8010927.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/runtime/8010927/Test8010927.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 8010927
  * @summary Kitchensink crashed with SIGSEGV, Problematic frame: v ~StubRoutines::checkcast_arraycopy
  * @library /../../test/lib /testlibrary
+ * @modules java.base/sun.misc
  * @build Test8010927
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/startup/NumCompilerThreadsCheck.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8034775
  * @summary Ensures correct minimal number of compiler threads (provided by -XX:CICompilerCount=)
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 import com.oracle.java.testlibrary.*;
 
--- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  *          to initialize all compiler threads. The option -Xcomp gives the VM more time to
  *          trigger the old bug.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 import com.oracle.java.testlibrary.*;
 import static com.oracle.java.testlibrary.Asserts.assertTrue;
--- a/hotspot/test/compiler/startup/StartupOutput.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/startup/StartupOutput.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8026949
  * @summary Test ensures correct VM output during startup
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 import com.oracle.java.testlibrary.*;
 
--- a/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/tiered/ConstantGettersTransitionsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 /**
  * @test ConstantGettersTransitionsTest
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TransitionsTestExecutor ConstantGettersTransitionsTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm/timeout=240 -Xmixed -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
--- a/hotspot/test/compiler/tiered/LevelTransitionTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/tiered/LevelTransitionTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
 /**
  * @test LevelTransitionTest
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @modules java.base/sun.misc
+ *          java.management
  * @ignore 8067651
  * @build TransitionsTestExecutor LevelTransitionTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/tiered/NonTieredLevelsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 /**
  * @test NonTieredLevelsTest
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @modules java.management
  * @build NonTieredLevelsTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/tiered/TieredLevelsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/tiered/TieredLevelsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /**
  * @test TieredLevelsTest
  * @library /testlibrary /../../test/lib /compiler/whitebox
+ * @modules java.management
  * @build TieredLevelsTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test CorrectnessTest
  * @bug 8038418
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @ignore 8066173
  * @compile execution/TypeConflict.java execution/TypeProfile.java
  *          execution/MethodHandleDelegate.java
--- a/hotspot/test/compiler/types/correctness/OffTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/types/correctness/OffTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test CorrectnessTest
  * @bug 8038418
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @ignore 8066173
  * @compile execution/TypeConflict.java execution/TypeProfile.java
  *          execution/MethodHandleDelegate.java
--- a/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/uncommontrap/TestUnstableIfTrap.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,6 +41,11 @@
  * @test
  * @bug 8030976 8059226
  * @library /testlibrary /compiler/testlibrary /../../test/lib
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build TestUnstableIfTrap com.oracle.java.testlibrary.* uncommontrap.Verifier
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/unsafe/GetUnsafeObjectG1PreBarrier.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 8016474
  * @summary The bug only happens with C1 and G1 using a different ObjectAlignmentInBytes than KlassAlignmentInBytes (which is 8)
+ * @modules java.base/sun.misc
  * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32 GetUnsafeObjectG1PreBarrier
  */
 
--- a/hotspot/test/compiler/unsafe/UnsafeRaw.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/unsafe/UnsafeRaw.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8058744
  * @summary Invalid pattern-matching of address computations in raw unsafe
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -Xbatch UnsafeRaw
  */
 
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
  * @test AllocationCodeBlobTest
  * @bug 8059624 8064669
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build AllocationCodeBlobTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/ClearMethodStateTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/ClearMethodStateTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @test ClearMethodStateTest
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build ClearMethodStateTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/DeoptimizeAllTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test DeoptimizeAllTest
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build DeoptimizeAllTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/DeoptimizeFramesTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test DeoptimizeFramesTest
  * @bug 8028595
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build DeoptimizeFramesTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMethodTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test DeoptimizeMethodTest
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build DeoptimizeMethodTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/DeoptimizeMultipleOSRTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,7 @@
  * @test DeoptimizeMultipleOSRTest
  * @bug 8061817
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build DeoptimizeMultipleOSRTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/EnqueueMethodForCompilationTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test EnqueueMethodForCompilationTest
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build EnqueueMethodForCompilationTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,6 +35,7 @@
  * @test
  * @bug 8059624 8064669
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build ForceNMethodSweepTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
  * @test GetCodeHeapEntriesTest
  * @bug 8059624
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build GetCodeHeapEntriesTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
  * @test GetNMethodTest
  * @bug 8038240
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build GetNMethodTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test IsMethodCompilableTest
  * @bug 8007270 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib /testlibrary/com/oracle/java/testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build IsMethodCompilableTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/LockCompilationTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test LockCompilationTest
  * @bug 8059624
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build LockCompilationTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/MakeMethodNotCompilableTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test MakeMethodNotCompilableTest
  * @bug 8012322 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build MakeMethodNotCompilableTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/SetDontInlineMethodTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test SetDontInlineMethodTest
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build SetDontInlineMethodTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/compiler/whitebox/SetForceInlineMethodTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test SetForceInlineMethodTest
  * @bug 8006683 8007288 8022832
  * @library /testlibrary /../../test/lib
+ * @modules java.management
  * @build SetForceInlineMethodTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/6581734/Test6581734.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/6581734/Test6581734.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 6581734
  * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
  * @summary CMS Old Gen's collection usage is zero after GC which is incorrect
+ * @modules java.management
  * @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC Test6581734
  *
  */
--- a/hotspot/test/gc/6941923/Test6941923.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/6941923/Test6941923.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 6941923
  * @summary test flags for gc log rotation
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm/timeout=600 Test6941923
  *
  */
--- a/hotspot/test/gc/7072527/TestFullGCCount.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/7072527/TestFullGCCount.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test TestFullGCount.java
  * @bug 7072527
  * @summary CMS: JMM GC counters overcount in some cases
+ * @modules java.management
  * @run main/othervm -XX:+PrintGC TestFullGCCount
  */
 import java.util.*;
--- a/hotspot/test/gc/TestCardTablePageCommits.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/TestCardTablePageCommits.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
  * @bug 8059066
  * @summary Tests that the card table does not commit the same page twice
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver TestCardTablePageCommits
  */
 public class TestCardTablePageCommits {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/gc/TestDisableExplicitGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test TestDisableExplicitGC
+ * @requires vm.opt.DisableExplicitGC == null
+ * @summary Verify GC behavior with DisableExplicitGC flag.
+ * @library /testlibrary
+ * @run main/othervm                             -XX:+PrintGCDetails TestDisableExplicitGC
+ * @run main/othervm/fail -XX:+DisableExplicitGC -XX:+PrintGCDetails TestDisableExplicitGC
+ * @run main/othervm      -XX:-DisableExplicitGC -XX:+PrintGCDetails TestDisableExplicitGC
+ */
+import java.lang.management.GarbageCollectorMXBean;
+import java.util.List;
+import static com.oracle.java.testlibrary.Asserts.*;
+
+public class TestDisableExplicitGC {
+
+    public static void main(String[] args) throws InterruptedException {
+        List<GarbageCollectorMXBean> list = java.lang.management.ManagementFactory.getGarbageCollectorMXBeans();
+        long collectionCountBefore = getCollectionCount(list);
+        System.gc();
+        long collectionCountAfter = getCollectionCount(list);
+        assertLT(collectionCountBefore, collectionCountAfter);
+    }
+
+    private static long getCollectionCount(List<GarbageCollectorMXBean> list) {
+        int collectionCount = 0;
+        for (GarbageCollectorMXBean gcMXBean : list) {
+            collectionCount += gcMXBean.getCollectionCount();
+        }
+        return collectionCount;
+    }
+}
--- a/hotspot/test/gc/TestGCLogRotationViaJcmd.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/TestGCLogRotationViaJcmd.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 7090324
  * @summary test for gc log rotation via jcmd
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -Xloggc:test.log -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=3 TestGCLogRotationViaJcmd
  *
  */
--- a/hotspot/test/gc/TestObjectAlignment.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/TestObjectAlignment.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8021823
  * @summary G1: Concurrent marking crashes with -XX:ObjectAlignmentInBytes>=32 in 64bit VMs
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=8
  * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16
  * @run main/othervm TestObjectAlignment -Xmx20M -XX:+ExplicitGCInvokesConcurrent -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=32
--- a/hotspot/test/gc/TestSmallHeap.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/TestSmallHeap.java	Wed Jul 05 20:27:20 2017 +0200
@@ -29,6 +29,7 @@
  * @requires vm.compMode != "Xcomp"
  * @summary Verify that starting the VM with a small heap works
  * @library /testlibrary /../../test/lib
+ * @modules java.management/sun.management
  * @build TestSmallHeap
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xmx2m -XX:+UseParallelGC TestSmallHeap
--- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @key gc
  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @ignore 8073669
  * @build TestSoftReferencesBehaviorOnOOME
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
--- a/hotspot/test/gc/TestVerifyDuringStartup.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/TestVerifyDuringStartup.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8010463 8011343 8011898
  * @summary Simple test run with -XX:+VerifyDuringStartup -XX:-UseTLAB to verify 8010463
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.JDKToolFinder;
--- a/hotspot/test/gc/TestVerifySilently.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/TestVerifySilently.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8032771
  * @summary Test silent verification.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestArrayAllocatorMallocLimit.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8054823
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver TestArrayAllocatorMallocLimit
  */
 
--- a/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestCMSHeapSizeFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8006088
  * @summary Tests argument processing for initial and maximum heap size for the CMS collector
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestCMSHeapSizeFlags TestMaxHeapSizeTools
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/arguments/TestCompressedClassFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestCompressedClassFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
  * @summary Tests that VM prints a warning when -XX:CompressedClassSpaceSize
  *          is used together with -XX:-UseCompressedClassPointers
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 public class TestCompressedClassFlags {
     public static void main(String[] args) throws Exception {
--- a/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestDynMaxHeapFreeRatio.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
  * @bug 8028391
  * @summary Verify that MaxHeapFreeRatio flag is manageable
  * @library /testlibrary
+ * @modules java.management
  * @run main TestDynMaxHeapFreeRatio
  * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMaxHeapFreeRatio
  * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:-UseAdaptiveSizePolicy TestDynMaxHeapFreeRatio
--- a/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestDynMinHeapFreeRatio.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug 8028391
  * @summary Verify that MinHeapFreeRatio flag is manageable
  * @library /testlibrary
+ * @modules java.management
  * @run main TestDynMinHeapFreeRatio
  * @run main/othervm -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 TestDynMinHeapFreeRatio
  * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=50 -XX:-UseAdaptiveSizePolicy TestDynMinHeapFreeRatio
--- a/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestG1ConcRefinementThreads.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8047976
  * @summary Tests argument processing for G1ConcRefinementThreads
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @key gc
  * @bug 8021879
  * @summary Verify that the flag G1HeapRegionSize is updated properly
+ * @modules java.management/sun.management
  * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
  * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
  * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
--- a/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestG1HeapSizeFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8006088
  * @summary Tests argument processing for initial and maximum heap size for the G1 collector
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestG1HeapSizeFlags TestMaxHeapSizeTools
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/arguments/TestG1PercentageOptions.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestG1PercentageOptions.java	Wed Jul 05 20:27:20 2017 +0200
@@ -27,6 +27,8 @@
  * @bug 8068942
  * @summary Test argument processing of various percentage options
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver TestG1PercentageOptions
  */
 
--- a/hotspot/test/gc/arguments/TestHeapFreeRatio.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestHeapFreeRatio.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8025661
  * @summary Test parsing of -Xminf and -Xmaxf
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm TestHeapFreeRatio
  */
 
--- a/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestInitialTenuringThreshold.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8014765
  * @summary Tests argument processing for initial tenuring threshold
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm TestInitialTenuringThreshold
  * @author thomas.schatzl@oracle.com
  */
@@ -72,4 +74,4 @@
     runWithThresholds(16, 8, true);
     runWithThresholds(8, 17, true);
   }
-}
\ No newline at end of file
+}
--- a/hotspot/test/gc/arguments/TestMaxNewSize.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestMaxNewSize.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Make sure that MaxNewSize always has a useful value after argument
  * processing.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestMaxNewSize
  * @run main TestMaxNewSize -XX:+UseSerialGC
  * @run main TestMaxNewSize -XX:+UseParallelGC
--- a/hotspot/test/gc/arguments/TestMinInitialErgonomics.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestMinInitialErgonomics.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8006088
  * @summary Test ergonomics decisions related to minimum and initial heap size.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestMinInitialErgonomics TestMaxHeapSizeTools
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/arguments/TestObjectTenuringFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestObjectTenuringFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Tests argument processing for NeverTenure, AlwaysTenure,
  * and MaxTenuringThreshold
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestObjectTenuringFlags FlagsValue
  * @run main/othervm TestObjectTenuringFlags
  */
--- a/hotspot/test/gc/arguments/TestParallelGCThreads.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestParallelGCThreads.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8059527
  * @summary Tests argument processing for ParallelGCThreads
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver TestParallelGCThreads
  */
 
--- a/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestParallelHeapSizeFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @summary Tests argument processing for initial and maximum heap size for the
  * parallel collectors.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestParallelHeapSizeFlags TestMaxHeapSizeTools
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestSerialHeapSizeFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8006088
  * @summary Tests argument processing for initial and maximum heap size for the Serial collector
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestSerialHeapSizeFlags TestMaxHeapSizeTools
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,8 @@
  *           & vm.opt.UnlockExperimentalVMOptions == null
  *           & (vm.opt.IgnoreUnrecognizedVMOptions == null
  *              | vm.opt.IgnoreUnrecognizedVMOptions == "false")
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main TestSurvivorAlignmentInBytesOption
  */
 public class TestSurvivorAlignmentInBytesOption {
--- a/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestUnrecognizedVMOptionsHandling.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8017611
  * @summary Tests handling unrecognized VM options
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm TestUnrecognizedVMOptionsHandling
  */
 
--- a/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestUseCompressedOopsErgo.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014 Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8010722
  * @summary Tests ergonomics for UseCompressedOops.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management/sun.management
  * @build TestUseCompressedOopsErgo TestUseCompressedOopsErgoTools
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/arguments/TestUseNUMAInterleaving.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 8059614
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver TestUseNUMAInterleaving
  */
 import com.oracle.java.testlibrary.ProcessTools;
--- a/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key gc
  * @bug 8049831
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestCMSClassUnloadingEnabledHWM
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/class_unloading/TestG1ClassUnloadingHWM.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key gc
  * @bug 8049831
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestG1ClassUnloadingHWM
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/concurrentMarkSweep/GuardShrinkWarning.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/concurrentMarkSweep/GuardShrinkWarning.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @key gc
  * @key regression
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm GuardShrinkWarning
  * @author jon.masamitsu@oracle.com
  */
--- a/hotspot/test/gc/defnew/HeapChangeLogging.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/defnew/HeapChangeLogging.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test HeapChangeLogging.java
  * @bug 8027440
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build HeapChangeLogging
  * @summary Allocate to get a promotion failure and verify that that heap change logging is present.
  * @run main HeapChangeLogging
--- a/hotspot/test/gc/g1/Test2GbHeap.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/Test2GbHeap.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @key gc
  * @key regression
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.util.ArrayList;
--- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegions.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * up the heap with humongous objects that should be eagerly reclaimable to avoid Full GC.
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.util.regex.Pattern;
--- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsClearMarkBits.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * mark bitmaps at reclaim.
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.util.ArrayList;
--- a/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestEagerReclaimHumongousRegionsWithRefs.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
  * should still be eagerly reclaimable to avoid Full GC.
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.util.regex.Pattern;
--- a/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestG1TraceEagerReclaimHumongousObjects.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * includes the expected necessary messages.
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.ProcessTools;
--- a/hotspot/test/gc/g1/TestGCLogMessages.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestGCLogMessages.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,142 +23,172 @@
 
 /*
  * @test TestGCLogMessages
- * @bug 8035406 8027295 8035398 8019342 8027959 8048179
+ * @bug 8035406 8027295 8035398 8019342 8027959 8048179 8027962
  * @summary Ensure that the PrintGCDetails output for a minor GC with G1
  * includes the expected necessary messages.
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.ProcessTools;
 import com.oracle.java.testlibrary.OutputAnalyzer;
 
 public class TestGCLogMessages {
-  public static void main(String[] args) throws Exception {
-    testNormalLogs();
-    testWithToSpaceExhaustionLogs();
-  }
 
-  private static void testNormalLogs() throws Exception {
-
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
-                                                              "-Xmx10M",
-                                                              GCTest.class.getName());
+    private enum Level {
+        OFF, FINER, FINEST;
+        public boolean lessOrEqualTo(Level other) {
+            return this.compareTo(other) < 0;
+        }
+    }
 
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    private class LogMessageWithLevel {
+        String message;
+        Level level;
 
-    output.shouldNotContain("[Redirty Cards");
-    output.shouldNotContain("[Parallel Redirty");
-    output.shouldNotContain("[Redirtied Cards");
-    output.shouldNotContain("[Code Root Purge");
-    output.shouldNotContain("[String Dedup Fixup");
-    output.shouldNotContain("[Young Free CSet");
-    output.shouldNotContain("[Non-Young Free CSet");
-    output.shouldNotContain("[Humongous Register");
-    output.shouldNotContain("[Humongous Reclaim");
-    output.shouldHaveExitValue(0);
+        public LogMessageWithLevel(String message, Level level) {
+            this.message = message;
+            this.level = level;
+        }
+    };
 
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
-                                               "-XX:+UseStringDeduplication",
-                                               "-Xmx10M",
-                                               "-XX:+PrintGCDetails",
-                                               GCTest.class.getName());
-
-    output = new OutputAnalyzer(pb.start());
+    private LogMessageWithLevel allLogMessages[] = new LogMessageWithLevel[] {
+        // Ext Root Scan
+        new LogMessageWithLevel("Thread Roots (ms)", Level.FINEST),
+        new LogMessageWithLevel("StringTable Roots (ms)", Level.FINEST),
+        new LogMessageWithLevel("Universe Roots (ms)", Level.FINEST),
+        new LogMessageWithLevel("JNI Handles Roots (ms)", Level.FINEST),
+        new LogMessageWithLevel("ObjectSynchronizer Roots (ms)", Level.FINEST),
+        new LogMessageWithLevel("FlatProfiler Roots", Level.FINEST),
+        new LogMessageWithLevel("Management Roots", Level.FINEST),
+        new LogMessageWithLevel("SystemDictionary Roots", Level.FINEST),
+        new LogMessageWithLevel("CLDG Roots", Level.FINEST),
+        new LogMessageWithLevel("JVMTI Roots", Level.FINEST),
+        new LogMessageWithLevel("CodeCache Roots", Level.FINEST),
+        new LogMessageWithLevel("SATB Filtering", Level.FINEST),
+        new LogMessageWithLevel("CM RefProcessor Roots", Level.FINEST),
+        new LogMessageWithLevel("Wait For Strong CLD", Level.FINEST),
+        new LogMessageWithLevel("Weak CLD Roots", Level.FINEST),
+        // Redirty Cards
+        new LogMessageWithLevel("Redirty Cards", Level.FINER),
+        new LogMessageWithLevel("Parallel Redirty", Level.FINEST),
+        new LogMessageWithLevel("Redirtied Cards", Level.FINEST),
+        // Misc Top-level
+        new LogMessageWithLevel("Code Root Purge", Level.FINER),
+        new LogMessageWithLevel("String Dedup Fixup", Level.FINER),
+        // Free CSet
+        new LogMessageWithLevel("Young Free CSet", Level.FINEST),
+        new LogMessageWithLevel("Non-Young Free CSet", Level.FINEST),
+        // Humongous Eager Reclaim
+        new LogMessageWithLevel("Humongous Reclaim", Level.FINER),
+        new LogMessageWithLevel("Humongous Register", Level.FINER),
+    };
 
-    output.shouldContain("[Redirty Cards");
-    output.shouldNotContain("[Parallel Redirty");
-    output.shouldNotContain("[Redirtied Cards");
-    output.shouldContain("[Code Root Purge");
-    output.shouldContain("[String Dedup Fixup");
-    output.shouldNotContain("[Young Free CSet");
-    output.shouldNotContain("[Non-Young Free CSet");
-    output.shouldContain("[Humongous Register");
-    output.shouldNotContain("[Humongous Total");
-    output.shouldNotContain("[Humongous Candidate");
-    output.shouldContain("[Humongous Reclaim");
-    output.shouldNotContain("[Humongous Reclaimed");
-    output.shouldHaveExitValue(0);
+    void checkMessagesAtLevel(OutputAnalyzer output, LogMessageWithLevel messages[], Level level) throws Exception {
+        for (LogMessageWithLevel l : messages) {
+            if (level.lessOrEqualTo(l.level)) {
+                output.shouldNotContain(l.message);
+            } else {
+                output.shouldContain(l.message);
+            }
+        }
+    }
 
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
-                                               "-XX:+UseStringDeduplication",
-                                               "-Xmx10M",
-                                               "-XX:+PrintGCDetails",
-                                               "-XX:+UnlockExperimentalVMOptions",
-                                               "-XX:G1LogLevel=finest",
-                                               GCTest.class.getName());
+    public static void main(String[] args) throws Exception {
+        new TestGCLogMessages().testNormalLogs();
+        new TestGCLogMessages().testWithToSpaceExhaustionLogs();
+    }
+
+    private void testNormalLogs() throws Exception {
 
-    output = new OutputAnalyzer(pb.start());
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                                  "-Xmx10M",
+                                                                  GCTest.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        checkMessagesAtLevel(output, allLogMessages, Level.OFF);
+        output.shouldHaveExitValue(0);
 
-    output.shouldContain("[Redirty Cards");
-    output.shouldContain("[Parallel Redirty");
-    output.shouldContain("[Redirtied Cards");
-    output.shouldContain("[Code Root Purge");
-    output.shouldContain("[String Dedup Fixup");
-    output.shouldContain("[Young Free CSet");
-    output.shouldContain("[Non-Young Free CSet");
-    output.shouldContain("[Humongous Register");
-    output.shouldContain("[Humongous Total");
-    output.shouldContain("[Humongous Candidate");
-    output.shouldContain("[Humongous Reclaim");
-    output.shouldContain("[Humongous Reclaimed");
-    output.shouldHaveExitValue(0);
-  }
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                   "-XX:+UseStringDeduplication",
+                                                   "-Xmx10M",
+                                                   "-XX:+PrintGCDetails",
+                                                   GCTest.class.getName());
+
+        output = new OutputAnalyzer(pb.start());
+        checkMessagesAtLevel(output, allLogMessages, Level.FINER);
+
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                   "-XX:+UseStringDeduplication",
+                                                   "-Xmx10M",
+                                                   "-XX:+PrintGCDetails",
+                                                   "-XX:+UnlockExperimentalVMOptions",
+                                                   "-XX:G1LogLevel=finest",
+                                                   GCTest.class.getName());
 
-  private static void testWithToSpaceExhaustionLogs() throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
-                                               "-Xmx32M",
-                                               "-Xmn16M",
-                                               "-XX:+PrintGCDetails",
-                                               GCTestWithToSpaceExhaustion.class.getName());
+        output = new OutputAnalyzer(pb.start());
+        checkMessagesAtLevel(output, allLogMessages, Level.FINEST);
+        output.shouldHaveExitValue(0);
+    }
 
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("[Evacuation Failure");
-    output.shouldNotContain("[Recalculate Used");
-    output.shouldNotContain("[Remove Self Forwards");
-    output.shouldNotContain("[Restore RemSet");
-    output.shouldHaveExitValue(0);
+    LogMessageWithLevel exhFailureMessages[] = new LogMessageWithLevel[] {
+        new LogMessageWithLevel("Evacuation Failure", Level.FINER),
+        new LogMessageWithLevel("Recalculate Used", Level.FINEST),
+        new LogMessageWithLevel("Remove Self Forwards", Level.FINEST),
+        new LogMessageWithLevel("Restore RemSet", Level.FINEST),
+    };
+
+    private void testWithToSpaceExhaustionLogs() throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                                  "-Xmx32M",
+                                                                  "-Xmn16M",
+                                                                  "-XX:+PrintGCDetails",
+                                                                  GCTestWithToSpaceExhaustion.class.getName());
+
+        OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        checkMessagesAtLevel(output, exhFailureMessages, Level.FINER);
+        output.shouldHaveExitValue(0);
 
-    pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
-                                               "-Xmx32M",
-                                               "-Xmn16M",
-                                               "-XX:+PrintGCDetails",
-                                               "-XX:+UnlockExperimentalVMOptions",
-                                               "-XX:G1LogLevel=finest",
-                                               GCTestWithToSpaceExhaustion.class.getName());
+        pb = ProcessTools.createJavaProcessBuilder("-XX:+UseG1GC",
+                                                   "-Xmx32M",
+                                                   "-Xmn16M",
+                                                   "-XX:+PrintGCDetails",
+                                                   "-XX:+UnlockExperimentalVMOptions",
+                                                   "-XX:G1LogLevel=finest",
+                                                   GCTestWithToSpaceExhaustion.class.getName());
 
-    output = new OutputAnalyzer(pb.start());
-    output.shouldContain("[Evacuation Failure");
-    output.shouldContain("[Recalculate Used");
-    output.shouldContain("[Remove Self Forwards");
-    output.shouldContain("[Restore RemSet");
-    output.shouldHaveExitValue(0);
-  }
+        output = new OutputAnalyzer(pb.start());
+        checkMessagesAtLevel(output, exhFailureMessages, Level.FINEST);
+        output.shouldHaveExitValue(0);
+    }
 
-  static class GCTest {
-    private static byte[] garbage;
-    public static void main(String [] args) {
-      System.out.println("Creating garbage");
-      // create 128MB of garbage. This should result in at least one GC
-      for (int i = 0; i < 1024; i++) {
-        garbage = new byte[128 * 1024];
-      }
-      System.out.println("Done");
+    static class GCTest {
+        private static byte[] garbage;
+        public static void main(String [] args) {
+            System.out.println("Creating garbage");
+            // create 128MB of garbage. This should result in at least one GC
+            for (int i = 0; i < 1024; i++) {
+                garbage = new byte[128 * 1024];
+            }
+            System.out.println("Done");
+        }
     }
-  }
 
-  static class GCTestWithToSpaceExhaustion {
-    private static byte[] garbage;
-    private static byte[] largeObject;
-    public static void main(String [] args) {
-      largeObject = new byte[16*1024*1024];
-      System.out.println("Creating garbage");
-      // create 128MB of garbage. This should result in at least one GC,
-      // some of them with to-space exhaustion.
-      for (int i = 0; i < 1024; i++) {
-        garbage = new byte[128 * 1024];
-      }
-      System.out.println("Done");
+    static class GCTestWithToSpaceExhaustion {
+        private static byte[] garbage;
+        private static byte[] largeObject;
+        public static void main(String [] args) {
+            largeObject = new byte[16*1024*1024];
+            System.out.println("Creating garbage");
+            // create 128MB of garbage. This should result in at least one GC,
+            // some of them with to-space exhaustion.
+            for (int i = 0; i < 1024; i++) {
+                garbage = new byte[128 * 1024];
+            }
+            System.out.println("Done");
+        }
     }
-  }
 }
+
--- a/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestHumongousAllocInitialMark.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 7168848
  * @summary G1: humongous object allocations should initiate marking cycles when necessary
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestHumongousCodeCacheRoots.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @key gc
  * @bug 8027756
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestHumongousCodeCacheRoots
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * @summary Verify that heap shrinks after GC in the presence of fragmentation
  * due to humongous objects
  * @library /testlibrary
+ * @modules java.management/sun.management
  * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10
  * -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc
  * TestHumongousShrinkHeap
--- a/hotspot/test/gc/g1/TestPrintGCDetails.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestPrintGCDetails.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @key gc
  * @key regression
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.ProcessTools;
--- a/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestPrintRegionRememberedSetInfo.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8014240
  * @summary Test output of G1PrintRegionRememberedSetInfo
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main TestPrintRegionRememberedSetInfo
  * @author thomas.schatzl@oracle.com
  */
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -21,7 +21,7 @@
  * questions.
  */
 
-import static com.oracle.java.testlibrary.Asserts.assertLessThanOrEqual;
+import com.oracle.java.testlibrary.Asserts;
 import com.oracle.java.testlibrary.OutputAnalyzer;
 import com.oracle.java.testlibrary.Platform;
 import com.oracle.java.testlibrary.ProcessTools;
@@ -36,23 +36,29 @@
 import java.util.Collections;
 import java.util.LinkedList;
 import java.util.List;
-import sun.misc.Unsafe;
+import sun.misc.Unsafe; // for ADDRESS_SIZE
+import sun.hotspot.WhiteBox;
 
 public class TestShrinkAuxiliaryData {
 
+    private static final int REGION_SIZE = 1024 * 1024;
+
     private final static String[] initialOpts = new String[]{
         "-XX:MinHeapFreeRatio=10",
         "-XX:MaxHeapFreeRatio=11",
         "-XX:+UseG1GC",
-        "-XX:G1HeapRegionSize=1m",
+        "-XX:G1HeapRegionSize=" + REGION_SIZE,
         "-XX:-ExplicitGCInvokesConcurrent",
-        "-XX:+PrintGCDetails"
+        "-XX:+PrintGCDetails",
+        "-XX:+UnlockDiagnosticVMOptions",
+        "-XX:+WhiteBoxAPI",
+        "-Xbootclasspath/a:.",
     };
 
-    private final int RSetCacheSize;
+    private final int hotCardTableSize;
 
-    protected TestShrinkAuxiliaryData(int RSetCacheSize) {
-        this.RSetCacheSize = RSetCacheSize;
+    protected TestShrinkAuxiliaryData(int hotCardTableSize) {
+        this.hotCardTableSize = hotCardTableSize;
     }
 
     protected void test() throws Exception {
@@ -60,16 +66,16 @@
         Collections.addAll(vmOpts, initialOpts);
 
         int maxCacheSize = Math.max(0, Math.min(31, getMaxCacheSize()));
-        if (maxCacheSize < RSetCacheSize) {
+        if (maxCacheSize < hotCardTableSize) {
             System.out.format("Skiping test for %d cache size due max cache size %d",
-                    RSetCacheSize, maxCacheSize
+                    hotCardTableSize, maxCacheSize
             );
             return;
         }
 
         printTestInfo(maxCacheSize);
 
-        vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize);
+        vmOpts.add("-XX:G1ConcRSLogCacheSize=" + hotCardTableSize);
         vmOpts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
 
         // for 32 bits ObjectAlignmentInBytes is not a option
@@ -92,11 +98,13 @@
 
     private void performTest(List<String> opts) throws Exception {
         ProcessBuilder pb
-                       = ProcessTools.createJavaProcessBuilder(
-                opts.toArray(new String[opts.size()])
-        );
+                = ProcessTools.createJavaProcessBuilder(
+                        opts.toArray(new String[opts.size()])
+                );
 
         OutputAnalyzer output = new OutputAnalyzer(pb.start());
+        System.out.println(output.getStdout());
+        System.err.println(output.getStderr());
         output.shouldHaveExitValue(0);
     }
 
@@ -107,12 +115,13 @@
         formatSymbols.setGroupingSeparator(' ');
         grouped.setDecimalFormatSymbols(formatSymbols);
 
-        System.out.format("Test will use %s bytes of memory of %s available%n"
+        System.out.format(
+                "Test will use %s bytes of memory of %s available%n"
                 + "Available memory is %s with %d bytes pointer size - can save %s pointers%n"
                 + "Max cache size: 2^%d = %s elements%n",
                 grouped.format(ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
-                grouped.format(Runtime.getRuntime().freeMemory()),
-                grouped.format(Runtime.getRuntime().freeMemory()
+                grouped.format(Runtime.getRuntime().maxMemory()),
+                grouped.format(Runtime.getRuntime().maxMemory()
                         - ShrinkAuxiliaryDataTest.getMemoryUsedByTest()),
                 Unsafe.ADDRESS_SIZE,
                 grouped.format((Runtime.getRuntime().freeMemory()
@@ -135,6 +144,7 @@
         if (availableMemory <= 0) {
             return 0;
         }
+
         long availablePointersCount = availableMemory / Unsafe.ADDRESS_SIZE;
         return (63 - (int) Long.numberOfLeadingZeros(availablePointersCount));
     }
@@ -142,17 +152,48 @@
     static class ShrinkAuxiliaryDataTest {
 
         public static void main(String[] args) throws IOException {
-            int iterateCount = DEFAULT_ITERATION_COUNT;
+
+            ShrinkAuxiliaryDataTest testCase = new ShrinkAuxiliaryDataTest();
 
-            if (args.length > 0) {
-                try {
-                    iterateCount = Integer.parseInt(args[0]);
-                } catch (NumberFormatException e) {
-                    //num_iterate remains default
-                }
+            if (!testCase.checkEnvApplicability()) {
+                return;
             }
 
-            new ShrinkAuxiliaryDataTest().test(iterateCount);
+            testCase.test();
+        }
+
+        /**
+         * Checks is this environment suitable to run this test
+         * - memory is enough to decommit (page size is not big)
+         * - RSet cache size is not too big
+         *
+         * @return true if test could run, false if test should be skipped
+         */
+        protected boolean checkEnvApplicability() {
+
+            int pageSize = WhiteBox.getWhiteBox().getVMPageSize();
+            System.out.println( "Page size = " + pageSize
+                    + " region size = " + REGION_SIZE
+                    + " aux data ~= " + (REGION_SIZE * 3 / 100));
+            // If auxdata size will be less than page size it wouldn't decommit.
+            // Auxiliary data size is about ~3.6% of heap size.
+            if (pageSize >= REGION_SIZE * 3 / 100) {
+                System.out.format("Skipping test for too large page size = %d",
+                       pageSize
+                );
+                return false;
+            }
+
+            if (REGION_SIZE * REGIONS_TO_ALLOCATE > Runtime.getRuntime().maxMemory()) {
+                System.out.format("Skipping test for too low available memory. "
+                        + "Need %d, available %d",
+                        REGION_SIZE * REGIONS_TO_ALLOCATE,
+                        Runtime.getRuntime().maxMemory()
+                );
+                return false;
+            }
+
+            return true;
         }
 
         class GarbageObject {
@@ -177,41 +218,54 @@
 
         private final List<GarbageObject> garbage = new ArrayList();
 
-        public void test(int num_iterate) throws IOException {
+        public void test() throws IOException {
+
+            MemoryUsage muFull, muFree, muAuxDataFull, muAuxDataFree;
+            float auxFull, auxFree;
 
             allocate();
             link();
             mutate();
-            deallocate();
+
+            muFull = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+            long numUsedRegions = WhiteBox.getWhiteBox().g1NumMaxRegions()
+                    - WhiteBox.getWhiteBox().g1NumFreeRegions();
+            muAuxDataFull = WhiteBox.getWhiteBox().g1AuxiliaryMemoryUsage();
+            auxFull = (float)muAuxDataFull.getUsed() / numUsedRegions;
 
-            MemoryUsage muBeforeHeap
-                        = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
-            MemoryUsage muBeforeNonHeap
-                        = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
+            System.out.format("Full aux data  ratio= %f, regions max= %d, used= %d\n",
+                    auxFull, WhiteBox.getWhiteBox().g1NumMaxRegions(), numUsedRegions
+            );
+
+            deallocate();
+            System.gc();
 
-            for (int i = 0; i < num_iterate; i++) {
-                allocate();
-                link();
-                mutate();
-                deallocate();
-            }
+            muFree = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
+            muAuxDataFree = WhiteBox.getWhiteBox().g1AuxiliaryMemoryUsage();
+
+            numUsedRegions = WhiteBox.getWhiteBox().g1NumMaxRegions()
+                    - WhiteBox.getWhiteBox().g1NumFreeRegions();
+            auxFree = (float)muAuxDataFree.getUsed() / numUsedRegions;
 
-            System.gc();
-            MemoryUsage muAfterHeap
-                        = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage();
-            MemoryUsage muAfterNonHeap
-                        = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage();
+            System.out.format("Free aux data ratio= %f, regions max= %d, used= %d\n",
+                    auxFree, WhiteBox.getWhiteBox().g1NumMaxRegions(), numUsedRegions
+            );
 
-            assertLessThanOrEqual(muAfterHeap.getCommitted(), muBeforeHeap.getCommitted(),
-                    String.format("heap decommit failed - after > before: %d > %d",
-                            muAfterHeap.getCommitted(), muBeforeHeap.getCommitted()
+            Asserts.assertLessThanOrEqual(muFree.getCommitted(), muFull.getCommitted(),
+                    String.format("heap decommit failed - full > free: %d > %d",
+                            muFree.getCommitted(), muFull.getCommitted()
                     )
             );
 
-            if (muAfterHeap.getCommitted() < muBeforeHeap.getCommitted()) {
-                assertLessThanOrEqual(muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted(),
-                        String.format("non-heap decommit failed - after > before: %d > %d",
-                                muAfterNonHeap.getCommitted(), muBeforeNonHeap.getCommitted()
+            System.out.format("State               used   committed\n");
+            System.out.format("Full aux data: %10d %10d\n", muAuxDataFull.getUsed(), muAuxDataFull.getCommitted());
+            System.out.format("Free aux data: %10d %10d\n", muAuxDataFree.getUsed(), muAuxDataFree.getCommitted());
+
+            // if decommited check that aux data has same ratio
+            if (muFree.getCommitted() < muFull.getCommitted()) {
+                Asserts.assertLessThanOrEqual(auxFree, auxFull,
+                        String.format("auxiliary data decommit failed - full > free: %f > %f",
+                                auxFree, auxFull
                         )
                 );
             }
@@ -238,8 +292,7 @@
                 for (int i = 0; i < NUM_LINKS; i++) {
                     int regionToLink;
                     do {
-                        regionToLink = (int) (Math.random()
-                                * REGIONS_TO_ALLOCATE);
+                        regionToLink = (int) (Math.random() * REGIONS_TO_ALLOCATE);
                     } while (regionToLink == regionNumber);
 
                     // get random garbage object from random region
@@ -265,11 +318,8 @@
             return REGIONS_TO_ALLOCATE * REGION_SIZE;
         }
 
-        private static final int REGION_SIZE = 1024 * 1024;
-        private static final int DEFAULT_ITERATION_COUNT = 1;   // iterate main scenario
-        private static final int REGIONS_TO_ALLOCATE = 5;
+        private static final int REGIONS_TO_ALLOCATE = 100;
         private static final int NUM_OBJECTS_PER_REGION = 10;
         private static final int NUM_LINKS = 20; // how many links create for each object
-
     }
 }
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData00.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,17 @@
 
 /**
  * @test TestShrinkAuxiliaryData00
- * @bug 8038423
+ * @bug 8038423 8061715
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /../../test/lib
- * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData00
+ * @modules java.base/sun.misc
+ *          java.management
+ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
+ *        TestShrinkAuxiliaryData TestShrinkAuxiliaryData00
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=720 TestShrinkAuxiliaryData00
  */
 public class TestShrinkAuxiliaryData00 {
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,17 @@
 
 /**
  * @test TestShrinkAuxiliaryData05
- * @bug 8038423
+ * @bug 8038423 8061715
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /../../test/lib
- * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
+ * @modules java.base/sun.misc
+ *          java.management
+ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
+ *        TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=720 TestShrinkAuxiliaryData05
  */
 public class TestShrinkAuxiliaryData05 {
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,17 @@
 
 /**
  * @test TestShrinkAuxiliaryData10
- * @bug 8038423
+ * @bug 8038423 8061715
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
+ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=720 TestShrinkAuxiliaryData10
  */
 public class TestShrinkAuxiliaryData10 {
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,17 @@
 
 /**
  * @test TestShrinkAuxiliaryData15
- * @bug 8038423
+ * @bug 8038423 8061715
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
+ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=720 TestShrinkAuxiliaryData15
  */
 public class TestShrinkAuxiliaryData15 {
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,17 @@
 
 /**
  * @test TestShrinkAuxiliaryData20
- * @bug 8038423
+ * @bug 8038423 8061715
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+  *          java.management
+ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=720 TestShrinkAuxiliaryData20
  */
 public class TestShrinkAuxiliaryData20 {
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,17 @@
 
 /**
  * @test TestShrinkAuxiliaryData25
- * @bug 8038423
+ * @bug 8038423 8061715
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
+ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=720 TestShrinkAuxiliaryData25
  */
 public class TestShrinkAuxiliaryData25 {
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,12 +23,17 @@
 
 /**
  * @test TestShrinkAuxiliaryData30
- * @bug 8038423
+ * @bug 8038423 8061715
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
  * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
+ * @build com.oracle.java.testlibrary.* sun.hotspot.WhiteBox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run driver/timeout=720 TestShrinkAuxiliaryData30
  */
 public class TestShrinkAuxiliaryData30 {
--- a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,8 @@
  *     3. invoke gc and check that memory returned to the system (amount of committed memory got down)
  *
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management/sun.management
  */
 import java.lang.management.ManagementFactory;
 import java.lang.management.MemoryUsage;
--- a/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringDeduplicationAgeThreshold.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8029075
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class TestStringDeduplicationAgeThreshold {
--- a/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringDeduplicationFullGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8029075
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class TestStringDeduplicationFullGC {
--- a/hotspot/test/gc/g1/TestStringDeduplicationInterned.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringDeduplicationInterned.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8029075
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class TestStringDeduplicationInterned {
--- a/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringDeduplicationPrintOptions.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8029075
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class TestStringDeduplicationPrintOptions {
--- a/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringDeduplicationTableRehash.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8029075
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class TestStringDeduplicationTableRehash {
--- a/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringDeduplicationTableResize.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8029075
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class TestStringDeduplicationTableResize {
--- a/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringDeduplicationYoungGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8029075
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class TestStringDeduplicationYoungGC {
--- a/hotspot/test/gc/g1/TestStringSymbolTableStats.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestStringSymbolTableStats.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Ensure that the G1TraceStringSymbolTableScrubbing prints the expected message.
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.ProcessTools;
--- a/hotspot/test/gc/g1/TestSummarizeRSetStats.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStats.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test TestSummarizeRSetStats.java
  * @bug 8013895
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management/sun.management
  * @build TestSummarizeRSetStatsTools TestSummarizeRSetStats
  * @summary Verify output of -XX:+G1SummarizeRSetStats
  * @run main TestSummarizeRSetStats
--- a/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsPerRegion.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test TestSummarizeRSetStatsPerRegion.java
  * @bug 8014078
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management/sun.management
  * @build TestSummarizeRSetStatsTools TestSummarizeRSetStatsPerRegion
  * @summary Verify output of -XX:+G1SummarizeRSetStats in regards to per-region type output
  * @run main TestSummarizeRSetStatsPerRegion
--- a/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/g1/TestSummarizeRSetStatsThreads.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * refinement threads do not crash the VM.
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management/sun.management
  */
 
 import java.util.regex.Matcher;
--- a/hotspot/test/gc/logging/TestGCId.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/logging/TestGCId.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Ensure that the GCId is logged
  * @key gc
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.ProcessTools;
--- a/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/metaspace/CompressedClassSpaceSizeInJmapHeap.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @bug 8004924
  * @summary Checks that jmap -heap contains the flag CompressedClassSpaceSize
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:CompressedClassSpaceSize=50m CompressedClassSpaceSizeInJmapHeap
  */
 
--- a/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/metaspace/TestCapacityUntilGCWrapAround.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key gc
  * @bug 8049831
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestCapacityUntilGCWrapAround
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/metaspace/TestMetaspaceMemoryPool.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
  * @summary Tests that a MemoryPoolMXBeans is created for metaspace and that a
  *          MemoryManagerMXBean is created.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops TestMetaspaceMemoryPool
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:MaxMetaspaceSize=60m TestMetaspaceMemoryPool
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedClassPointers TestMetaspaceMemoryPool
--- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,7 +33,10 @@
  * @library /testlibrary
  * @summary Tests that performance counters for metaspace and compressed class
  *          space exists and works.
- *
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseSerialGC TestMetaspacePerfCounters
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseParallelGC -XX:+UseParallelOldGC TestMetaspacePerfCounters
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedClassPointers -XX:+UsePerfData -XX:+UseG1GC TestMetaspacePerfCounters
--- a/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/metaspace/TestMetaspaceSizeFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@
  * @bug 8024650
  * @summary Test that metaspace size flags can be set correctly
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 public class TestMetaspaceSizeFlags {
   public static final long K = 1024L;
--- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,9 @@
  * @requires vm.gc=="Serial" | vm.gc=="null"
  * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
  *          report the same data.
+ * @modules java.base/sun.misc
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+UseCompressedOops -XX:+UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
  */
--- a/hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/parallelScavenge/AdaptiveGCBoundary.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @key gc
  * @key regression
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm AdaptiveGCBoundary
  * @author jon.masamitsu@oracle.com
  */
--- a/hotspot/test/gc/startup_warnings/TestCMS.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestCMS.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8006398
 * @summary Test that CMS does not print a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8065972
 * @summary Test that the unsupported DefNew+CMS combination does not start
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestDefaultMaxRAMFraction.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8021967
 * @summary Test that the deprecated TestDefaultMaxRAMFraction flag print a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestG1.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestG1.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8006398
 * @summary Test that the G1 collector does not print a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestNoParNew.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestNoParNew.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8065972
 * @summary Test that specifying -XX:-UseParNewGC on the command line logs a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8065972
 * @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8065972
 * @summary Test that the unsupported ParNew+SerialOld combination does not start
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestParallelGC.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestParallelGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8006398
 * @summary Test that ParallelGC does not print a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestParallelScavengeSerialOld.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8006398
 * @summary Test that the ParallelScavenge+SerialOld combination does not print a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/startup_warnings/TestSerialGC.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/startup_warnings/TestSerialGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
 * @bug 8006398
 * @summary Test that SerialGC does not print a warning message
 * @library /testlibrary
+* @modules java.base/sun.misc
+*          java.management
 */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify that object's alignment in eden space is not affected by
  *          SurvivorAlignmentInBytes option.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestAllocationInEden SurvivorAlignmentTestMain AlignmentHelper
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify that objects promoted from eden space to tenured space during
  *          full GC are not aligned to SurvivorAlignmentInBytes value.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain
  *        AlignmentHelper
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify that objects promoted from survivor space to tenured space
  *          during full GC are not aligned to SurvivorAlignmentInBytes value.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPromotionFromSurvivorToTenuredAfterFullGC
  *        SurvivorAlignmentTestMain AlignmentHelper
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  *          when their age exceeded tenuring threshold are not aligned to
  *          SurvivorAlignmentInBytes value.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPromotionFromSurvivorToTenuredAfterMinorGC
  *        SurvivorAlignmentTestMain AlignmentHelper
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Verify that objects promoted from eden space to survivor space after
  *          minor GC are aligned to SurvivorAlignmentInBytes.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPromotionToSurvivor
  *        SurvivorAlignmentTestMain AlignmentHelper
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,10 @@
  * @bug 8065579
  * @requires vm.gc=="null" | vm.gc=="G1"
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestConcMarkCycleWB
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/gc/whitebox/TestWBGC.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/gc/whitebox/TestWBGC.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8055098
  * @summary Test verify that WB methods isObjectInOldGen and youngGC works correctly.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestWBGC
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run driver TestWBGC
--- a/hotspot/test/runtime/6819213/TestBootNativeLibraryPath.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/6819213/TestBootNativeLibraryPath.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test TestBootNativeLibraryPath.java
  * @bug 6819213
+ * @modules java.compiler
  * @compile -XDignore.symbol.file TestBootNativeLibraryPath.java
  * @summary verify sun.boot.native.library.path is expandable on 32 bit systems
  * @run main TestBootNativeLibraryPath
--- a/hotspot/test/runtime/8003720/Test8003720.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/8003720/Test8003720.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @test
  * @bug 8003720
  * @summary Method in interpreter stack frame can be deallocated
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
  * @compile -XDignore.symbol.file Victim.java
  * @run main/othervm -Xverify:all -Xint Test8003720
  */
--- a/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/8026365/InvokeSpecialAnonTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Test invokespecial of host class method from an anonymous class
  * @author  Robert Field
  * @library /testlibrary
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
  * @compile -XDignore.symbol.file InvokeSpecialAnonTest.java
  * @run main ClassFileInstaller InvokeSpecialAnonTest AnonTester
  * @run main/othervm -Xbootclasspath/a:. -Xverify:all InvokeSpecialAnonTest
--- a/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/BadObjectClass/BootstrapRedefine.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @bug 6583051
  * @summary Give error if java.lang.Object has been incompatibly overridden on the bootpath
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile Object.java
  * @run main BootstrapRedefine
  */
--- a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrs.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8003424
  * @summary Testing UseCompressedClassPointers with CDS
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main CDSCompressedKPtrs
  */
 
--- a/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CDSCompressedKPtrs/CDSCompressedKPtrsError.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8003424
  * @summary Test that cannot use CDS if UseCompressedClassPointers is turned off.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main CDSCompressedKPtrsError
  */
 
--- a/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CDSCompressedKPtrs/XShareAuto.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8005933
  * @summary Test that -Xshare:auto uses CDS when explicitly specified with -server.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main XShareAuto
  */
 
--- a/hotspot/test/runtime/ClassFile/JsrRewriting.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/ClassFile/JsrRewriting.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,9 @@
  * @bug 7149464
  * @key cte_test
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.desktop
+ *          java.management
  * @run main JsrRewriting
  */
 
--- a/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/ClassFile/OomWhileParsingRepeatedJsr.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,9 @@
  * @bug 7123945
  * @bug 8016029
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.desktop
+ *          java.management
  * @run main OomWhileParsingRepeatedJsr
  */
 
--- a/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/ClassFile/UnsupportedClassFileVersion.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,9 @@
 /*
  * @test
  * @library /testlibrary
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
+ *          java.management
  * @compile -XDignore.symbol.file UnsupportedClassFileVersion.java
  * @run main UnsupportedClassFileVersion
  */
--- a/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/BooleanFlagWithInvalidValue.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8006298
  * @summary Setting an invalid value for a bool argument should result in a useful error message
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/CompilerConfigFileWarning.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 7167142
  * @summary Warn if unused .hotspot_compiler file is present
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.io.PrintWriter;
--- a/hotspot/test/runtime/CommandLine/ConfigFileParsing.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/ConfigFileParsing.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 7158804
  * @summary Improve config file parsing
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.io.PrintWriter;
--- a/hotspot/test/runtime/CommandLine/ConfigFileWarning.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/ConfigFileWarning.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 7167142
  * @summary Warn if unused .hotspot_rc file is present
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.io.PrintWriter;
--- a/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/FlagWithInvalidValue.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8006298
  * @summary Setting a flag to an invalid value should print a useful error message
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/NonBooleanFlagWithInvalidBooleanPrefix.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8006298
  * @summary Using a bool (+/-) prefix on non-bool flag should result in a useful error message
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8060449
  * @summary Newly obsolete command line options should still give useful error messages when used improperly.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CommandLine/TestHexArguments.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/TestHexArguments.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Make sure there is no error using hexadecimal format in vm options
  * @author Yumin Qi
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.io.File;
--- a/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/TestNullTerminatedFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @bug 6522873
  * @summary Test that the VM don't allow random junk characters at the end of valid command line flags.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver TestNullTerminatedFlags
  */
 public class TestNullTerminatedFlags {
--- a/hotspot/test/runtime/CommandLine/TestVMOptions.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/TestVMOptions.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8060256
  * @summary Test various command line options
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main TestVMOptions
  */
 
--- a/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/TraceExceptionsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8048933
  * @summary TraceExceptions output should have the exception message - useful for ClassNotFoundExceptions especially
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/UnrecognizedVMOption.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8006298
  * @summary Using an unrecognized VM option should print the name of the option
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CommandLine/VMOptionWarning.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CommandLine/VMOptionWarning.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8027314
  * @summary Warn if diagnostic or experimental vm option is used and -XX:+UnlockDiagnosticVMOptions or -XX:+UnlockExperimentalVMOptions, respectively, isn't specified. Warn if develop or notproduct vm option is used with product version of VM.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CompressedOops/CompressedClassPointers.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8024927
  * @summary Testing address of compressed class pointer space as best as possible.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CompressedOops/CompressedClassSpaceSize.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8022865
  * @summary Tests for the -XX:CompressedClassSpaceSize command line option
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main CompressedClassSpaceSize
  */
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CompressedOops/CompressedKlassPointerAndOops.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @key regression
  * @summary NPG: UseCompressedClassPointers asserts with ObjectAlignmentInBytes=32
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CompressedOops/ObjectAlignment.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CompressedOops/ObjectAlignment.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8022865
  * @summary Tests for the -XX:ObjectAlignmentInBytes command line option
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main ObjectAlignment
  */
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/CompressedOops/UseCompressedOops.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/CompressedOops/UseCompressedOops.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8022865
  * @summary Tests for different combination of UseCompressedOops options
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main UseCompressedOops
  */
 import java.util.ArrayList;
--- a/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/EnclosingMethodAttr/EnclMethodAttr.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8044738
  * @library /testlibrary
  * @summary Check attribute_length of EnclosingMethod attribute
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main EnclMethodAttr
  */
 
--- a/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/ErrorHandling/ProblematicFrameTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,10 @@
  * @bug 8050167
  * @summary Test that error is not occurred during printing problematic frame
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @run driver ProblematicFrameTest
  */
--- a/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/ErrorHandling/SecondaryErrorTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -14,6 +14,8 @@
  * @summary Synchronous signals during error reporting may terminate or hang VM process
  * @library /testlibrary
  * @author Thomas Stuefe (SAP)
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 public class SecondaryErrorTest {
--- a/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/InternalApi/ThreadCpuTimesDeadlock.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @bug 7196045
  * @bug 8014294
  * @summary Possible JVM deadlock in ThreadTimesClosure when using HotspotInternal non-public API.
+ * @modules java.management/sun.management
  * @run main/othervm -XX:+UsePerfData -Xmx32m ThreadCpuTimesDeadlock
  */
 
--- a/hotspot/test/runtime/LoadClass/LoadClassNegative.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/LoadClass/LoadClassNegative.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8020675
  * @summary make sure there is no fatal error if a class is loaded from an invalid jar file which is in the bootclasspath
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestForName
  * @build LoadClassNegative
  * @run main LoadClassNegative
--- a/hotspot/test/runtime/LocalVariableTable/TestLVT.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/LocalVariableTable/TestLVT.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @bug 8049632
  * @summary Test ClassFileParser::copy_localvariable_table cases
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile -g -XDignore.symbol.file TestLVT.java
  * @run main TestLVT
  */
--- a/hotspot/test/runtime/Metaspace/FragmentMetaspace.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Metaspace/FragmentMetaspace.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /**
  * @test
  * @library /runtime/testlibrary
+ * @modules java.compiler
  * @build GeneratedClassLoader
  * @run main/othervm/timeout=200 -Xmx300m FragmentMetaspace
  */
--- a/hotspot/test/runtime/NMT/AutoshutdownNMT.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/AutoshutdownNMT.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt
  * @summary Test for deprecated message if -XX:-AutoShutdownNMT is specified
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/BaselineWithParameter.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/BaselineWithParameter.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @key nmt jcmd regression
  * @summary Regression test for invoking a jcmd with baseline=false, result was that the target VM crashed
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:NativeMemoryTracking=detail BaselineWithParameter
  */
 
--- a/hotspot/test/runtime/NMT/CommandLineDetail.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/CommandLineDetail.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt
  * @summary Running with NMT detail should not result in an error
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/CommandLineEmptyArgument.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt
  * @summary Empty argument to NMT should result in an informative error message
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/CommandLineInvalidArgument.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt
  * @summary Invalid argument to NMT should result in an informative error message
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/CommandLineSummary.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/CommandLineSummary.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt
  * @summary Running with NMT summary should not result in an error
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/CommandLineTurnOffNMT.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt
  * @summary Turning off NMT should not result in an error
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/JcmdBaselineDetail.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/JcmdBaselineDetail.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt jcmd
  * @summary Verify that jcmd correctly reports that baseline succeeds with NMT enabled with detailed tracking.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:NativeMemoryTracking=detail JcmdBaselineDetail
  */
 
--- a/hotspot/test/runtime/NMT/JcmdDetailDiff.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/JcmdDetailDiff.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary run NMT baseline, allocate memory and verify output from detail.diff
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @ignore
  * @build JcmdDetailDiff
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/runtime/NMT/JcmdScale.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/JcmdScale.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt jcmd
  * @summary Test the NMT scale parameter
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:NativeMemoryTracking=summary JcmdScale
  */
 
--- a/hotspot/test/runtime/NMT/JcmdScaleDetail.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/JcmdScaleDetail.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt jcmd
  * @summary Test the NMT scale parameter with detail tracking level
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:NativeMemoryTracking=detail JcmdScaleDetail
  */
 
--- a/hotspot/test/runtime/NMT/JcmdSummaryDiff.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/JcmdSummaryDiff.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary run NMT baseline, allocate memory and verify output from summary.diff
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build JcmdSummaryDiff
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary JcmdSummaryDiff
--- a/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/JcmdWithNMTDisabled.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt jcmd
  * @summary Verify that jcmd correctly reports that NMT is not enabled
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main JcmdWithNMTDisabled 1
  */
 
--- a/hotspot/test/runtime/NMT/MallocRoundingReportTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/MallocRoundingReportTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary Test consistency of NMT by creating allocations of the Test type with various sizes and verifying visibility with jcmd
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build MallocRoundingReportTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocRoundingReportTest
--- a/hotspot/test/runtime/NMT/MallocStressTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/MallocStressTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary Stress test for malloc tracking
  * @key nmt jcmd stress
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build MallocStressTest
  * @ignore - This test is disabled since it will stress NMT and timeout during normal testing
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
--- a/hotspot/test/runtime/NMT/MallocTestType.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/MallocTestType.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary Test consistency of NMT by leaking a few select allocations of the Test type and then verify visibility with jcmd
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build MallocTestType
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Test to verify correctness of malloc tracking
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build MallocTrackingVerify
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTrackingVerify
--- a/hotspot/test/runtime/NMT/NMTWithCDS.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/NMTWithCDS.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8055061
  * @key nmt
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main NMTWithCDS
  */
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/PrintNMTStatisticsWithNMTDisabled.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt
  * @summary Trying to enable PrintNMTStatistics should result in a warning
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/NMT/ReleaseNoCommit.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/ReleaseNoCommit.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary Release uncommitted memory and make sure NMT handles it correctly
  * @key nmt regression
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build ReleaseNoCommit
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=summary ReleaseNoCommit
--- a/hotspot/test/runtime/NMT/ShutdownTwice.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/ShutdownTwice.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt jcmd
  * @summary Run shutdown twice
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:NativeMemoryTracking=detail ShutdownTwice
  */
 
--- a/hotspot/test/runtime/NMT/SummaryAfterShutdown.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/SummaryAfterShutdown.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt jcmd
  * @summary Verify that jcmd correctly reports that NMT is not enabled after a shutdown
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:NativeMemoryTracking=detail SummaryAfterShutdown
  */
 
--- a/hotspot/test/runtime/NMT/SummarySanityCheck.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/SummarySanityCheck.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @key nmt jcmd
  * @summary Sanity check the output of NMT
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build SummarySanityCheck
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/NMT/ThreadedMallocTestType.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/ThreadedMallocTestType.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build ThreadedMallocTestType
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/ThreadedVirtualAllocTestType.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build ThreadedVirtualAllocTestType
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/VirtualAllocCommitUncommitRecommit.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @summary Test reserve/commit/uncommit/release of virtual memory and that we track it correctly
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build VirtualAllocCommitUncommitRecommit
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail VirtualAllocCommitUncommitRecommit
--- a/hotspot/test/runtime/NMT/VirtualAllocTestType.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/NMT/VirtualAllocTestType.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @summary Test Reserve/Commit/Uncommit/Release of virtual memory and that we track it correctly
  * @key nmt jcmd
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build VirtualAllocTestType
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/PerfMemDestroy/PerfMemDestroy.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8030955
  * @summary Allow multiple calls to PerfMemory::destroy() without asserting.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main PerfMemDestroy
  */
 
--- a/hotspot/test/runtime/RedefineObject/TestRedefineObject.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/RedefineObject/TestRedefineObject.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -33,6 +33,9 @@
  * @bug 8005056
  * @bug 8009728
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.instrument
+ *          java.management
  * @build Agent
  * @run main ClassFileInstaller Agent
  * @run main TestRedefineObject
--- a/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/RedefineTests/RedefineAnnotations.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
  * @test
  * @library /testlibrary
  * @summary Test that type annotations are retained after a retransform
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.instrument
+ *          jdk.jartool/sun.tools.jar
  * @run main RedefineAnnotations buildagent
  * @run main/othervm -javaagent:redefineagent.jar RedefineAnnotations
  */
--- a/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/RedefineTests/RedefineFinalizer.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
  * @bug 6904403
  * @summary Don't assert if we redefine finalize method
  * @library /testlibrary
+ * @modules java.compiler
+ *          java.instrument
+ *          jdk.jartool/sun.tools.jar
  * @build RedefineClassHelper
  * @run main RedefineClassHelper
  * @run main/othervm -javaagent:redefineagent.jar RedefineFinalizer
--- a/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/RedefineTests/RedefineRunningMethods.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
  * @bug 8055008
  * @summary Redefine EMCP and non-EMCP methods that are running in an infinite loop
  * @library /testlibrary
+ * @modules java.compiler
+ *          java.instrument
+ *          jdk.jartool/sun.tools.jar
  * @build RedefineClassHelper
  * @run main RedefineClassHelper
  * @run main/othervm -javaagent:redefineagent.jar -XX:TraceRedefineClasses=0x600 RedefineRunningMethods
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency1.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8047290
  * @summary Ensure that a Monitor::lock_without_safepoint_check fires an assert when it incorrectly acquires a lock which must always have safepoint checks.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AssertSafepointCheckConsistency1
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency2.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8047290
  * @summary Ensure that a Monitor::lock fires an assert when it incorrectly acquires a lock which must never have safepoint checks.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AssertSafepointCheckConsistency2
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency3.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8047290
  * @summary Ensure that Monitor::lock_without_safepoint_check does not assert when it correctly acquires a lock which must never have safepoint checks.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AssertSafepointCheckConsistency3
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Safepoint/AssertSafepointCheckConsistency4.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8047290
  * @summary Ensure that Monitor::lock does not assert when it correctly acquires a lock which must always have safepoint checks.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build AssertSafepointCheckConsistency4
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/ArchiveDoesNotExist.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  *          when sharing mode is ON, and continue w/o sharing if sharing
  *          mode is AUTO.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main ArchiveDoesNotExist
  */
 
--- a/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/CdsDifferentObjectAlignment.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,8 @@
  *          should fail when loading.
  * @library /testlibrary
  * @bug 8025642
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/CdsSameObjectAlignment.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary Testing CDS (class data sharing) using varying object alignment.
  *          Using same object alignment for each dump/load pair
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/DefaultUseWithClient.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test DefaultUseWithClient
  * @summary Test default behavior of sharing with -client
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main DefaultUseWithClient
  * @bug 8032224
  */
--- a/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/DumpSymbolAndStringTable.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8059510
  * @summary Test jcmd VM.symboltable and VM.stringtable options
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions DumpSymbolAndStringTable
  */
 
--- a/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/LimitSharedSizes.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /* @test LimitSharedSizes
  * @summary Test handling of limits on shared space size
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main LimitSharedSizes
  */
 
--- a/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/MaxMetaspaceSize.java	Wed Jul 05 20:27:20 2017 +0200
@@ -26,6 +26,8 @@
  * @bug 8067187
  * @summary Testing CDS dumping with the -XX:MaxMetaspaceSize=<size> option
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/PrintSharedArchiveAndExit.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8066670
  * @summary Testing -XX:+PrintSharedArchiveAndExit option
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedArchiveFile.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8014138
  * @summary Testing new -XX:SharedArchiveFile=<file-name> option
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedBaseAddress.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @summary Test variety of values for SharedBaseAddress, making sure
  *          VM handles normal values as well as edge values w/o a crash.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main SharedBaseAddress
  */
 
--- a/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SharedSymbolTableBucketSize.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8059510
  * @summary Test SharedSymbolTableBucketSize option
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/SharedArchiveFile/SpaceUtilizationCheck.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test SpaceUtilizationCheck
  * @summary Check if the space utilization for shared spaces is adequate
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main SpaceUtilizationCheck
  */
 
--- a/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Thread/TestThreadDumpMonitorContention.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
  *      whether jstack reports "locked" by more than one thread.
  *
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm TestThreadDumpMonitorContention
  */
 
--- a/hotspot/test/runtime/Thread/ThreadPriorities.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Thread/ThreadPriorities.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2015 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  *      whether jstack reports correct priorities for them.
  *
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main ThreadPriorities
  */
 
--- a/hotspot/test/runtime/Unsafe/AllocateInstance.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/AllocateInstance.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verifies the behaviour of Unsafe.allocateInstance
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main AllocateInstance
  */
 
--- a/hotspot/test/runtime/Unsafe/AllocateMemory.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/AllocateMemory.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verifies behaviour of Unsafe.allocateMemory
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m AllocateMemory
  */
 
--- a/hotspot/test/runtime/Unsafe/CopyMemory.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/CopyMemory.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verifies behaviour of Unsafe.copyMemory
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main CopyMemory
  */
 
--- a/hotspot/test/runtime/Unsafe/DefineClass.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/DefineClass.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,9 @@
  * @test
  * @summary Verifies the behaviour of Unsafe.defineClass
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
  * @run main DefineClass
  */
 
--- a/hotspot/test/runtime/Unsafe/FieldOffset.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/FieldOffset.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verifies the behaviour of Unsafe.fieldOffset
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main FieldOffset
  */
 
--- a/hotspot/test/runtime/Unsafe/GetField.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetField.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verifies behaviour of Unsafe.getField
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetField
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutAddress.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutAddress.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * Verify behaviour of Unsafe.get/putAddress and Unsafe.addressSize
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutAddress
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutBoolean.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putBoolean
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutBoolean
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutByte.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutByte.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putByte
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutByte
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutChar.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutChar.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putChar
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutChar
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutDouble.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutDouble.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putDouble
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutDouble
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutFloat.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutFloat.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putFloat
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutFloat
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutInt.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutInt.java	Wed Jul 05 20:27:20 2017 +0200
@@ -24,6 +24,8 @@
 /*
  * @test
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutInt
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutLong.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutLong.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putLong
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutLong
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutObject.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutObject.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putObject
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutObject
  */
 
--- a/hotspot/test/runtime/Unsafe/GetPutShort.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetPutShort.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify behaviour of Unsafe.get/putShort
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main GetPutShort
  */
 
--- a/hotspot/test/runtime/Unsafe/GetUnsafe.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/GetUnsafe.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,7 @@
  * @test
  * @summary Verifies that getUnsafe() actually throws SecurityException when unsafeAccess is prohibited.
  * @library /testlibrary
+ * @modules java.base/sun.misc
  * @run main GetUnsafe
  */
 
--- a/hotspot/test/runtime/Unsafe/PageSize.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/PageSize.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Make sure pageSize() returns a value that is a power of two
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main PageSize
  */
 
--- a/hotspot/test/runtime/Unsafe/RangeCheck.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/RangeCheck.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8001071
  * @summary Add simple range check into VM implemenation of Unsafe access methods
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.*;
--- a/hotspot/test/runtime/Unsafe/Reallocate.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/Reallocate.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @bug 8058897
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:MallocMaxTestWords=100m Reallocate
  */
 
--- a/hotspot/test/runtime/Unsafe/SetMemory.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/SetMemory.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verifies that setMemory works correctly
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main SetMemory
  */
 
--- a/hotspot/test/runtime/Unsafe/ThrowException.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/Unsafe/ThrowException.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify that throwException() can throw an exception
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main ThrowException
  */
 
--- a/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/XCheckJniJsig/XCheckJSig.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 7051189 8023393
  * @summary Need to suppress info message if -Xcheck:jni is used with libjsig.so
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main XCheckJSig
  */
 
--- a/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/classFileParserBug/ClassFileParserBug.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8040018
  * @library /testlibrary
  * @summary Check for exception instead of assert.
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main ClassFileParserBug
  */
 
--- a/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/classFileParserBug/TestEmptyBootstrapMethodsAttr.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8041918
  * @library /testlibrary
  * @summary Test empty bootstrap_methods table within BootstrapMethods attribute
+ * @modules java.base/sun.misc
+ *          java.management
  * @compile TestEmptyBootstrapMethodsAttr.java
  * @run main TestEmptyBootstrapMethodsAttr
  */
--- a/hotspot/test/runtime/contended/Basic.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/contended/Basic.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
  * @test
  * @bug     8003985
  * @summary Support Contended Annotation - JEP 142
- *
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:-RestrictContended Basic
  */
 public class Basic {
--- a/hotspot/test/runtime/contended/DefaultValue.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/contended/DefaultValue.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
  * @bug     8014509
  * @summary \@Contended: explicit default value behaves differently from the implicit value
  *
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:-RestrictContended DefaultValue
  */
 public class DefaultValue {
--- a/hotspot/test/runtime/contended/HasNonStatic.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/contended/HasNonStatic.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
  * @bug     8015270
  * @summary \@Contended: fix multiple issues in the layout code
  *
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:-RestrictContended HasNonStatic
  */
 public class HasNonStatic {
--- a/hotspot/test/runtime/contended/Inheritance1.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/contended/Inheritance1.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
  * @bug     8012939
  * @summary \@Contended doesn't work correctly with inheritance
  *
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:-RestrictContended Inheritance1
  */
 public class Inheritance1 {
--- a/hotspot/test/runtime/contended/OopMaps.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/contended/OopMaps.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,7 @@
  * @bug     8015493
  * @summary \@Contended: fix multiple issues in the layout code
  *
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMaps
  */
 public class OopMaps {
--- a/hotspot/test/runtime/contended/OopMapsSameGroup.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,7 @@
  * @bug     8015272
  * @summary \@Contended within the same group to use the same oop map
  *
+ * @modules java.base/sun.misc
  * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMapsSameGroup
  */
 public class OopMapsSameGroup {
--- a/hotspot/test/runtime/contended/Options.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/contended/Options.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
  * @summary ContendedPaddingWidth should be range-checked
  *
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main Options
  */
 public class Options {
--- a/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/duplAttributes/DuplAttributesTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,8 @@
  * @bug 8040292
  * @library /testlibrary
  * @summary Throw exceptions when duplicate attributes are detected.
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main DuplAttributesTest
  */
 
--- a/hotspot/test/runtime/finalStatic/FinalStatic.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/finalStatic/FinalStatic.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test
  * @bug 8028553
  * @summary Test that VerifyError is not thrown when 'overriding' a static method.
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @run main FinalStatic
  */
 
--- a/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/lambda-features/TestConcreteClassWithAbstractMethod.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @test
  * @bug 8032010
  * @summary method lookup on an abstract method in a concrete class should be successful
+ * @modules java.base/jdk.internal.org.objectweb.asm
  * @run main TestConcreteClassWithAbstractMethod
  */
 
--- a/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/memory/LargePages/TestLargePageSizeInBytes.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @summary Tests that the flag -XX:LargePageSizeInBytes does not cause warnings on Solaris
  * @bug 8049536
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver TestLargePageSizeInBytes
  */
 
--- a/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/memory/LargePages/TestLargePagesFlags.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,8 @@
 /* @test TestLargePagesFlags
  * @summary Tests how large pages are choosen depending on the given large pages flag combinations.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main TestLargePagesFlags
  */
 
--- a/hotspot/test/runtime/memory/ReadFromNoaccessArea.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/memory/ReadFromNoaccessArea.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @summary Test that touching noaccess area in class ReservedHeapSpace results in SIGSEGV/ACCESS_VIOLATION
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build ReadFromNoaccessArea
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/memory/ReserveMemory.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/memory/ReserveMemory.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @bug 8012015
  * @summary Make sure reserved (but uncommitted) memory is not accessible
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build ReserveMemory
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/memory/RunUnitTestsConcurrently.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @summary Test launches unit tests inside vm concurrently
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build RunUnitTestsConcurrently
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/runtime/verifier/OverriderMsg.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/verifier/OverriderMsg.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,9 @@
  * @test OverriderMsg
  * @bug 8026894
  * @library /testlibrary
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
+ *          java.management
  * @compile -XDignore.symbol.file OverriderMsg.java
  * @run main/othervm OverriderMsg
  */
--- a/hotspot/test/runtime/verifier/TestANewArray.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/verifier/TestANewArray.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,9 @@
  * @test
  * @summary Test that anewarray bytecode is valid only if it specifies 255 or fewer dimensions.
  * @library /testlibrary
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
+ *          java.management
  * @compile -XDignore.symbol.file TestANewArray.java
  * @run main/othervm TestANewArray 49
  * @run main/othervm TestANewArray 50
--- a/hotspot/test/runtime/verifier/TestMultiANewArray.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/runtime/verifier/TestMultiANewArray.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,9 @@
  * @test TestMultiANewArray
  * @bug 8038076
  * @library /testlibrary
+ * @modules java.base/jdk.internal.org.objectweb.asm
+ *          java.base/sun.misc
+ *          java.management
  * @compile -XDignore.symbol.file TestMultiANewArray.java
  * @run main/othervm TestMultiANewArray 49
  * @run main/othervm TestMultiANewArray 50
--- a/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,11 @@
  * @bug 8054823
  * @summary Tests the setFlag and printFlag attach command
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.attach/sun.tools.attach
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.* AttachSetGetFlag
  * @run driver AttachSetGetFlag
  */
--- a/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/compiler/CodeCacheTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
  * @test CodeCacheTest
  * @bug 8054889
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng/othervm -XX:+SegmentedCodeCache CodeCacheTest
--- a/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/compiler/CodelistTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
  * @test CodelistTest
  * @bug 8054889
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @build MethodIdentifierParser
--- a/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/compiler/CompilerQueueTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
  * @test CompilerQueueTest
  * @bug 8054889
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @ignore 8069160
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
--- a/hotspot/test/serviceability/dcmd/framework/HelpTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/framework/HelpTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -33,6 +33,10 @@
  * @test
  * @summary Test of diagnostic command help (tests all DCMD executors)
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @ignore 8072440
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
--- a/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/framework/InvalidCommandTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -33,6 +33,10 @@
  * @test
  * @summary Test of invalid diagnostic command (tests all DCMD executors)
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @ignore 8072440
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
--- a/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/framework/VMVersionTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -34,6 +34,10 @@
  * @test
  * @summary Test of diagnostic command VM.version (tests all DCMD executors)
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @ignore 8072440
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
--- a/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/gc/ClassHistogramAllTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,10 @@
  * @test
  * @summary Test of diagnostic command GC.class_histogram -all=true
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @build ClassHistogramTest
--- a/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/gc/ClassHistogramTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -33,6 +33,10 @@
  * @test
  * @summary Test of diagnostic command GC.class_histogram
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng ClassHistogramTest
--- a/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpAllTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,10 @@
  * @test
  * @summary Test of diagnostic command GC.heap_dump -all=true
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @build HeapDumpTest
--- a/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/gc/HeapDumpTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -35,6 +35,10 @@
  * @test
  * @summary Test of diagnostic command GC.heap_dump
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng HeapDumpTest
--- a/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/gc/RunFinalizationTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -35,6 +35,10 @@
  * @test
  * @summary Test of diagnostic command GC.run_finalization
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng RunFinalizationTest
--- a/hotspot/test/serviceability/dcmd/gc/RunGCTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/gc/RunGCTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -37,6 +37,10 @@
  * @test
  * @summary Test of diagnostic command GC.run
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng/othervm -XX:+PrintGCDetails -Xloggc:RunGC.gclog -XX:-ExplicitGCInvokesConcurrent RunGCTest
--- a/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/thread/PrintConcurrentLocksTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,10 @@
  * @test
  * @summary Test of diagnostic command Thread.print -l=true
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @build PrintTest
--- a/hotspot/test/serviceability/dcmd/thread/PrintTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/thread/PrintTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -38,6 +38,10 @@
  * @test
  * @summary Test of diagnostic command Thread.print
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng PrintTest
--- a/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/vm/ClassHierarchyTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -25,6 +25,10 @@
  * @test
  * @summary Test of diagnostic command VM.class_hierarchy
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng ClassHierarchyTest
--- a/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/vm/ClassLoaderStatsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
  * @test
  * @summary Test of diagnostic command VM.classloader_stats
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng ClassLoaderStatsTest
--- a/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/vm/CommandLineTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -31,6 +31,10 @@
  * @test
  * @summary Test of diagnostic command VM.command_line
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+ThereShouldNotBeAnyVMOptionNamedLikeThis CommandLineTest
--- a/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/vm/DynLibsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -33,6 +33,10 @@
  * @test
  * @summary Test of VM.dynlib diagnostic command via MBean
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng DynLibsTest
--- a/hotspot/test/serviceability/dcmd/vm/FlagsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/vm/FlagsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -30,6 +30,10 @@
  * @test
  * @summary Test of diagnostic command VM.flags
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng/othervm -Xmx129m -XX:+PrintGC -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+ThereShouldNotBeAnyVMOptionNamedLikeThis_Right -XX:-TieredCompilation FlagsTest
--- a/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/vm/SystemPropertiesTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -31,6 +31,10 @@
  * @test
  * @summary Test of diagnostic command VM.system_properties
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng SystemPropertiesTest
--- a/hotspot/test/serviceability/dcmd/vm/UptimeTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/dcmd/vm/UptimeTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -35,6 +35,10 @@
  * @test
  * @summary Test of diagnostic command VM.uptime
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.*
  * @build com.oracle.java.testlibrary.dcmd.*
  * @run testng UptimeTest
--- a/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/jvmti/GetObjectSizeOverflow.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,11 @@
  * @test
  * @bug 8027230
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.instrument
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build ClassFileInstaller com.oracle.java.testlibrary.* GetObjectSizeOverflowAgent
  * @run main ClassFileInstaller GetObjectSizeOverflowAgent
  * @run main GetObjectSizeOverflow
--- a/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/jvmti/TestLambdaFormRetransformation.java	Wed Jul 05 20:27:20 2017 +0200
@@ -27,6 +27,10 @@
  * @bug 8008678
  * @summary JSR 292: constant pool reconstitution must support pseudo strings
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.instrument
+ *          java.management
+ *          jdk.jartool/sun.tools.jar
  * @compile -XDignore.symbol.file TestLambdaFormRetransformation.java
  * @run main TestLambdaFormRetransformation
  */
--- a/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/jvmti/TestRedefineWithUnresolvedClass.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,12 @@
  * @summary Redefine a class with an UnresolvedClass reference in the constant pool.
  * @bug 8035150
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.instrument
+ *          java.management
+ *          jdk.jartool/sun.tools.jar
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.* UnresolvedClassAgent
  * @run main TestRedefineWithUnresolvedClass
  */
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,10 @@
  * @bug 8028623
  * @summary Test hashing of extended characters in Serviceability Agent.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @ignore 8044416
  * @build com.oracle.java.testlibrary.*
  * @compile -encoding utf8 Test8028623.java
--- a/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/serviceability/sa/jmap-hprof/JMapHProfLargeHeapTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,10 @@
  * @key regression
  * @summary Regression test for hprof export issue due to large heaps (>2G)
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management/sun.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build com.oracle.java.testlibrary.* JMapHProfLargeHeapProc
  * @run main JMapHProfLargeHeapTest
  */
--- a/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/OutputAnalyzerReportingTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  *     such as printing additional diagnostic info
  *     (exit code, stdout, stderr, command line, etc.)
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import java.io.ByteArrayOutputStream;
--- a/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/OutputAnalyzerTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @summary Test the OutputAnalyzer utility class
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  */
 
 import com.oracle.java.testlibrary.OutputAnalyzer;
--- a/hotspot/test/testlibrary_tests/RandomGeneratorTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/RandomGeneratorTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @summary Verify correctnes of the random generator from Utility.java
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run driver RandomGeneratorTest SAME_SEED
  * @run driver RandomGeneratorTest NO_SEED
  * @run driver RandomGeneratorTest DIFFERENT_SEED
--- a/hotspot/test/testlibrary_tests/RedefineClassTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/RedefineClassTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
  * @test
  * @library /testlibrary
  * @summary Proof of concept test for RedefineClassHelper
+ * @modules java.compiler
+ *          java.instrument
+ *          jdk.jartool/sun.tools.jar
  * @build RedefineClassHelper
  * @run main RedefineClassHelper
  * @run main/othervm -javaagent:redefineagent.jar RedefineClassTest
--- a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,8 @@
  *          in com.oracle.java.testlibrary.Platform one and only one predicate
  *          evaluates to true.
  * @library /testlibrary
+ * @modules java.base/sun.misc
+ *          java.management
  * @run main TestMutuallyExclusivePlatformPredicates
  */
 public class TestMutuallyExclusivePlatformPredicates {
--- a/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/TestPlatformIsTieredSupported.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,6 +29,8 @@
  * @test
  * @summary Verifies that Platform::isTieredSupported returns correct value.
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management
  * @build TestPlatformIsTieredSupported
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/ctw/ClassesDirTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /../../test/lib /testlibrary/ctw/src
+ * @modules java.base/sun.misc
+ *          java.base/sun.reflect
+ *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
  * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/ctw/ClassesListTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,9 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /../../test/lib /testlibrary/ctw/src
+ * @modules java.base/sun.misc
+ *          java.base/sun.reflect
+ *          java.management
  * @build ClassFileInstaller sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
  * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/ctw/JarDirTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/ctw/JarDirTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,11 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /../../test/lib /testlibrary/ctw/src
+ * @modules java.base/sun.misc
+ *          java.base/sun.reflect
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
  * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/ctw/JarsTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/ctw/JarsTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,11 @@
  * @test
  * @bug 8012447
  * @library /testlibrary /../../test/lib /testlibrary/ctw/src
+ * @modules java.base/sun.misc
+ *          java.base/sun.reflect
+ *          java.compiler
+ *          java.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.tools.ctw.CompileTheWorld sun.hotspot.WhiteBox Foo Bar
  * @run main ClassFileInstaller sun.hotspot.WhiteBox Foo Bar
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/BooleanTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,10 @@
  * @test BooleanTest
  * @bug 8028756
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.compiler
+ *          java.management/sun.management
+ *          jdk.jvmstat/sun.jvmstat.monitor
  * @build BooleanTest ClassFileInstaller sun.hotspot.WhiteBox com.oracle.java.testlibrary.*
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/DoubleTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test DoubleTest
  * @bug 8028756
  * @library /testlibrary /../../test/lib
+ * @modules java.management/sun.management
  * @build DoubleTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/IntxTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test IntxTest
  * @bug 8028756
  * @library /testlibrary /../../test/lib
+ * @modules java.management/sun.management
  * @build IntxTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/SizeTTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test SizeTTest
  * @bug 8054823
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management/sun.management
  * @build SizeTTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/StringTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test StringTest
  * @bug 8028756
  * @library /testlibrary /../../test/lib
+ * @modules java.management/sun.management
  * @build StringTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/Uint64Test.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,7 @@
  * @test Uint64Test
  * @bug 8028756
  * @library /testlibrary /../../test/lib
+ * @modules java.management/sun.management
  * @build Uint64Test
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/hotspot/test/testlibrary_tests/whitebox/vm_flags/UintxTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test UintxTest
  * @bug 8028756
  * @library /testlibrary /../../test/lib
+ * @modules java.base/sun.misc
+ *          java.management/sun.management
  * @build UintxTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
--- a/jaxp/.hgtags	Wed Apr 08 13:12:48 2015 -0700
+++ b/jaxp/.hgtags	Wed Jul 05 20:27:20 2017 +0200
@@ -300,3 +300,4 @@
 2a460ce60ed47081f756f0cc0321d8e9ba7cac17 jdk9-b55
 139092a10dedd32bc1155e40c67a6ef682e39873 jdk9-b56
 2c417f7d7b0dc98e887474884aa39f974894f0c2 jdk9-b57
+270fb9a2dcb5ff3ef95da6d529fa35187026af0a jdk9-b58
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Wed Jul 05 20:27:20 2017 +0200
@@ -270,7 +270,7 @@
         if (Double.isNaN(start))
             return(EMPTYSTRING);
 
-        final int strlen = value.length();
+        final int strlen = getStringLength(value);
         int istart = (int)Math.round(start) - 1;
 
         if (istart > strlen)
@@ -278,6 +278,7 @@
         if (istart < 1)
             istart = 0;
         try {
+            istart = value.offsetByCodePoints(0, istart);
             return value.substring(istart);
         } catch (IndexOutOfBoundsException e) {
             runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
@@ -297,24 +298,30 @@
             return(EMPTYSTRING);
 
         int istart = (int)Math.round(start) - 1;
+        int ilength = (int)Math.round(length);
         final int isum;
         if (Double.isInfinite(length))
             isum = Integer.MAX_VALUE;
         else
-            isum = istart + (int)Math.round(length);
+            isum = istart + ilength;
 
-        final int strlen = value.length();
+        final int strlen = getStringLength(value);
         if (isum < 0 || istart > strlen)
                 return(EMPTYSTRING);
 
-        if (istart < 0)
+        if (istart < 0) {
+            ilength += istart;
             istart = 0;
+        }
 
         try {
-            if (isum > strlen)
+            istart = value.offsetByCodePoints(0, istart);
+            if (isum > strlen) {
                 return value.substring(istart);
-            else
-                return value.substring(istart, isum);
+            } else {
+                int offset = value.offsetByCodePoints(istart, ilength);
+                return value.substring(istart, offset);
+            }
         } catch (IndexOutOfBoundsException e) {
             runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
             return null;
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1417,7 +1417,7 @@
             // AttValue
             boolean isVC = !fStandalone  &&  (fSeenExternalDTD || fSeenExternalPE) ;
             scanAttributeValue(defaultVal, nonNormalizedDefaultVal, atName,
-            fAttributes, 0, isVC);
+            fAttributes, 0, isVC, elName);
         }
         return defaultType;
 
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1547,7 +1547,7 @@
 
         scanAttributeValue(tmpStr, fTempString2,
                 fAttributeQName.rawname, attributes,
-                attIndex, isVC);
+                attIndex, isVC, fCurrentElement.rawname);
 
         // content
         int oldLen = attributes.getLength();
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLNSDocumentScannerImpl.java	Wed Jul 05 20:27:20 2017 +0200
@@ -437,7 +437,7 @@
         XMLString tmpStr = getString();
         scanAttributeValue(tmpStr, fTempString2,
                 fAttributeQName.rawname, attributes,
-                attrIndex, isVC);
+                attrIndex, isVC, fCurrentElement.rawname);
 
         String value = null;
         //fTempString.toString();
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Wed Jul 05 20:27:20 2017 +0200
@@ -811,6 +811,7 @@
      * @param attrIndex The index of the attribute to use from the list.
      * @param checkEntities true if undeclared entities should be reported as VC violation,
      *                      false if undeclared entities should be reported as WFC violation.
+     * @param eleName The name of element to which this attribute belongs.
      *
      * <strong>Note:</strong> This method uses fStringBuffer2, anything in it
      * at the time of calling is lost.
@@ -819,13 +820,13 @@
             XMLString nonNormalizedValue,
             String atName,
             XMLAttributes attributes, int attrIndex,
-            boolean checkEntities)
+            boolean checkEntities, String eleName)
             throws IOException, XNIException {
         XMLStringBuffer stringBuffer = null;
         // quote
         int quote = fEntityScanner.peekChar();
         if (quote != '\'' && quote != '"') {
-            reportFatalError("OpenQuoteExpected", new Object[]{atName});
+            reportFatalError("OpenQuoteExpected", new Object[]{eleName, atName});
         }
 
         fEntityScanner.scanChar();
@@ -951,7 +952,7 @@
                     }
                 } else if (c == '<') {
                     reportFatalError("LessthanInAttValue",
-                            new Object[] { null, atName });
+                            new Object[] { eleName, atName });
                             fEntityScanner.scanChar();
                             if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) {
                                 fStringBuffer2.append((char)c);
@@ -987,7 +988,7 @@
                     }
                 } else if (c != -1 && isInvalidLiteral(c)) {
                     reportFatalError("InvalidCharInAttValue",
-                            new Object[] {Integer.toString(c, 16)});
+                            new Object[] {eleName, atName, Integer.toString(c, 16)});
                             fEntityScanner.scanChar();
                             if (entityDepth == fEntityDepth && fNeedNonNormalizedValue) {
                                 fStringBuffer2.append((char)c);
@@ -1016,7 +1017,7 @@
         // quote
         int cquote = fEntityScanner.scanChar();
         if (cquote != quote) {
-            reportFatalError("CloseQuoteExpected", new Object[]{atName});
+            reportFatalError("CloseQuoteExpected", new Object[]{eleName, atName});
         }
     } // scanAttributeValue()
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8073385.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+import java.util.Locale;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.DocumentBuilder;
+import org.xml.sax.SAXException;
+import org.xml.sax.InputSource;
+
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.assertTrue;
+
+/**
+ * @bug 8073385
+ * @summary test that invalid XML character exception string contains
+ *     information about character value, element and attribute names
+ */
+public class Bug8073385 {
+
+    private Locale defLoc;
+
+    @BeforeClass
+    private void setup() {
+        defLoc = Locale.getDefault();
+        Locale.setDefault(Locale.ENGLISH);
+    }
+
+    @AfterClass
+    private void cleanup() {
+        Locale.setDefault(defLoc);
+    }
+
+    @DataProvider(name = "illegalCharactersData")
+    public static Object[][] illegalCharactersData() {
+        return new Object[][]{
+            {0x00},
+            {0xFFFE},
+            {0xFFFF}
+        };
+    }
+
+    @Test(dataProvider = "illegalCharactersData")
+    public void test(int character) throws Exception {
+        // Construct the XML document as a String
+        int[] cps = new int[]{character};
+        String txt = new String(cps, 0, cps.length);
+        String inxml = "<topElement attTest=\'" + txt + "\'/>";
+        String exceptionText = "NO EXCEPTION OBSERVED";
+        String hexString = "0x" + Integer.toHexString(character);
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(false);
+        DocumentBuilder db = dbf.newDocumentBuilder();
+        InputSource isrc = new InputSource(new StringReader(inxml));
+
+        try {
+            db.parse(isrc);
+        } catch (SAXException e) {
+            exceptionText = e.toString();
+        }
+        System.out.println("Got Exception:" + exceptionText);
+        assertTrue(exceptionText.contains("attribute \"attTest\""));
+        assertTrue(exceptionText.contains("element is \"topElement\""));
+        assertTrue(exceptionText.contains("Unicode: " + hexString));
+    }
+}
--- a/jdk/.hgtags	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/.hgtags	Wed Jul 05 20:27:20 2017 +0200
@@ -300,3 +300,4 @@
 d49e247dade61f29f771f09b2105857492241156 jdk9-b55
 7969f7b6465e47ce4afa77670ca600b04c1d746c jdk9-b56
 c76339e86ea7da5d9ac7856f3fae9ef73eef04a2 jdk9-b57
+36fc65e80d811ee43aedfc69284224b86a403662 jdk9-b58
--- a/jdk/make/Makefile	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  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.
-#
-
-# Locate this Makefile
-ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), )
-  makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST))
-else
-  makefile_path := $(lastword $(MAKEFILE_LIST))
-endif
-repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path))
-
-# What is the name of this subsystem (langtools, corba, etc)?
-subsystem_name := $(notdir $(repo_dir))
-
-# Try to locate top-level makefile
-top_level_makefile := $(repo_dir)/../Makefile
-ifneq ($(wildcard $(top_level_makefile)), )
-  $(info Will run $(subsystem_name) target on top-level Makefile)
-  $(info WARNING: This is a non-recommended way of building!)
-  $(info ===================================================)
-else
-  $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?)
-  $(error Build from top-level Makefile instead)
-endif
-
-all:
-	@$(MAKE) -f $(top_level_makefile) $(subsystem_name)
--- a/jdk/make/copy/Copy-java.base.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/copy/Copy-java.base.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -98,6 +98,8 @@
   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
 else
   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
+  # Allow override by ALT_JVMCFG_SRC if it exists
+  JVMCFG_SRC := $(if $(wildcard $(ALT_JVMCFG_SRC)),$(ALT_JVMCFG_SRC),$(JVMCFG_SRC)) 
 endif
 JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
--- a/jdk/make/data/tzdata/VERSION	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/data/tzdata/VERSION	Wed Jul 05 20:27:20 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2015a
+tzdata2015b
--- a/jdk/make/data/tzdata/asia	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/data/tzdata/asia	Wed Jul 05 20:27:20 2017 +0200
@@ -1927,6 +1927,13 @@
 # was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
 # this is almost surely wrong.
 
+# From Ganbold Tsagaankhuu (2015-03-10):
+# It seems like yesterday Mongolian Government meeting has concluded to use
+# daylight saving time in Mongolia....  Starting at 2:00AM of last Saturday of
+# March 2015, daylight saving time starts.  And 00:00AM of last Saturday of
+# September daylight saving time ends.  Source:
+# http://zasag.mn/news/view/8969
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mongol	1983	1984	-	Apr	1	0:00	1:00	S
 Rule	Mongol	1983	only	-	Oct	1	0:00	0	-
@@ -1947,6 +1954,8 @@
 Rule	Mongol	2001	only	-	Apr	lastSat	2:00	1:00	S
 Rule	Mongol	2001	2006	-	Sep	lastSat	2:00	0	-
 Rule	Mongol	2002	2006	-	Mar	lastSat	2:00	1:00	S
+Rule	Mongol	2015	max	-	Mar	lastSat	2:00	1:00	S
+Rule	Mongol	2015	max	-	Sep	lastSat	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
@@ -2365,13 +2374,19 @@
 # official source...:
 # http://www.palestinecabinet.gov.ps/ar/Views/ViewDetails.aspx?pid=1252
 
-# From Paul Eggert (2013-09-24):
-# For future dates, guess the last Thursday in March at 24:00 through
-# the first Friday on or after September 21 at 00:00.  This is consistent with
-# the predictions in today's editions of the following URLs,
-# which are for Gaza and Hebron respectively:
-# http://www.timeanddate.com/worldclock/timezone.html?n=702
-# http://www.timeanddate.com/worldclock/timezone.html?n=2364
+# From Steffen Thorsen (2015-03-03):
+# Sources such as http://www.alquds.com/news/article/view/id/548257
+# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# start DST on 2015-03-28 00:00 which is one day later than expected.
+#
+# From Paul Eggert (2015-03-03):
+# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# says that the fall 2014 transition was Oct 23 at 24:00.
+# For future dates, guess the last Friday in March at 24:00 through
+# the first Friday on or after October 21 at 00:00.  This is consistent with
+# the predictions in today's editions of the following URLs:
+# http://www.timeanddate.com/time/change/gaza-strip/gaza
+# http://www.timeanddate.com/time/change/west-bank/hebron
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -2397,9 +2412,11 @@
 Rule Palestine	2011	only	-	Aug	 1	0:00	0	-
 Rule Palestine	2011	only	-	Aug	30	0:00	1:00	S
 Rule Palestine	2011	only	-	Sep	30	0:00	0	-
-Rule Palestine	2012	max	-	Mar	lastThu	24:00	1:00	S
+Rule Palestine	2012	2014	-	Mar	lastThu	24:00	1:00	S
 Rule Palestine	2012	only	-	Sep	21	1:00	0	-
-Rule Palestine	2013	max	-	Sep	Fri>=21	0:00	0	-
+Rule Palestine	2013	only	-	Sep	Fri>=21	0:00	0	-
+Rule Palestine	2014	max	-	Oct	Fri>=21	0:00	0	-
+Rule Palestine	2015	max	-	Mar	lastFri	24:00	1:00	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct
--- a/jdk/make/data/tzdata/australasia	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/data/tzdata/australasia	Wed Jul 05 20:27:20 2017 +0200
@@ -396,6 +396,7 @@
 			 9:39:00 -	LMT	1901        # Agana
 			10:00	-	GST	2000 Dec 23 # Guam
 			10:00	-	ChST	# Chamorro Standard Time
+Link Pacific/Guam Pacific/Saipan # N Mariana Is
 
 # Kiribati
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -411,12 +412,7 @@
 			 14:00	-	LINT
 
 # N Mariana Is
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Pacific/Saipan	-14:17:00 -	LMT	1844 Dec 31
-			 9:43:00 -	LMT	1901
-			 9:00	-	MPT	1969 Oct    # N Mariana Is Time
-			10:00	-	MPT	2000 Dec 23
-			10:00	-	ChST	# Chamorro Standard Time
+# See Pacific/Guam.
 
 # Marshall Is
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -586,6 +582,7 @@
 			-11:00	-	NST	1967 Apr    # N=Nome
 			-11:00	-	BST	1983 Nov 30 # B=Bering
 			-11:00	-	SST	            # S=Samoa
+Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
 
 # Samoa (formerly and also known as Western Samoa)
 
@@ -767,23 +764,7 @@
 # uninhabited
 
 # Midway
-#
-# From Mark Brader (2005-01-23):
-# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
-# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
-# reproduced a Pan American Airways timetable from 1936, for their weekly
-# "Orient Express" flights between San Francisco and Manila, and connecting
-# flights to Chicago and the US East Coast.  As it uses some time zone
-# designations that I've never seen before:....
-# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I.   H.L.T. Ar. 5:30P Sun.
-#  "   3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A  "
-#
-Zone Pacific/Midway	-11:49:28 -	LMT	1901
-			-11:00	-	NST	1956 Jun  3
-			-11:00	1:00	NDT	1956 Sep  2
-			-11:00	-	NST	1967 Apr    # N=Nome
-			-11:00	-	BST	1983 Nov 30 # B=Bering
-			-11:00	-	SST	            # S=Samoa
+# See Pacific/Pago_Pago.
 
 # Palmyra
 # uninhabited since World War II; was probably like Pacific/Kiritimati
--- a/jdk/make/data/tzdata/europe	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/data/tzdata/europe	Wed Jul 05 20:27:20 2017 +0200
@@ -2423,7 +2423,7 @@
 			 4:00	Russia	VOL%sT	1989 Mar 26  2:00s # Volgograd T
 			 3:00	Russia	VOL%sT	1991 Mar 31  2:00s
 			 4:00	-	VOLT	1992 Mar 29  2:00s
-			 3:00	Russia	MSK	2011 Mar 27  2:00s
+			 3:00	Russia	MSK/MSD	2011 Mar 27  2:00s
 			 4:00	-	MSK	2014 Oct 26  2:00s
 			 3:00	-	MSK
 
--- a/jdk/make/data/tzdata/northamerica	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/data/tzdata/northamerica	Wed Jul 05 20:27:20 2017 +0200
@@ -2335,8 +2335,24 @@
 # "...the new time zone will come into effect at two o'clock on the first Sunday
 # of February, when we will have to advance the clock one hour from its current
 # time..."
+# Also, the new zone will not use DST.
 #
-# Also, the new zone will not use DST.
+# From Carlos Raúl Perasso (2015-02-02):
+# The decree that modifies the Mexican Hour System Law has finally
+# been published at the Diario Oficial de la Federación
+# http://www.dof.gob.mx/nota_detalle.php?codigo=5380123&fecha=31/01/2015
+# It establishes 5 zones for Mexico:
+# 1- Zona Centro (Central Zone): Corresponds to longitude 90 W,
+#    includes most of Mexico, excluding what's mentioned below.
+# 2- Zona Pacífico (Pacific Zone): Longitude 105 W, includes the
+#    states of Baja California Sur; Chihuahua; Nayarit (excluding Bahía
+#    de Banderas which lies in Central Zone); Sinaloa and Sonora.
+# 3- Zona Noroeste (Northwest Zone): Longitude 120 W, includes the
+#    state of Baja California.
+# 4- Zona Sureste (Southeast Zone): Longitude 75 W, includes the state
+#    of Quintana Roo.
+# 5- The islands, reefs and keys shall take their timezone from the
+#    longitude they are located at.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mexico	1939	only	-	Feb	5	0:00	1:00	D
@@ -2531,14 +2547,9 @@
 ###############################################################################
 
 # Anguilla
+# Antigua and Barbuda
 # See America/Port_of_Spain.
 
-# Antigua and Barbuda
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	America/Antigua	-4:07:12 -	LMT	1912 Mar 2
-			-5:00	-	EST	1951
-			-4:00	-	AST
-
 # Bahamas
 #
 # For 1899 Milne gives -5:09:29.5; round that.
@@ -2604,10 +2615,7 @@
 			-4:00	US	A%sT
 
 # Cayman Is
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	America/Cayman	-5:25:32 -	LMT	1890     # Georgetown
-			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
-			-5:00	-	EST
+# See America/Panama.
 
 # Costa Rica
 
@@ -3130,6 +3138,7 @@
 Zone	America/Panama	-5:18:08 -	LMT	1890
 			-5:19:36 -	CMT	1908 Apr 22 # Colón Mean Time
 			-5:00	-	EST
+Link America/Panama America/Cayman
 
 # Puerto Rico
 # There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
--- a/jdk/make/data/tzdata/southamerica	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/data/tzdata/southamerica	Wed Jul 05 20:27:20 2017 +0200
@@ -1229,10 +1229,13 @@
 # DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
 # http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
 
-# From Juan Correa (2015-01-28):
-# ... today the Ministry of Energy announced that Chile will drop DST, will keep
-# "summer time" (UTC -3 / UTC -5) all year round....
-# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+# From Eduardo Romero Urra (2015-03-03):
+# Today has been published officially that Chile will use the DST time
+# permanently until March 25 of 2017
+# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg
+#
+# From Paul Eggert (2015-03-03):
+# For now, assume that the extension will persist indefinitely.
 
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
@@ -1291,7 +1294,7 @@
 			-3:00	-	CLT
 Zone Pacific/Easter	-7:17:44 -	LMT	1890
 			-7:17:28 -	EMT	1932 Sep    # Easter Mean Time
-			-7:00	Chile	EAS%sT	1982 Mar 13 3:00u # Easter Time
+			-7:00	Chile	EAS%sT	1982 Mar 14 3:00u # Easter Time
 			-6:00	Chile	EAS%sT	2015 Apr 26 3:00u
 			-5:00	-	EAST
 #
@@ -1626,6 +1629,7 @@
 
 # These all agree with Trinidad and Tobago since 1970.
 Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Antigua
 Link America/Port_of_Spain America/Dominica
 Link America/Port_of_Spain America/Grenada
 Link America/Port_of_Spain America/Guadeloupe
--- a/jdk/make/lib/Awt2dLibraries.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/lib/Awt2dLibraries.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -236,10 +236,6 @@
   LIBAWT_VERSIONINFO_RESOURCE := $(JDK_TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
 endif
 
-ifeq ($(MILESTONE), internal)
-  LIBAWT_CFLAGS += -DINTERNAL_BUILD
-endif
-
 LIBAWT_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt/mapfile-vers
 ifeq ($(OPENJDK_TARGET_OS), linux)
   LIBAWT_MAPFILE :=
@@ -347,10 +343,6 @@
       endif
     endif
 
-    ifeq ($(MILESTONE), internal)
-      LIBAWT_XAWT_CFLAGS += -DINTERNAL_BUILD
-    endif
-
     LIBAWT_XAWT_LDFLAGS_SUFFIX := $(LIBM) -lawt -lXext -lX11 -lXrender $(LIBDL) -lXtst -lXi -ljava -ljvm -lc
 
     ifeq ($(OPENJDK_TARGET_OS), linux)
--- a/jdk/make/lib/CoreLibraries.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/lib/CoreLibraries.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -269,7 +269,7 @@
 LIBJLI_EXCLUDE_FILES += $(notdir $(LIBJLI_EXCLUDE_ERGO))
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c
+  LIBJLI_EXCLUDE_FILES += java_md_solinux.c ergo.c ergo_i586.c
 
   BUILD_LIBJLI_java_md_macosx.c_CFLAGS := -x objective-c
   BUILD_LIBJLI_STATIC_java_md_macosx.c_CFLAGS := -x objective-c
@@ -317,12 +317,7 @@
     LANG := C, \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(LIBJLI_CFLAGS), \
-    DISABLED_WARNINGS_gcc := pointer-to-int-cast sign-compare format-nonliteral \
-        parentheses, \
-    DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
-        int-conversion, \
-    DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION E_NEWLINE_NOT_LAST, \
-    DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
+    DISABLED_WARNINGS_solstudio := E_ASM_DISABLES_OPTIMIZATION, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjli/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -371,7 +366,6 @@
       LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
-      DISABLED_WARNINGS_microsoft := 4244 4047 4267, \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
@@ -392,8 +386,6 @@
       LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
-      DISABLED_WARNINGS_clang := implicit-function-declaration parentheses \
-          int-conversion, \
       LDFLAGS := -nostdlib -r, \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
--- a/jdk/make/mapfiles/libjava/reorder-sparc	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/mapfiles/libjava/reorder-sparc	Wed Jul 05 20:27:20 2017 +0200
@@ -1,7 +1,6 @@
 data = R0x2000;
 text = LOAD ?RXO;
 # Test Null
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
 text: .text%JNI_OnLoad;
 text: .text%Canonicalize;
 text: .text%canonicalize;
@@ -38,10 +37,9 @@
 text: .text%Java_java_lang_System_identityHashCode;
 text: .text%Java_sun_misc_Signal_findSignal;
 text: .text%Java_sun_misc_Signal_handle0;
-text: .text%Java_java_io_FileSystem_getFileSystem;
 text: .text%JNU_NewObjectByName;
 text: .text%Java_java_io_UnixFileSystem_initIDs;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
 text: .text%JNU_GetStringPlatformChars;
 text: .text%JNU_ReleaseStringPlatformChars;
 text: .text%Java_java_io_FileInputStream_open0;
@@ -52,27 +50,25 @@
 text: .text%Java_java_io_FileInputStream_close0;
 text: .text%Java_java_lang_System_mapLibraryName;
 text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%statMode: OUTPUTDIR/UnixFileSystem_md.o;
 text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
-text: .text%Java_java_lang_Compiler_registerNatives;
 text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
 text: .text%Java_java_io_UnixFileSystem_list;
 text: .text%JNU_ClassString;
 text: .text%JNU_CopyObjectArray;
 text: .text%Java_java_lang_String_intern;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
 text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
 text: .text%Java_java_lang_Throwable_fillInStackTrace;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
 text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
 text: .text%Java_java_io_UnixFileSystem_getLength;
 text: .text%Java_java_lang_ClassLoader_defineClass0;
 text: .text%VerifyClassCodes;
 # Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
 # Test Hello
 text: .text%Java_java_io_FileOutputStream_writeBytes;
 text: .text%writeBytes;
@@ -91,9 +87,7 @@
 text: .text%JNU_CallMethodByName;
 text: .text%JNU_CallMethodByNameV;
 text: .text%Java_java_io_UnixFileSystem_createDirectory;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
 text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
 # Test LoadJFrame
 text: .text%Java_sun_reflect_NativeMethodAccessorImpl_invoke0;
 text: .text%Java_java_lang_Class_isInstance;
--- a/jdk/make/mapfiles/libjava/reorder-sparcv9	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/mapfiles/libjava/reorder-sparcv9	Wed Jul 05 20:27:20 2017 +0200
@@ -1,7 +1,6 @@
 data = R0x2000;
 text = LOAD ?RXO;
 # Test Null
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
 text: .text%JNI_OnLoad;
 text: .text%Canonicalize;
 text: .text%canonicalize;
@@ -30,9 +29,9 @@
 text: .text%Java_sun_reflect_Reflection_getCallerClass__I;
 text: .text%Java_java_lang_Class_forName0;
 text: .text%Java_java_lang_String_intern;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
 text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
 text: .text%VerifyClassCodes;
 text: .text%Java_java_lang_Throwable_fillInStackTrace;
@@ -41,10 +40,9 @@
 text: .text%Java_java_lang_System_identityHashCode;
 text: .text%Java_sun_misc_Signal_findSignal;
 text: .text%Java_sun_misc_Signal_handle0;
-text: .text%Java_java_io_FileSystem_getFileSystem;
 text: .text%JNU_NewObjectByName;
 text: .text%Java_java_io_UnixFileSystem_initIDs;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
 text: .text%JNU_GetStringPlatformChars;
 text: .text%JNU_ReleaseStringPlatformChars;
 text: .text%Java_java_io_FileInputStream_open0;
@@ -53,13 +51,11 @@
 text: .text%readBytes;
 text: .text%Java_java_io_FileInputStream_available;
 text: .text%Java_java_io_FileInputStream_close0;
-text: .text%Java_java_lang_Compiler_registerNatives;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
 text: .text%Java_java_io_UnixFileSystem_list;
 text: .text%JNU_ClassString;
 text: .text%JNU_CopyObjectArray;
 text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%statMode: OUTPUTDIR/UnixFileSystem_md.o;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
 text: .text%Java_java_lang_System_mapLibraryName;
 text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
@@ -68,7 +64,7 @@
 text: .text%Java_java_lang_Object_getClass;
 text: .text%Java_java_lang_ClassLoader_defineClass0;
 # Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
 # Test Hello
 text: .text%Java_java_io_FileOutputStream_writeBytes;
 text: .text%writeBytes;
@@ -88,9 +84,7 @@
 text: .text%JNU_CallMethodByNameV;
 text: .text%Java_java_io_UnixFileSystem_createDirectory;
 text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
 text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
 # Test LoadJFrame
 text: .text%Java_java_lang_Class_isAssignableFrom;
 text: .text%Java_java_lang_Class_isInstance;
--- a/jdk/make/mapfiles/libjava/reorder-x86	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/mapfiles/libjava/reorder-x86	Wed Jul 05 20:27:20 2017 +0200
@@ -2,7 +2,6 @@
 text = LOAD ?RXO;
 # Test Null
 text: .text%_init;
-text: .text%init64IO: OUTPUTDIR/UnixFileSystem_md.o;
 text: .text%JNI_OnLoad;
 text: .text%Canonicalize;
 text: .text%canonicalize;
@@ -36,8 +35,6 @@
 text: .text%Java_java_lang_Throwable_fillInStackTrace;
 text: .text%Java_java_lang_System_setOut0;
 text: .text%Java_java_lang_System_setErr0;
-text: .text%Java_java_lang_Compiler_registerNatives;
-text: .text%Java_java_io_FileSystem_getFileSystem;
 text: .text%JNU_NewObjectByName;
 text: .text%Java_java_io_UnixFileSystem_initIDs;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2;
@@ -46,17 +43,17 @@
 text: .text%JNU_ReleaseStringPlatformChars;
 text: .text%JNU_ClassString;
 text: .text%JNU_CopyObjectArray;
-text: .text%Java_java_io_UnixFileSystem_canonicalize;
+text: .text%Java_java_io_UnixFileSystem_canonicalize0;
 text: .text%Java_java_io_UnixFileSystem_getBooleanAttributes0;
-text: .text%Java_java_lang_ClassLoader_findLoadedClass;
+text: .text%Java_java_lang_ClassLoader_findLoadedClass0;
 text: .text%Java_java_lang_ClassLoader_findBootstrapClass;
 text: .text%Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedExceptionAction_2Ljava_security_AccessControlContext_2;
 text: .text%Java_java_lang_System_mapLibraryName;
 text: .text%cpchars: OUTPUTDIR/System.o;
 text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_load;
 text: .text%Java_java_lang_ClassLoader_00024NativeLibrary_find;
-text: .text%Java_java_lang_Float_floatToIntBits;
-text: .text%Java_java_lang_Double_doubleToLongBits;
+text: .text%Java_java_lang_Float_floatToRawIntBits;
+text: .text%Java_java_lang_Double_doubleToRawLongBits;
 text: .text%Java_java_io_FileInputStream_open0;
 text: .text%fileOpen;
 text: .text%Java_java_io_UnixFileSystem_getLength;
@@ -67,7 +64,7 @@
 text: .text%Java_java_lang_ClassLoader_defineClass0;
 text: .text%VerifyClassCodes;
 # Test Exit
-text: .text%Java_java_lang_Shutdown_halt;
+text: .text%Java_java_lang_Shutdown_halt0;
 # Test Hello
 text: .text%Java_java_io_FileOutputStream_writeBytes;
 text: .text%writeBytes;
@@ -93,9 +90,7 @@
 text: .text%Java_java_io_FileOutputStream_open0;
 text: .text%Java_java_io_UnixFileSystem_createDirectory;
 text: .text%Java_java_io_UnixFileSystem_getLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_lockFile0;
 text: .text%Java_java_io_UnixFileSystem_setLastModifiedTime;
-text: .text%Java_java_util_prefs_FileSystemPreferences_unlockFile0;
 text: .text%Java_java_io_FileOutputStream_close0;
 text: .text%Java_java_util_logging_FileHandler_unlockFile;
 # Test LoadJFrame
--- a/jdk/make/mapfiles/libzip/reorder-sparcv9	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/mapfiles/libzip/reorder-sparcv9	Wed Jul 05 20:27:20 2017 +0200
@@ -12,7 +12,6 @@
 text: .text%ZIP_FindEntry;
 text: .text%ZIP_GetEntry;
 text: .text%ZIP_Lock;
-text: .text%readLOC: OUTPUTDIR/zip_util.o;
 text: .text%ZIP_Unlock;
 text: .text%ZIP_FreeEntry;
 text: .text%Java_java_util_zip_ZipFile_initIDs;
@@ -37,7 +36,6 @@
 text: .text%inflate;
 text: .text%Java_java_util_zip_ZipFile_read;
 text: .text%ZIP_Read;
-text: .text%huft_build: OUTPUTDIR/inftrees.o;
 text: .text%zcfree;
 text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
 text: .text%ZIP_ReadEntry;
--- a/jdk/make/mapfiles/libzip/reorder-x86	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/make/mapfiles/libzip/reorder-x86	Wed Jul 05 20:27:20 2017 +0200
@@ -13,7 +13,6 @@
 text: .text%ZIP_FindEntry;
 text: .text%ZIP_GetEntry;
 text: .text%ZIP_Lock;
-text: .text%readLOC: OUTPUTDIR/zip_util.o;
 text: .text%ZIP_Unlock;
 text: .text%ZIP_FreeEntry;
 text: .text%Java_java_util_zip_ZipFile_initIDs;
@@ -38,7 +37,6 @@
 text: .text%inflate;
 text: .text%Java_java_util_zip_ZipFile_read;
 text: .text%ZIP_Read;
-text: .text%huft_build: OUTPUTDIR/inftrees.o;
 text: .text%zcfree;
 text: .text%Java_java_util_jar_JarFile_getMetaInfEntryNames;
 text: .text%ZIP_ReadEntry;
--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c	Wed Jul 05 20:27:20 2017 +0200
@@ -852,7 +852,7 @@
     if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
       void * tmp;
       pthread_join(tid, &tmp);
-      rslt = (int)tmp;
+      rslt = (int)(intptr_t)tmp;
     } else {
      /*
       * Continue execution in current thread if for some reason (e.g. out of
--- a/jdk/src/java.base/share/classes/java/io/ObjectStreamException.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamException.java	Wed Jul 05 20:27:20 2017 +0200
@@ -38,10 +38,10 @@
     /**
      * Create an ObjectStreamException with the specified argument.
      *
-     * @param classname the detailed message for the exception
+     * @param message the detailed message for the exception
      */
-    protected ObjectStreamException(String classname) {
-        super(classname);
+    protected ObjectStreamException(String message) {
+        super(message);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/net/ProtocolException.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/net/ProtocolException.java	Wed Jul 05 20:27:20 2017 +0200
@@ -42,10 +42,10 @@
      * Constructs a new {@code ProtocolException} with the
      * specified detail message.
      *
-     * @param   host   the detail message.
+     * @param   message   the detail message.
      */
-    public ProtocolException(String host) {
-        super(host);
+    public ProtocolException(String message) {
+        super(message);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/net/UnknownHostException.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/net/UnknownHostException.java	Wed Jul 05 20:27:20 2017 +0200
@@ -41,10 +41,10 @@
      * Constructs a new {@code UnknownHostException} with the
      * specified detail message.
      *
-     * @param   host   the detail message.
+     * @param   message   the detail message.
      */
-    public UnknownHostException(String host) {
-        super(host);
+    public UnknownHostException(String message) {
+        super(message);
     }
 
     /**
--- a/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/time/chrono/HijrahChronology.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -478,7 +478,6 @@
         if (prolepticYear < getMinimumYear() || prolepticYear > getMaximumYear()) {
             return false;
         }
-        int epochMonth = yearToEpochMonth((int) prolepticYear);
         int len = getYearLength((int) prolepticYear);
         return (len > 354);
     }
@@ -659,7 +658,7 @@
     }
 
     /**
-     * Return the maximum supported Hijrah ear.
+     * Return the maximum supported Hijrah year.
      *
      * @return the minimum
      */
--- a/jdk/src/java.base/share/classes/java/util/Calendar.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Calendar.java	Wed Jul 05 20:27:20 2017 +0200
@@ -2083,17 +2083,33 @@
             return null;
         }
 
+        String calendarType = getCalendarType();
+        int fieldValue = get(field);
         // the standalone and narrow styles are supported only through CalendarDataProviders.
-        if (isStandaloneStyle(style) || isNarrowStyle(style)) {
-            return CalendarDataUtility.retrieveFieldValueName(getCalendarType(),
-                                                              field, get(field),
-                                                              style, locale);
+        if (isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+            String val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+                                                                    field, fieldValue,
+                                                                    style, locale);
+            // Perform fallback here to follow the CLDR rules
+            if (val == null) {
+                if (isNarrowFormatStyle(style)) {
+                    val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+                                                                     field, fieldValue,
+                                                                     toStandaloneStyle(style),
+                                                                     locale);
+                } else if (isStandaloneStyle(style)) {
+                    val = CalendarDataUtility.retrieveFieldValueName(calendarType,
+                                                                     field, fieldValue,
+                                                                     getBaseStyle(style),
+                                                                     locale);
+                }
+            }
+            return val;
         }
 
         DateFormatSymbols symbols = DateFormatSymbols.getInstance(locale);
         String[] strings = getFieldStrings(field, style, symbols);
         if (strings != null) {
-            int fieldValue = get(field);
             if (fieldValue < strings.length) {
                 return strings[fieldValue];
             }
@@ -2155,10 +2171,26 @@
                                     ERA_MASK|MONTH_MASK|DAY_OF_WEEK_MASK|AM_PM_MASK)) {
             return null;
         }
-        if (style == ALL_STYLES || isStandaloneStyle(style)) {
-            return CalendarDataUtility.retrieveFieldValueNames(getCalendarType(), field, style, locale);
+
+        String calendarType = getCalendarType();
+        if (style == ALL_STYLES || isStandaloneStyle(style) || isNarrowFormatStyle(style)) {
+            Map<String, Integer> map;
+            map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field, style, locale);
+
+            // Perform fallback here to follow the CLDR rules
+            if (map == null) {
+                if (isNarrowFormatStyle(style)) {
+                    map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
+                                                                      toStandaloneStyle(style), locale);
+                } else if (style != ALL_STYLES) {
+                    map = CalendarDataUtility.retrieveFieldValueNames(calendarType, field,
+                                                                      getBaseStyle(style), locale);
+                }
+            }
+            return map;
         }
-        // SHORT, LONG, or NARROW
+
+        // SHORT or LONG
         return getDisplayNamesImpl(field, style, locale);
     }
 
@@ -2544,14 +2576,22 @@
         return style & ~STANDALONE_MASK;
     }
 
-    boolean isStandaloneStyle(int style) {
+    private int toStandaloneStyle(int style) {
+        return style | STANDALONE_MASK;
+    }
+
+    private boolean isStandaloneStyle(int style) {
         return (style & STANDALONE_MASK) != 0;
     }
 
-    boolean isNarrowStyle(int style) {
+    private boolean isNarrowStyle(int style) {
         return style == NARROW_FORMAT || style == NARROW_STANDALONE;
     }
 
+    private boolean isNarrowFormatStyle(int style) {
+        return style == NARROW_FORMAT;
+    }
+
     /**
      * Returns the pseudo-time-stamp for two fields, given their
      * individual pseudo-time-stamps.  If either of the fields
--- a/jdk/src/java.base/share/classes/java/util/HashMap.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/HashMap.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1082,6 +1082,16 @@
         return null;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link ConcurrentModificationException} if it is detected that the
+     * mapping function modifies this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * mapping function modified this map
+     */
     @Override
     public V computeIfAbsent(K key,
                              Function<? super K, ? extends V> mappingFunction) {
@@ -1115,7 +1125,9 @@
                 return oldValue;
             }
         }
+        int mc = modCount;
         V v = mappingFunction.apply(key);
+        if (mc != modCount) { throw new ConcurrentModificationException(); }
         if (v == null) {
             return null;
         } else if (old != null) {
@@ -1130,12 +1142,23 @@
             if (binCount >= TREEIFY_THRESHOLD - 1)
                 treeifyBin(tab, hash);
         }
-        ++modCount;
+        modCount = mc + 1;
         ++size;
         afterNodeInsertion(true);
         return v;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link ConcurrentModificationException} if it is detected that the
+     * remapping function modifies this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * remapping function modified this map
+     */
+    @Override
     public V computeIfPresent(K key,
                               BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         if (remappingFunction == null)
@@ -1144,7 +1167,9 @@
         int hash = hash(key);
         if ((e = getNode(hash, key)) != null &&
             (oldValue = e.value) != null) {
+            int mc = modCount;
             V v = remappingFunction.apply(key, oldValue);
+            if (mc != modCount) { throw new ConcurrentModificationException(); }
             if (v != null) {
                 e.value = v;
                 afterNodeAccess(e);
@@ -1156,6 +1181,16 @@
         return null;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link ConcurrentModificationException} if it is detected that the
+     * remapping function modifies this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * remapping function modified this map
+     */
     @Override
     public V compute(K key,
                      BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
@@ -1185,7 +1220,9 @@
             }
         }
         V oldValue = (old == null) ? null : old.value;
+        int mc = modCount;
         V v = remappingFunction.apply(key, oldValue);
+        if (mc != modCount) { throw new ConcurrentModificationException(); }
         if (old != null) {
             if (v != null) {
                 old.value = v;
@@ -1202,13 +1239,23 @@
                 if (binCount >= TREEIFY_THRESHOLD - 1)
                     treeifyBin(tab, hash);
             }
-            ++modCount;
+            modCount = mc + 1;
             ++size;
             afterNodeInsertion(true);
         }
         return v;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link ConcurrentModificationException} if it is detected that the
+     * remapping function modifies this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * remapping function modified this map
+     */
     @Override
     public V merge(K key, V value,
                    BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
@@ -1241,10 +1288,15 @@
         }
         if (old != null) {
             V v;
-            if (old.value != null)
+            if (old.value != null) {
+                int mc = modCount;
                 v = remappingFunction.apply(old.value, value);
-            else
+                if (mc != modCount) {
+                    throw new ConcurrentModificationException();
+                }
+            } else {
                 v = value;
+            }
             if (v != null) {
                 old.value = v;
                 afterNodeAccess(old);
--- a/jdk/src/java.base/share/classes/java/util/Hashtable.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Hashtable.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1000,6 +1000,16 @@
         return null;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link java.util.ConcurrentModificationException} if the mapping
+     * function modified this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * mapping function modified this map
+     */
     @Override
     public synchronized V computeIfAbsent(K key, Function<? super K, ? extends V> mappingFunction) {
         Objects.requireNonNull(mappingFunction);
@@ -1016,7 +1026,9 @@
             }
         }
 
+        int mc = modCount;
         V newValue = mappingFunction.apply(key);
+        if (mc != modCount) { throw new ConcurrentModificationException(); }
         if (newValue != null) {
             addEntry(hash, key, newValue, index);
         }
@@ -1024,6 +1036,16 @@
         return newValue;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link java.util.ConcurrentModificationException} if the remapping
+     * function modified this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * remapping function modified this map
+     */
     @Override
     public synchronized V computeIfPresent(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
@@ -1035,14 +1057,18 @@
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
             if (e.hash == hash && e.key.equals(key)) {
+                int mc = modCount;
                 V newValue = remappingFunction.apply(key, e.value);
+                if (mc != modCount) {
+                    throw new ConcurrentModificationException();
+                }
                 if (newValue == null) {
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
-                    modCount++;
+                    modCount = mc + 1;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1052,7 +1078,16 @@
         }
         return null;
     }
-
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link java.util.ConcurrentModificationException} if the remapping
+     * function modified this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * remapping function modified this map
+     */
     @Override
     public synchronized V compute(K key, BiFunction<? super K, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
@@ -1064,14 +1099,18 @@
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
             if (e.hash == hash && Objects.equals(e.key, key)) {
+                int mc = modCount;
                 V newValue = remappingFunction.apply(key, e.value);
+                if (mc != modCount) {
+                    throw new ConcurrentModificationException();
+                }
                 if (newValue == null) {
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
-                    modCount++;
+                    modCount = mc + 1;
                     count--;
                 } else {
                     e.value = newValue;
@@ -1080,7 +1119,9 @@
             }
         }
 
+        int mc = modCount;
         V newValue = remappingFunction.apply(key, null);
+        if (mc != modCount) { throw new ConcurrentModificationException(); }
         if (newValue != null) {
             addEntry(hash, key, newValue, index);
         }
@@ -1088,6 +1129,16 @@
         return newValue;
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This method will, on a best-effort basis, throw a
+     * {@link java.util.ConcurrentModificationException} if the remapping
+     * function modified this map during computation.
+     *
+     * @throws ConcurrentModificationException if it is detected that the
+     * remapping function modified this map
+     */
     @Override
     public synchronized V merge(K key, V value, BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
         Objects.requireNonNull(remappingFunction);
@@ -1099,14 +1150,18 @@
         Entry<K,V> e = (Entry<K,V>)tab[index];
         for (Entry<K,V> prev = null; e != null; prev = e, e = e.next) {
             if (e.hash == hash && e.key.equals(key)) {
+                int mc = modCount;
                 V newValue = remappingFunction.apply(e.value, value);
+                if (mc != modCount) {
+                    throw new ConcurrentModificationException();
+                }
                 if (newValue == null) {
                     if (prev != null) {
                         prev.next = e.next;
                     } else {
                         tab[index] = e.next;
                     }
-                    modCount++;
+                    modCount = mc + 1;
                     count--;
                 } else {
                     e.value = newValue;
--- a/jdk/src/java.base/share/classes/java/util/Map.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/java/util/Map.java	Wed Jul 05 20:27:20 2017 +0200
@@ -894,8 +894,8 @@
      * to {@code null}), attempts to compute its value using the given mapping
      * function and enters it into this map unless {@code null}.
      *
-     * <p>If the function returns {@code null} no mapping is recorded. If
-     * the function itself throws an (unchecked) exception, the
+     * <p>If the mapping function returns {@code null}, no mapping is recorded.
+     * If the mapping function itself throws an (unchecked) exception, the
      * exception is rethrown, and no mapping is recorded.  The most
      * common usage is to construct a new object serving as an initial
      * mapped value or memoized result, as in:
@@ -911,6 +911,7 @@
      * map.computeIfAbsent(key, k -> new HashSet<V>()).add(v);
      * }</pre>
      *
+     * <p>The mapping function should not modify this map during computation.
      *
      * @implSpec
      * The default implementation is equivalent to the following steps for this
@@ -925,16 +926,27 @@
      * }
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about detecting if the
+     * mapping function modifies this map during computation and, if
+     * appropriate, reporting an error. Non-concurrent implementations should
+     * override this method and, on a best-effort basis, throw a
+     * {@code ConcurrentModificationException} if it is detected that the
+     * mapping function modifies this map during computation. Concurrent
+     * implementations should override this method and, on a best-effort basis,
+     * throw an {@code IllegalStateException} if it is detected that the
+     * mapping function modifies this map during computation and as a result
+     * computation would never complete.
+     *
      * <p>The default implementation makes no guarantees about synchronization
      * or atomicity properties of this method. Any implementation providing
      * atomicity guarantees must override this method and document its
      * concurrency properties. In particular, all implementations of
      * subinterface {@link java.util.concurrent.ConcurrentMap} must document
-     * whether the function is applied once atomically only if the value is not
-     * present.
+     * whether the mapping function is applied once atomically only if the value
+     * is not present.
      *
      * @param key key with which the specified value is to be associated
-     * @param mappingFunction the function to compute a value
+     * @param mappingFunction the mapping function to compute a value
      * @return the current (existing or computed) value associated with
      *         the specified key, or null if the computed value is null
      * @throws NullPointerException if the specified key is null and
@@ -967,10 +979,12 @@
      * If the value for the specified key is present and non-null, attempts to
      * compute a new mapping given the key and its current mapped value.
      *
-     * <p>If the function returns {@code null}, the mapping is removed.  If the
-     * function itself throws an (unchecked) exception, the exception is
-     * rethrown, and the current mapping is left unchanged.
-    *
+     * <p>If the remapping function returns {@code null}, the mapping is removed.
+     * If the remapping function itself throws an (unchecked) exception, the
+     * exception is rethrown, and the current mapping is left unchanged.
+     *
+     * <p>The remapping function should not modify this map during computation.
+     *
      * @implSpec
      * The default implementation is equivalent to performing the following
      * steps for this {@code map}, then returning the current value or
@@ -987,16 +1001,27 @@
      * }
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about detecting if the
+     * remapping function modifies this map during computation and, if
+     * appropriate, reporting an error. Non-concurrent implementations should
+     * override this method and, on a best-effort basis, throw a
+     * {@code ConcurrentModificationException} if it is detected that the
+     * remapping function modifies this map during computation. Concurrent
+     * implementations should override this method and, on a best-effort basis,
+     * throw an {@code IllegalStateException} if it is detected that the
+     * remapping function modifies this map during computation and as a result
+     * computation would never complete.
+     *
      * <p>The default implementation makes no guarantees about synchronization
      * or atomicity properties of this method. Any implementation providing
      * atomicity guarantees must override this method and document its
      * concurrency properties. In particular, all implementations of
      * subinterface {@link java.util.concurrent.ConcurrentMap} must document
-     * whether the function is applied once atomically only if the value is not
-     * present.
+     * whether the remapping function is applied once atomically only if the
+     * value is not present.
      *
      * @param key key with which the specified value is to be associated
-     * @param remappingFunction the function to compute a value
+     * @param remappingFunction the remapping function to compute a value
      * @return the new value associated with the specified key, or null if none
      * @throws NullPointerException if the specified key is null and
      *         this map does not support null keys, or the
@@ -1037,10 +1062,12 @@
      * map.compute(key, (k, v) -> (v == null) ? msg : v.concat(msg))}</pre>
      * (Method {@link #merge merge()} is often simpler to use for such purposes.)
      *
-     * <p>If the function returns {@code null}, the mapping is removed (or
-     * remains absent if initially absent).  If the function itself throws an
-     * (unchecked) exception, the exception is rethrown, and the current mapping
-     * is left unchanged.
+     * <p>If the remapping function returns {@code null}, the mapping is removed
+     * (or remains absent if initially absent).  If the remapping function
+     * itself throws an (unchecked) exception, the exception is rethrown, and
+     * the current mapping is left unchanged.
+     *
+     * <p>The remapping function should not modify this map during computation.
      *
      * @implSpec
      * The default implementation is equivalent to performing the following
@@ -1063,16 +1090,27 @@
      * }
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about detecting if the
+     * remapping function modifies this map during computation and, if
+     * appropriate, reporting an error. Non-concurrent implementations should
+     * override this method and, on a best-effort basis, throw a
+     * {@code ConcurrentModificationException} if it is detected that the
+     * remapping function modifies this map during computation. Concurrent
+     * implementations should override this method and, on a best-effort basis,
+     * throw an {@code IllegalStateException} if it is detected that the
+     * remapping function modifies this map during computation and as a result
+     * computation would never complete.
+     *
      * <p>The default implementation makes no guarantees about synchronization
      * or atomicity properties of this method. Any implementation providing
      * atomicity guarantees must override this method and document its
      * concurrency properties. In particular, all implementations of
      * subinterface {@link java.util.concurrent.ConcurrentMap} must document
-     * whether the function is applied once atomically only if the value is not
-     * present.
+     * whether the remapping function is applied once atomically only if the
+     * value is not present.
      *
      * @param key key with which the specified value is to be associated
-     * @param remappingFunction the function to compute a value
+     * @param remappingFunction the remapping function to compute a value
      * @return the new value associated with the specified key, or null if none
      * @throws NullPointerException if the specified key is null and
      *         this map does not support null keys, or the
@@ -1121,9 +1159,11 @@
      * map.merge(key, msg, String::concat)
      * }</pre>
      *
-     * <p>If the function returns {@code null} the mapping is removed.  If the
-     * function itself throws an (unchecked) exception, the exception is
-     * rethrown, and the current mapping is left unchanged.
+     * <p>If the remapping function returns {@code null}, the mapping is removed.
+     * If the remapping function itself throws an (unchecked) exception, the
+     * exception is rethrown, and the current mapping is left unchanged.
+     *
+     * <p>The remapping function should not modify this map during computation.
      *
      * @implSpec
      * The default implementation is equivalent to performing the following
@@ -1140,19 +1180,31 @@
      *     map.put(key, newValue);
      * }</pre>
      *
+     * <p>The default implementation makes no guarantees about detecting if the
+     * remapping function modifies this map during computation and, if
+     * appropriate, reporting an error. Non-concurrent implementations should
+     * override this method and, on a best-effort basis, throw a
+     * {@code ConcurrentModificationException} if it is detected that the
+     * remapping function modifies this map during computation. Concurrent
+     * implementations should override this method and, on a best-effort basis,
+     * throw an {@code IllegalStateException} if it is detected that the
+     * remapping function modifies this map during computation and as a result
+     * computation would never complete.
+     *
      * <p>The default implementation makes no guarantees about synchronization
      * or atomicity properties of this method. Any implementation providing
      * atomicity guarantees must override this method and document its
      * concurrency properties. In particular, all implementations of
      * subinterface {@link java.util.concurrent.ConcurrentMap} must document
-     * whether the function is applied once atomically only if the value is not
-     * present.
+     * whether the remapping function is applied once atomically only if the
+     * value is not present.
      *
      * @param key key with which the resulting value is to be associated
      * @param value the non-null value to be merged with the existing value
      *        associated with the key or, if no existing value or a null value
      *        is associated with the key, to be associated with the key
-     * @param remappingFunction the function to recompute a value if present
+     * @param remappingFunction the remapping function to recompute a value if
+     *        present
      * @return the new value associated with the specified key, or null if no
      *         value is associated with the key
      * @throws UnsupportedOperationException if the {@code put} operation
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.base/share/classes/jdk/Exported.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk;
+
+import java.lang.annotation.*;
+
+/**
+  * Indicates whether or not a JDK specific type or package is an
+  * exported part of the JDK suitable for use outside of the JDK
+  * implementation itself.
+  *
+  * This annotation should only be applied to types and packages
+  * <em>outside</em> of the Java SE namespaces of {@code java.*} and
+  * {@code javax.*} packages.  For example, certain portions of {@code
+  * com.sun.*} are official parts of the JDK meant to be generally
+  * usable while other portions of {@code com.sun.*} are not.  This
+  * annotation type allows those portions to be easily and
+  * programmatically distinguished.
+  *
+  * <p>If in one release a type or package is
+  * <code>@Exported(true)</code>, in a subsequent major release such a
+  * type or package can transition to <code>@Exported(false)</code>.
+  *
+  * <p>If a type or package is <code>@Exported(false)</code> in a
+  * release, it may be removed in a subsequent major release.
+  *
+  * <p>If a top-level type has an <code>@Exported</code> annotation,
+  * any nested member types with the top-level type should have an
+  * <code>@Exported</code> annotation with the same value.
+  *
+  * (In exceptional cases, if a nested type is going to be removed
+  * before its enclosing type, the nested type's could be
+  * <code>@Exported(false)</code> while its enclosing type was
+  * <code>@Exported(true)</code>.)
+  *
+  * Likewise, if a package has an <code>@Exported</code> annotation,
+  * top-level types within that package should also have an
+  * <code>@Exported</code> annotation.
+  *
+  * Sometimes a top-level type may have a different
+  * <code>@Exported</code> value than its package.
+  *
+  * @since 1.8
+  */
+@Documented
+@Retention(RetentionPolicy.RUNTIME)
+@Target({ElementType.TYPE, ElementType.PACKAGE})
+@Exported
+public @interface Exported {
+    /**
+     * Whether or not the annotated type or package is an exported
+     * part of the JDK.
+     * @return whether or not the annotated type or package is an exported
+     * part of the JDK
+     */
+    boolean value() default true;
+}
--- a/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/misc/Unsafe.java	Wed Jul 05 20:27:20 2017 +0200
@@ -631,6 +631,10 @@
     /**
      * Atomically updates Java variable to {@code x} if it is currently
      * holding {@code expected}.
+     *
+     * <p>This operation has memory semantics of a {@code volatile} read
+     * and write.  Corresponds to C11 atomic_compare_exchange_strong.
+     *
      * @return {@code true} if successful
      */
     public final native boolean compareAndSwapObject(Object o, long offset,
@@ -640,6 +644,10 @@
     /**
      * Atomically updates Java variable to {@code x} if it is currently
      * holding {@code expected}.
+     *
+     * <p>This operation has memory semantics of a {@code volatile} read
+     * and write.  Corresponds to C11 atomic_compare_exchange_strong.
+     *
      * @return {@code true} if successful
      */
     public final native boolean compareAndSwapInt(Object o, long offset,
@@ -649,6 +657,10 @@
     /**
      * Atomically updates Java variable to {@code x} if it is currently
      * holding {@code expected}.
+     *
+     * <p>This operation has memory semantics of a {@code volatile} read
+     * and write.  Corresponds to C11 atomic_compare_exchange_strong.
+     *
      * @return {@code true} if successful
      */
     public final native boolean compareAndSwapLong(Object o, long offset,
--- a/jdk/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/reflect/misc/FieldUtil.java	Wed Jul 05 20:27:20 2017 +0200
@@ -45,9 +45,4 @@
         ReflectUtil.checkPackageAccess(cls);
         return cls.getFields();
     }
-
-    public static Field[] getDeclaredFields(Class<?> cls) {
-        ReflectUtil.checkPackageAccess(cls);
-        return cls.getDeclaredFields();
-    }
 }
--- a/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java	Wed Jul 05 20:27:20 2017 +0200
@@ -625,6 +625,15 @@
                     params[2] = 5;
                     params[3] = 86400000;
                 }
+                // Additional check for startDayOfWeek=6 and starTime=86400000
+                // is needed for Asia/Amman; Asia/Gasa and Asia/Hebron
+                if (params[2] == 7 && params[3] == 0 &&
+                     (zoneId.equals("Asia/Amman") ||
+                      zoneId.equals("Asia/Gaza") ||
+                      zoneId.equals("Asia/Hebron"))) {
+                    params[2] = 6;        // Friday
+                    params[3] = 86400000; // 24h
+                }
                 //endDayOfWeek and endTime workaround
                 if (params[7] == 6 && params[8] == 0 &&
                     (zoneId.equals("Africa/Cairo"))) {
--- a/jdk/src/java.base/share/native/libjli/java.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/java.c	Wed Jul 05 20:27:20 2017 +0200
@@ -730,7 +730,7 @@
 static int
 parse_size(const char *s, jlong *result) {
   jlong n = 0;
-  int args_read = sscanf(s, jlong_format_specifier(), &n);
+  int args_read = sscanf(s, JLONG_FORMAT_SPECIFIER, &n);
   if (args_read != 1) {
     return 0;
   }
@@ -798,7 +798,7 @@
              * overflow before the JVM startup code can check to make sure the stack
              * is big enough.
              */
-            if (threadStackSize < STACK_SIZE_MINIMUM) {
+            if (threadStackSize < (jlong)STACK_SIZE_MINIMUM) {
                 threadStackSize = STACK_SIZE_MINIMUM;
             }
         }
--- a/jdk/src/java.base/share/native/libjli/java.h	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/java.h	Wed Jul 05 20:27:20 2017 +0200
@@ -144,8 +144,6 @@
 void JLI_ReportExceptionDescription(JNIEnv * env);
 void PrintMachineDependentOptions();
 
-const char *jlong_format_specifier();
-
 /*
  * Block current thread and continue execution in new thread
  */
--- a/jdk/src/java.base/share/native/libjli/manifest_info.h	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/manifest_info.h	Wed Jul 05 20:27:20 2017 +0200
@@ -109,6 +109,8 @@
 /*
  * Macros for getting end of central directory header (END) fields
  */
+#define ENDNMD(b) SH(b, 4)          /* number of this disk */
+#define ENDDSK(b) SH(b, 6)          /* disk number of start */
 #define ENDSUB(b) SH(b, 8)          /* number of entries on this disk */
 #define ENDTOT(b) SH(b, 10)         /* total number of entries */
 #define ENDSIZ(b) LG(b, 12)         /* central directory size */
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -111,52 +111,127 @@
     return (NULL);
 }
 
-static jboolean zip64_present = JNI_FALSE;
+/*
+ * Implementation notes:
+ *
+ * This is a zip format reader for seekable files, that tolerates
+ * leading and trailing garbage, and tolerates having had internal
+ * offsets adjusted for leading garbage (as with Info-Zip's zip -A).
+ *
+ * We find the end header by scanning backwards from the end of the
+ * file for the end signature.  This may fail in the presence of
+ * trailing garbage or a ZIP file comment that contains binary data.
+ * Similarly, the ZIP64 end header may need to be located by scanning
+ * backwards from the end header.  It may be misidentified, but this
+ * is very unlikely to happen in practice without adversarial input.
+ *
+ * The zip file format is documented at:
+ * https://www.pkware.com/documents/casestudies/APPNOTE.TXT
+ *
+ * TODO: more informative error messages
+ */
+
+/** Reads count bytes from fd at position pos into given buffer. */
+static jboolean
+readAt(int fd, jlong pos, unsigned int count, void *buf) {
+    return (pos >= 0
+            && JLI_Lseek(fd, pos, SEEK_SET) == pos
+            && read(fd, buf, count) == (jlong) count);
+}
+
 
 /*
- * Checks to see if we have ZIP64 archive, and save
- * the check for later use
+ * Tells whether given header values (obtained from either ZIP64 or
+ * non-ZIP64 header) appear to be correct, by checking the first LOC
+ * and CEN headers.
  */
-static int
-haveZIP64(Byte *p) {
-    jlong cenlen, cenoff, centot;
-    cenlen = ENDSIZ(p);
-    cenoff = ENDOFF(p);
-    centot = ENDTOT(p);
-    zip64_present = (cenlen == ZIP64_MAGICVAL ||
-                     cenoff == ZIP64_MAGICVAL ||
-                     centot == ZIP64_MAGICCOUNT);
-    return zip64_present;
-}
-
-static jlong
-find_end64(int fd, Byte *ep, jlong pos)
-{
-    jlong end64pos;
-    jlong bytes;
-    if ((end64pos = JLI_Lseek(fd, pos - ZIP64_LOCHDR, SEEK_SET)) < (jlong)0)
-        return -1;
-    if ((bytes = read(fd, ep, ZIP64_LOCHDR)) < 0)
-        return -1;
-    if (ZIP64_LOCSIG_AT(ep))
-       return end64pos;
-    return -1;
+static jboolean
+is_valid_end_header(int fd, jlong endpos,
+                    jlong censiz, jlong cenoff, jlong entries) {
+    Byte cenhdr[CENHDR];
+    Byte lochdr[LOCHDR];
+    // Expected offset of the first central directory header
+    jlong censtart = endpos - censiz;
+    // Expected position within the file that offsets are relative to
+    jlong base_offset = endpos - (censiz + cenoff);
+    return censtart >= 0 && cenoff >= 0 &&
+        (censiz == 0 ||
+         // Validate first CEN and LOC header signatures.
+         // Central directory must come directly before the end header.
+         (readAt(fd, censtart, CENHDR, cenhdr)
+          && CENSIG_AT(cenhdr)
+          && readAt(fd, base_offset + CENOFF(cenhdr), LOCHDR, lochdr)
+          && LOCSIG_AT(lochdr)
+          && CENNAM(cenhdr) == LOCNAM(lochdr)));
 }
 
 /*
- * A very little used routine to handle the case that zip file has
- * a comment at the end. Believe it or not, the only way to find the
- * END record is to walk backwards, byte by bloody byte looking for
- * the END record signature.
+ * Tells whether p appears to be pointing at a valid ZIP64 end header.
+ * Values censiz, cenoff, and entries are the corresponding values
+ * from the non-ZIP64 end header.  We perform extra checks to avoid
+ * misidentifying data from the last entry as a ZIP64 end header.
+ */
+static jboolean
+is_zip64_endhdr(int fd, const Byte *p, jlong end64pos,
+                jlong censiz, jlong cenoff, jlong entries) {
+    if (ZIP64_ENDSIG_AT(p)) {
+        jlong censiz64 = ZIP64_ENDSIZ(p);
+        jlong cenoff64 = ZIP64_ENDOFF(p);
+        jlong entries64 = ZIP64_ENDTOT(p);
+        return (censiz64 == censiz || censiz == ZIP64_MAGICVAL)
+            && (cenoff64 == cenoff || cenoff == ZIP64_MAGICVAL)
+            && (entries64 == entries || entries == ZIP64_MAGICCOUNT)
+            && is_valid_end_header(fd, end64pos, censiz64, cenoff64, entries64);
+    }
+    return JNI_FALSE;
+}
+
+/*
+ * Given a non-ZIP64 end header located at endhdr and endpos, look for
+ * an adjacent ZIP64 end header, finding the base offset and censtart
+ * from the ZIP64 header if available, else from the non-ZIP64 header.
+ * @return 0 if successful, -1 in case of failure
+ */
+static int
+find_positions64(int fd, const Byte * const endhdr, const jlong endpos,
+                 jlong* base_offset, jlong* censtart)
+{
+    jlong censiz = ENDSIZ(endhdr);
+    jlong cenoff = ENDOFF(endhdr);
+    jlong entries = ENDTOT(endhdr);
+    jlong end64pos;
+    Byte buf[ZIP64_ENDHDR + ZIP64_LOCHDR];
+    if (censiz + cenoff != endpos
+        && (end64pos = endpos - sizeof(buf)) >= (jlong)0
+        && readAt(fd, end64pos, sizeof(buf), buf)
+        && ZIP64_LOCSIG_AT(buf + ZIP64_ENDHDR)
+        && (jlong) ZIP64_LOCDSK(buf + ZIP64_ENDHDR) == ENDDSK(endhdr)
+        && (is_zip64_endhdr(fd, buf, end64pos, censiz, cenoff, entries)
+            || // A variable sized "zip64 extensible data sector" ?
+            ((end64pos = ZIP64_LOCOFF(buf + ZIP64_ENDHDR)) >= (jlong)0
+             && readAt(fd, end64pos, ZIP64_ENDHDR, buf)
+             && is_zip64_endhdr(fd, buf, end64pos, censiz, cenoff, entries)))
+        ) {
+        *censtart = end64pos - ZIP64_ENDSIZ(buf);
+        *base_offset = *censtart - ZIP64_ENDOFF(buf);
+    } else {
+        if (!is_valid_end_header(fd, endpos, censiz, cenoff, entries))
+            return -1;
+        *censtart = endpos - censiz;
+        *base_offset = *censtart - cenoff;
+    }
+    return 0;
+}
+
+/*
+ * Finds the base offset and censtart of the zip file.
  *
- *      fd:     File descriptor of the jar file.
- *      eb:     Pointer to a buffer to receive a copy of the END header.
- *
- * Returns the offset of the END record in the file on success,
- * -1 on failure.
+ * @param fd file descriptor of the jar file
+ * @param eb scratch buffer
+ * @return 0 if successful, -1 in case of failure
  */
-static jlong
-find_end(int fd, Byte *eb)
+static int
+find_positions(int fd, Byte *eb, jlong* base_offset, jlong* censtart)
 {
     jlong   len;
     jlong   pos;
@@ -174,10 +249,10 @@
      */
     if ((pos = JLI_Lseek(fd, -ENDHDR, SEEK_END)) < (jlong)0)
         return (-1);
-    if ((bytes = read(fd, eb, ENDHDR)) < 0)
+    if (read(fd, eb, ENDHDR) < 0)
         return (-1);
     if (ENDSIG_AT(eb)) {
-        return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
+        return find_positions64(fd, eb, pos, base_offset, censtart);
     }
 
     /*
@@ -193,7 +268,13 @@
         return (-1);
     if ((buffer = malloc(END_MAXLEN)) == NULL)
         return (-1);
-    if ((bytes = read(fd, buffer, len)) < 0) {
+
+    /*
+     * read() on windows takes an unsigned int for count. Casting len
+     * to an unsigned int here is safe since it is guaranteed to be
+     * less than END_MAXLEN.
+     */
+    if ((bytes = read(fd, buffer, (unsigned int)len)) < 0) {
         free(buffer);
         return (-1);
     }
@@ -208,7 +289,7 @@
             (void) memcpy(eb, cp, ENDHDR);
             free(buffer);
             pos = flen - (endpos - cp);
-            return haveZIP64(eb) ? find_end64(fd, eb, pos) : pos;
+            return find_positions64(fd, eb, pos, base_offset, censtart);
         }
     free(buffer);
     return (-1);
@@ -218,82 +299,6 @@
 #define MINREAD 1024
 
 /*
- * Computes and positions at the start of the CEN header, ie. the central
- * directory, this will also return the offset if there is a zip file comment
- * at the end of the archive, for most cases this would be 0.
- */
-static jlong
-compute_cen(int fd, Byte *bp)
-{
-    int bytes;
-    Byte *p;
-    jlong base_offset;
-    jlong offset;
-    char buffer[MINREAD];
-    p = (Byte*) buffer;
-    /*
-     * Read the END Header, which is the starting point for ZIP files.
-     * (Clearly designed to make writing a zip file easier than reading
-     * one. Now isn't that precious...)
-     */
-    if ((base_offset = find_end(fd, bp)) == -1) {
-        return (-1);
-    }
-    p = bp;
-    /*
-     * There is a historical, but undocumented, ability to allow for
-     * additional "stuff" to be prepended to the zip/jar file. It seems
-     * that this has been used to prepend an actual java launcher
-     * executable to the jar on Windows.  Although this is just another
-     * form of statically linking a small piece of the JVM to the
-     * application, we choose to continue to support it.  Note that no
-     * guarantees have been made (or should be made) to the customer that
-     * this will continue to work.
-     *
-     * Therefore, calculate the base offset of the zip file (within the
-     * expanded file) by assuming that the central directory is followed
-     * immediately by the end record.
-     */
-    if (zip64_present) {
-        if ((offset = ZIP64_LOCOFF(p)) < (jlong)0) {
-            return -1;
-        }
-        if (JLI_Lseek(fd, offset, SEEK_SET) < (jlong) 0) {
-            return (-1);
-        }
-        if ((bytes = read(fd, buffer, MINREAD)) < 0) {
-            return (-1);
-        }
-        if (!ZIP64_ENDSIG_AT(buffer)) {
-            return -1;
-        }
-        if ((offset = ZIP64_ENDOFF(buffer)) < (jlong)0) {
-            return -1;
-        }
-        if (JLI_Lseek(fd, offset, SEEK_SET) < (jlong)0) {
-            return (-1);
-        }
-        p = (Byte*) buffer;
-        base_offset = base_offset - ZIP64_ENDSIZ(p) - ZIP64_ENDOFF(p) - ZIP64_ENDHDR;
-    } else {
-        base_offset = base_offset - ENDSIZ(p) - ENDOFF(p);
-        /*
-         * The END Header indicates the start of the Central Directory
-         * Headers. Remember that the desired Central Directory Header (CEN)
-         * will almost always be the second one and the first one is a small
-         * directory entry ("META-INF/"). Keep the code optimized for
-         * that case.
-         *
-         * Seek to the beginning of the Central Directory.
-         */
-        if (JLI_Lseek(fd, base_offset + ENDOFF(p), SEEK_SET) < (jlong) 0) {
-            return (-1);
-        }
-    }
-    return base_offset;
-}
-
-/*
  * Locate the manifest file with the zip/jar file.
  *
  *      fd:     File descriptor of the jar file.
@@ -327,7 +332,23 @@
     int     res;
     int     entry_size;
     int     read_size;
+
+    /*
+     * The (imaginary) position within the file relative to which
+     * offsets within the zip file refer.  This is usually the
+     * location of the first local header (the start of the zip data)
+     * (which in turn is usually 0), but if the zip file has content
+     * prepended, then it will be either 0 or the length of the
+     * prepended content, depending on whether or not internal offsets
+     * have been adjusted (via e.g. zip -A).  May be negative if
+     * content is prepended, zip -A is run, then the prefix is
+     * detached!
+     */
     jlong   base_offset;
+
+    /** The position within the file of the start of the central directory. */
+    jlong   censtart;
+
     Byte    *p;
     Byte    *bp;
     Byte    *buffer;
@@ -338,9 +359,11 @@
     }
 
     bp = buffer;
-    base_offset = compute_cen(fd, bp);
-    if (base_offset == -1) {
-        free(buffer);
+
+    if (find_positions(fd, bp, &base_offset, &censtart) == -1) {
+        return -1;
+    }
+    if (JLI_Lseek(fd, censtart, SEEK_SET) < (jlong) 0) {
         return -1;
     }
 
@@ -574,7 +597,7 @@
     info->jre_version = NULL;
     info->jre_restrict_search = 0;
     info->splashscreen_image_file_name = NULL;
-    if (rc = find_file(fd, &entry, manifest_name) != 0) {
+    if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
         close(fd);
         return (-2);
     }
@@ -675,7 +698,7 @@
         return (-1);
     }
 
-    if (rc = find_file(fd, &entry, manifest_name) != 0) {
+    if ((rc = find_file(fd, &entry, manifest_name)) != 0) {
         close(fd);
         return (-2);
     }
--- a/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/splashscreen_stubs.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -61,11 +61,11 @@
 #define INVOKEV(name) _INVOKE(name, ,;)
 
 int     DoSplashLoadMemory(void* pdata, int size) {
-    INVOKE(SplashLoadMemory, NULL)(pdata, size);
+    INVOKE(SplashLoadMemory, 0)(pdata, size);
 }
 
 int     DoSplashLoadFile(const char* filename) {
-    INVOKE(SplashLoadFile, NULL)(filename);
+    INVOKE(SplashLoadFile, 0)(filename);
 }
 
 void    DoSplashInit(void) {
@@ -87,4 +87,4 @@
 char*    DoSplashGetScaledImageName(const char* fileName, const char* jarName,
                                     float* scaleFactor) {
     INVOKE(SplashGetScaledImageName, NULL)(fileName, jarName, scaleFactor);
-}
\ No newline at end of file
+}
--- a/jdk/src/java.base/share/native/libjli/wildcard.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/wildcard.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -274,7 +274,7 @@
 }
 
 static void
-FileList_addSubstring(FileList fl, const char *beg, int len)
+FileList_addSubstring(FileList fl, const char *beg, size_t len)
 {
     char *filename = (char *) JLI_MemAlloc(len+1);
     memcpy(filename, beg, len);
@@ -310,7 +310,7 @@
 FileList_split(const char *path, char sep)
 {
     const char *p, *q;
-    int len = (int)JLI_StrLen(path);
+    size_t len = JLI_StrLen(path);
     int count;
     FileList fl;
     for (count = 1, p = path; p < path + len; p++)
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessImpl.java	Wed Jul 05 20:27:20 2017 +0200
@@ -285,8 +285,6 @@
      *   1 - fork(2) and exec(2)
      *   2 - posix_spawn(3P)
      *   3 - vfork(2) and exec(2)
-     *
-     *  (4 - clone(2) and exec(2) - obsolete and currently disabled in native code)
      * </pre>
      * @param fds an array of three file descriptors.
      *        Indexes 0, 1, and 2 correspond to standard input,
--- a/jdk/src/java.base/unix/conf/arm/jvm.cfg	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  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.
-#
-# List of JVMs that can be used as an option to java, javac, etc.
-# Order is important -- first in this list is the default JVM.
-# NOTE that this both this file and its format are UNSUPPORTED and
-# WILL GO AWAY in a future release.
-#
-# You may also select a JVM in an arbitrary location with the
-# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
-# and may not be available in a future release.
-#
--client IF_SERVER_CLASS -server
--server KNOWN
--minimal KNOWN
--- a/jdk/src/java.base/unix/conf/ppc/jvm.cfg	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  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.
-#
-# List of JVMs that can be used as an option to java, javac, etc.
-# Order is important -- first in this list is the default JVM.
-# NOTE that this both this file and its format are UNSUPPORTED and
-# WILL GO AWAY in a future release.
-#
-# You may also select a JVM in an arbitrary location with the
-# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
-# and may not be available in a future release.
-#
--client KNOWN
--server KNOWN
--minimal KNOWN
--- a/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjava/ProcessImpl_md.c	Wed Jul 05 20:27:20 2017 +0200
@@ -97,8 +97,7 @@
  *   address space temporarily, before launching the target command.
  *
  * Based on the above analysis, we are currently using vfork() on
- * Linux and spawn() on other Unix systems, but the code to use clone()
- * and fork() remains.
+ * Linux and posix_spawn() on other Unix systems.
  */
 
 
@@ -385,39 +384,13 @@
 }
 
 /**
- * We are unusually paranoid; use of clone/vfork is
+ * We are unusually paranoid; use of vfork is
  * especially likely to tickle gcc/glibc bugs.
  */
 #ifdef __attribute_noinline__  /* See: sys/cdefs.h */
 __attribute_noinline__
 #endif
 
-#define START_CHILD_USE_CLONE 0  /* clone() currently disabled; see above. */
-
-#ifdef START_CHILD_USE_CLONE
-static pid_t
-cloneChild(ChildStuff *c) {
-#ifdef __linux__
-#define START_CHILD_CLONE_STACK_SIZE (64 * 1024)
-    /*
-     * See clone(2).
-     * Instead of worrying about which direction the stack grows, just
-     * allocate twice as much and start the stack in the middle.
-     */
-    if ((c->clone_stack = malloc(2 * START_CHILD_CLONE_STACK_SIZE)) == NULL)
-        /* errno will be set to ENOMEM */
-        return -1;
-    return clone(childProcess,
-                 c->clone_stack + START_CHILD_CLONE_STACK_SIZE,
-                 CLONE_VFORK | CLONE_VM | SIGCHLD, c);
-#else
-/* not available on Solaris / Mac */
-    assert(0);
-    return -1;
-#endif
-}
-#endif
-
 static pid_t
 vforkChild(ChildStuff *c) {
     volatile pid_t resultPid;
@@ -590,12 +563,11 @@
     c->argv = NULL;
     c->envv = NULL;
     c->pdir = NULL;
-    c->clone_stack = NULL;
 
     /* Convert prog + argBlock into a char ** argv.
      * Add one word room for expansion of argv for use by
      * execve_as_traditional_shell_script.
-     * This word is also used when using spawn mode
+     * This word is also used when using posix_spawn mode
      */
     assert(prog != NULL && argBlock != NULL);
     if ((phelperpath = getBytes(env, helperpath))   == NULL) goto Catch;
@@ -654,7 +626,7 @@
             throwIOException(env, errno, "fork failed");
             break;
           case MODE_POSIX_SPAWN:
-            throwIOException(env, errno, "spawn failed");
+            throwIOException(env, errno, "posix_spawn failed");
             break;
         }
         goto Catch;
@@ -677,8 +649,6 @@
     fds[2] = (err[0] != -1) ? err[0] : -1;
 
  Finally:
-    free(c->clone_stack);
-
     /* Always clean up the child's side of the pipes */
     closeSafely(in [0]);
     closeSafely(out[1]);
--- a/jdk/src/java.base/unix/native/libjava/childproc.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjava/childproc.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -304,7 +304,7 @@
 }
 
 /**
- * Child process after a successful fork() or clone().
+ * Child process after a successful fork().
  * This function must not return, and must be prepared for either all
  * of its address space to be shared with its parent, or to be a copy.
  * It must not modify global variables such as "environ".
--- a/jdk/src/java.base/unix/native/libjava/childproc.h	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjava/childproc.h	Wed Jul 05 20:27:20 2017 +0200
@@ -101,7 +101,6 @@
     const char **envv;
     const char *pdir;
     int redirectErrorStream;
-    void *clone_stack;
 } ChildStuff;
 
 /* following used in addition when mode is SPAWN */
--- a/jdk/src/java.base/unix/native/libjava/jni_util_md.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjava/jni_util_md.c	Wed Jul 05 20:27:20 2017 +0200
@@ -55,10 +55,12 @@
 size_t
 getLastErrorString(char *buf, size_t len)
 {
+    char *err;
+    size_t n;
     if (errno == 0 || len < 1) return 0;
 
-    const char *err = strerror(errno);
-    size_t n = strlen(err);
+    err = strerror(errno);
+    n = strlen(err);
     if (n >= len)
         n = len - 1;
 
--- a/jdk/src/java.base/unix/native/libjli/java_md.h	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjli/java_md.h	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -43,6 +43,12 @@
 #define MAXNAMELEN              PATH_MAX
 #endif
 
+#ifdef _LP64
+#define JLONG_FORMAT_SPECIFIER "%ld"
+#else
+#define JLONG_FORMAT_SPECIFIER "%lld"
+#endif
+
 int UnsetEnv(char *name);
 char *FindExecName(char *program);
 const char *SetExecname(char **argv);
--- a/jdk/src/java.base/unix/native/libjli/java_md_common.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjli/java_md_common.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -269,11 +269,6 @@
     return(borrowed_unsetenv(name));
 }
 
-const char *
-jlong_format_specifier() {
-    return "%lld";
-}
-
 jboolean
 IsJavaw()
 {
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -888,7 +888,7 @@
     if (pthread_create(&tid, &attr, (void *(*)(void*))continuation, (void*)args) == 0) {
       void * tmp;
       pthread_join(tid, &tmp);
-      rslt = (int)tmp;
+      rslt = (int)(intptr_t)tmp;
     } else {
      /*
       * Continue execution in current thread if for some reason (e.g. out of
@@ -906,7 +906,7 @@
     if (thr_create(NULL, stack_size, (void *(*)(void *))continuation, args, flags, &tid) == 0) {
       void * tmp;
       thr_join(tid, NULL, &tmp);
-      rslt = (int)tmp;
+      rslt = (int)(intptr_t)tmp;
     } else {
       /* See above. Continue in current thread if thr_create() failed */
       rslt = continuation(args);
--- a/jdk/src/java.base/windows/native/libjli/cmdtoargs.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjli/cmdtoargs.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -77,7 +77,7 @@
     USHORT ch = 0;
     int i;
     jboolean done = JNI_FALSE;
-    int charLength;
+    ptrdiff_t charLength;
 
     *wildcard = JNI_FALSE;
     while (!done) {
@@ -208,10 +208,12 @@
         argv = (StdArg*) JLI_MemRealloc(argv, (nargs+1) * sizeof(StdArg));
         argv[nargs].arg = JLI_StringDup(arg);
         argv[nargs].has_wildcard = wildcard;
-        *arg = NULL;
+        *arg = '\0';
         nargs++;
     } while (src != NULL);
 
+    JLI_MemFree(arg);
+
     stdargc = nargs;
     stdargs = argv;
 }
--- a/jdk/src/java.base/windows/native/libjli/java_md.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,7 +107,7 @@
  * GetParamValue("theParam", "theParam=value") returns pointer to "value".
  */
 const char * GetParamValue(const char *paramName, const char *arg) {
-    int nameLen = JLI_StrLen(paramName);
+    size_t nameLen = JLI_StrLen(paramName);
     if (JLI_StrNCmp(paramName, arg, nameLen) == 0) {
         /* arg[nameLen] is valid (may contain final NULL) */
         if (arg[nameLen] == '=') {
@@ -561,7 +561,7 @@
     if (rc < 0) {
         /* apply ansi semantics */
         buffer[size - 1] = '\0';
-        return size;
+        return (int)size;
     } else if (rc == size) {
         /* force a null terminator */
         buffer[size - 1] = '\0';
@@ -728,11 +728,6 @@
     }
 }
 
-const char *
-jlong_format_specifier() {
-    return "%I64d";
-}
-
 /*
  * Block current thread and continue execution in a new thread
  */
@@ -882,7 +877,7 @@
     if (hPreloadAwt == NULL) {
         /* awt.dll is not loaded yet */
         char libraryPath[MAXPATHLEN];
-        int jrePathLen = 0;
+        size_t jrePathLen = 0;
         HMODULE hJava = NULL;
         HMODULE hVerify = NULL;
 
@@ -1004,7 +999,8 @@
 jobjectArray
 CreateApplicationArgs(JNIEnv *env, char **strv, int argc)
 {
-    int i, j, idx, tlen;
+    int i, j, idx;
+    size_t tlen;
     jobjectArray outArray, inArray;
     char *ostart, *astart, **nargv;
     jboolean needs_expansion = JNI_FALSE;
--- a/jdk/src/java.base/windows/native/libjli/java_md.h	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.base/windows/native/libjli/java_md.h	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,6 +39,7 @@
 #define MAXPATHLEN      MAX_PATH
 #define MAXNAMELEN      MAX_PATH
 
+#define JLONG_FORMAT_SPECIFIER "%I64d"
 
 /*
  * Support for doing cheap, accurate interval timing.
--- a/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/CFontManager.java	Wed Jul 05 20:27:20 2017 +0200
@@ -44,7 +44,6 @@
 import sun.lwawt.macosx.*;
 
 public final class CFontManager extends SunFontManager {
-    private FontConfigManager fcManager = null;
     private static Hashtable<String, Font2D> genericFonts = new Hashtable<String, Font2D>();
 
     @Override
@@ -231,15 +230,6 @@
         return font2D;
     }
 
-    /*
-    public synchronized FontConfigManager getFontConfigManager() {
-        if (fcManager  == null) {
-            fcManager = new FontConfigManager();
-        }
-        return fcManager;
-    }
-    */
-
     protected void registerFontsInDir(String dirName, boolean useJavaRasterizer, int fontRank, boolean defer, boolean resolveSymLinks) {
         loadNativeDirFonts(dirName);
         super.registerFontsInDir(dirName, useJavaRasterizer, fontRank, defer, resolveSymLinks);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeFont.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.font;
+
+import java.awt.FontFormatException;
+import java.awt.font.FontRenderContext;
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.geom.Rectangle2D;
+
+/*
+ * This class should never be invoked on the windows implementation
+ * So the constructor throws a FontFormatException, which is caught
+ * and the font is ignored.
+ */
+
+public class NativeFont extends PhysicalFont {
+
+    /**
+     * Verifies native font is accessible.
+     * @throws FontFormatException - if the font can't be located.
+     */
+    public NativeFont(String platName, boolean isBitmapDelegate)
+        throws FontFormatException {
+
+        throw new FontFormatException("NativeFont not used on OS X");
+    }
+
+    static boolean hasExternalBitmaps(String platName) {
+        return false;
+    }
+
+    public CharToGlyphMapper getMapper() {
+        return null;
+    }
+
+    PhysicalFont getDelegateFont() {
+        return null;
+    }
+
+    FontStrike createStrike(FontStrikeDesc desc) {
+        return null;
+    }
+
+    public Rectangle2D getMaxCharBounds(FontRenderContext frc) {
+        return null;
+    }
+
+    StrikeMetrics getFontMetrics(long pScalerContext) {
+        return null;
+    }
+
+    public GeneralPath getGlyphOutline(long pScalerContext,
+                                       int glyphCode,
+                                       float x, float y) {
+        return null;
+    }
+
+    public  GeneralPath getGlyphVectorOutline(long pScalerContext,
+                                              int[] glyphs, int numGlyphs,
+                                              float x, float y) {
+        return null;
+    }
+
+
+    long getGlyphImage(long pScalerContext, int glyphCode) {
+        return 0L;
+    }
+
+
+    void getGlyphMetrics(long pScalerContext, int glyphCode,
+                         Point2D.Float metrics) {
+    }
+
+
+    float getGlyphAdvance(long pScalerContext, int glyphCode) {
+        return 0f;
+    }
+
+    Rectangle2D.Float getGlyphOutlineBounds(long pScalerContext,
+                                            int glyphCode) {
+        return new Rectangle2D.Float(0f, 0f, 0f, 0f);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/src/java.desktop/macosx/classes/sun/font/NativeStrike.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.font;
+
+import java.awt.geom.GeneralPath;
+import java.awt.geom.Point2D;
+import java.awt.Rectangle;
+import java.awt.geom.Rectangle2D;
+
+public class NativeStrike extends PhysicalStrike {
+
+    NativeFont nativeFont;
+
+    NativeStrike(NativeFont nativeFont, FontStrikeDesc desc) {
+        super(nativeFont, desc);
+
+        throw new RuntimeException("NativeFont not used on OS X");
+    }
+
+    NativeStrike(NativeFont nativeFont, FontStrikeDesc desc,
+                 boolean nocache) {
+        super(nativeFont, desc);
+
+        throw new RuntimeException("NativeFont not used on Windows");
+    }
+
+
+    void getGlyphImagePtrs(int[] glyphCodes, long[] images,int  len) {
+    }
+
+    long getGlyphImagePtr(int glyphCode) {
+        return 0L;
+    }
+
+    long getGlyphImagePtrNoCache(int glyphCode) {
+        return 0L;
+    }
+
+    void getGlyphImageBounds(int glyphcode,
+                             Point2D.Float pt,
+                             Rectangle result) {
+    }
+
+    Point2D.Float getGlyphMetrics(int glyphCode) {
+        return null;
+    }
+
+    float getGlyphAdvance(int glyphCode) {
+        return 0f;
+    }
+
+    Rectangle2D.Float getGlyphOutlineBounds(int glyphCode) {
+        return null;
+    }
+    GeneralPath getGlyphOutline(int glyphCode, float x, float y) {
+        return null;
+    }
+
+    GeneralPath getGlyphVectorOutline(int[] glyphs, float x, float y) {
+        return null;
+    }
+
+}
--- a/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTView.m	Wed Jul 05 20:27:20 2017 +0200
@@ -311,7 +311,10 @@
 }
 
 - (BOOL) performKeyEquivalent: (NSEvent *) event {
-    [self deliverJavaKeyEventHelper: event];
+    // if IM is active key events should be ignored 
+    if (![self hasMarkedText] && !fInPressAndHold) {
+        [self deliverJavaKeyEventHelper: event];
+    }
 
     // Workaround for 8020209: special case for "Cmd =" and "Cmd ." 
     // because Cocoa calls performKeyEquivalent twice for these keystrokes  
--- a/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/macosx/native/libsplashscreen/splashscreen_sys.m	Wed Jul 05 20:27:20 2017 +0200
@@ -126,14 +126,28 @@
     return buf;
 }
 
+BOOL isSWTRunning() {
+    char envVar[80];
+    // If this property is present we are running SWT
+    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
+    return getenv(envVar) != NULL;
+}
+
 char* SplashGetScaledImageName(const char* jar, const char* file,
                                float *scaleFactor) {
+    *scaleFactor = 1;
+
+    if(isSWTRunning()){
+        return nil;
+    }
+
     NSAutoreleasePool *pool = [NSAutoreleasePool new];
-    *scaleFactor = 1;
     char* scaledFile = nil;
     __block float screenScaleFactor = 1;
 
     [ThreadUtilities performOnMainThreadWaiting:YES block:^(){
+        // initialize NSApplication and AWT stuff
+        [NSApplicationAWT sharedApplication];
         screenScaleFactor = [SplashNSScreen() backingScaleFactor];
     }];
 
@@ -180,12 +194,8 @@
     splash->screenFormat.byteOrder = 1 ?  BYTE_ORDER_LSBFIRST : BYTE_ORDER_MSBFIRST;
     splash->screenFormat.depthBytes = 4;
 
-    // If this property is present we are running SWT and should not start a runLoop
-    // Can't check if running SWT in webstart, so splash screen in webstart SWT
-    // applications is not supported
-    char envVar[80];
-    snprintf(envVar, sizeof(envVar), "JAVA_STARTED_ON_FIRST_THREAD_%d", getpid());
-    if (getenv(envVar) == NULL) {
+    // If we are running SWT we should not start a runLoop
+    if (!isSWTRunning()) {
         [JNFRunLoop performOnMainThreadWaiting:NO withBlock:^() {
             [NSApplicationAWT runAWTLoopWithApp:[NSApplicationAWT sharedApplication]];
         }];
--- a/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/stream/ImageInputStreamImpl.java	Wed Jul 05 20:27:20 2017 +0200
@@ -225,7 +225,7 @@
     }
 
     public short readShort() throws IOException {
-        if (read(byteBuf, 0, 2) < 0) {
+        if (read(byteBuf, 0, 2) != 2) {
             throw new EOFException();
         }
 
@@ -247,7 +247,7 @@
     }
 
     public int readInt() throws IOException {
-        if (read(byteBuf, 0, 4) < 0) {
+        if (read(byteBuf, 0, 4) !=  4) {
             throw new EOFException();
         }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/synth/SynthSliderUI.java	Wed Jul 05 20:27:20 2017 +0200
@@ -308,14 +308,14 @@
     public Dimension getPreferredSize(JComponent c)  {
         recalculateIfInsetsChanged();
         Dimension d = new Dimension(contentRect.width, contentRect.height);
+        Insets i = slider.getInsets();
         if (slider.getOrientation() == JSlider.VERTICAL) {
             d.height = 200;
+            d.height += i.top + i.bottom;
         } else {
             d.width = 200;
+            d.width += i.left + i.right;
         }
-        Insets i = slider.getInsets();
-        d.width += i.left + i.right;
-        d.height += i.top + i.bottom;
         return d;
     }
 
--- a/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/share/classes/javax/swing/table/JTableHeader.java	Wed Jul 05 20:27:20 2017 +0200
@@ -439,6 +439,26 @@
         return tip;
     }
 
+    /**
+     * Returns the preferred size of the table header.
+     * This is the size required to display the header and requested for
+     * the viewport.
+     * The returned {@code Dimension} {@code width} will always be calculated by
+     * the underlying TableHeaderUI, regardless of any width specified by
+     * {@link JComponent#setPreferredSize(java.awt.Dimension)}
+     *
+     * @return the size
+     */
+    @Override
+    public Dimension getPreferredSize() {
+        Dimension preferredSize = super.getPreferredSize();
+        if (isPreferredSizeSet() && ui != null) {
+            Dimension size = ui.getPreferredSize(this);
+            if (size != null) preferredSize.width = size.width;
+        }
+        return preferredSize;
+    }
+
 //
 // Managing TableHeaderUI
 //
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/awt/gtk2_interface.c	Wed Jul 05 20:27:20 2017 +0200
@@ -368,9 +368,9 @@
     if (length > CONV_BUFFER_SIZE-1)
     {
         length = CONV_BUFFER_SIZE-1;
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
         fprintf(stderr, "Note: Detail is too long: %d chars\n", length);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
     }
 
     (*env)->GetStringUTFRegion(env, val, 0, length, convertionBuffer);
@@ -507,9 +507,9 @@
             }
         }
     } else {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
         fprintf(stderr, "Cannot load g_vfs_get_supported_uri_schemes\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
     }
 
 }
@@ -522,23 +522,23 @@
      const char *gtk_version = fp_gtk_check_version(2, 14, 0);
      if (gtk_version != NULL) {
          // The gtk_show_uri is available from GTK+ 2.14
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
          fprintf (stderr, "The version of GTK is %s. "
              "The gtk_show_uri function is supported "
              "since GTK+ 2.14.\n", gtk_version);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
      } else {
          // Loading symbols only if the GTK version is 2.14 and higher
          fp_gtk_show_uri = dl_symbol("gtk_show_uri");
          const char *dlsym_error = dlerror();
          if (dlsym_error) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
              fprintf (stderr, "Cannot load symbol: %s \n", dlsym_error);
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
          } else if (fp_gtk_show_uri == NULL) {
-#ifdef INTERNAL_BUILD
+#ifdef DEBUG
              fprintf(stderr, "dlsym(gtk_show_uri) returned NULL\n");
-#endif /* INTERNAL_BUILD */
+#endif /* DEBUG */
         } else {
             update_supported_actions(env);
             success = TRUE;
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/XlibWrapper.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@
 
 #include <X11/XKBlib.h>
 
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
 static jmethodID lockIsHeldMID = NULL;
 
 static void
@@ -2346,4 +2346,3 @@
 
     (*env)->ReleaseIntArrayElements(env, bitmap, values, JNI_ABORT);
 }
-
--- a/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/unix/native/libawt_xawt/xawt/gnome_interface.c	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@
          // we are trying to load the library without a version suffix
          vfs_handle = dlopen(JNI_LIB_NAME("gnomevfs-2"), RTLD_LAZY);
          if (vfs_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
              fprintf(stderr, "can not load libgnomevfs-2.so\n");
  #endif
              return FALSE;
@@ -51,13 +51,13 @@
      dlerror(); /* Clear errors */
      gnome_vfs_init = (GNOME_VFS_INIT_TYPE*)dlsym(vfs_handle, "gnome_vfs_init");
      if (gnome_vfs_init == NULL){
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
          fprintf(stderr, "dlsym( gnome_vfs_init) returned NULL\n");
  #endif
          return FALSE;
      }
      if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
          fprintf(stderr, "can not find symbol gnome_vfs_init %s \n", errmsg);
  #endif
          return FALSE;
@@ -69,7 +69,7 @@
      if (gnome_handle == NULL) {
          gnome_handle = dlopen(JNI_LIB_NAME("gnome-2"), RTLD_LAZY);
          if (gnome_handle == NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
              fprintf(stderr, "can not load libgnome-2.so\n");
  #endif
              return FALSE;
@@ -78,7 +78,7 @@
      dlerror(); /* Clear errors */
      gnome_url_show = (GNOME_URL_SHOW_TYPE*)dlsym(gnome_handle, "gnome_url_show");
      if ((errmsg = dlerror()) != NULL) {
- #ifdef INTERNAL_BUILD
+ #ifdef DEBUG
          fprintf(stderr, "can not find symble gnome_url_show\n");
  #endif
          return FALSE;
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt.h	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt.h	Wed Jul 05 20:27:20 2017 +0200
@@ -228,7 +228,7 @@
 /*
  * checks if the current thread is/isn't the toolkit thread
  */
-#if defined(DEBUG) || defined(INTERNAL_BUILD)
+#if defined(DEBUG)
 #define CHECK_IS_TOOLKIT_THREAD() \
   if (GetCurrentThreadId() != AwtToolkit::MainThread())  \
   { JNU_ThrowInternalError(env,"Operation is not permitted on non-toolkit thread!\n"); }
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 import java.security.*;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.CopyOnWriteArrayList;
 import sun.misc.JavaAWTAccess;
 import sun.misc.SharedSecrets;
@@ -579,7 +580,8 @@
     // added in the user context.
     class LoggerContext {
         // Table of named Loggers that maps names to Loggers.
-        private final Hashtable<String,LoggerWeakRef> namedLoggers = new Hashtable<>();
+        private final ConcurrentHashMap<String,LoggerWeakRef> namedLoggers =
+                new ConcurrentHashMap<>();
         // Tree of named Loggers
         private final LogNode root;
         private LoggerContext() {
@@ -642,21 +644,44 @@
         }
 
 
-        synchronized Logger findLogger(String name) {
-            // ensure that this context is properly initialized before
-            // looking for loggers.
-            ensureInitialized();
+        Logger findLogger(String name) {
+            // Attempt to find logger without locking.
             LoggerWeakRef ref = namedLoggers.get(name);
-            if (ref == null) {
-                return null;
+            Logger logger = ref == null ? null : ref.get();
+
+            // if logger is not null, then we can return it right away.
+            // if name is "" or "global" and logger is null
+            // we need to fall through and check that this context is
+            // initialized.
+            // if ref is not null and logger is null we also need to
+            // fall through.
+            if (logger != null || (ref == null && !name.isEmpty()
+                    && !name.equals(Logger.GLOBAL_LOGGER_NAME))) {
+                return logger;
             }
-            Logger logger = ref.get();
-            if (logger == null) {
-                // Hashtable holds stale weak reference
-                // to a logger which has been GC-ed.
-                ref.dispose();
+
+            // We either found a stale reference, or we were looking for
+            // "" or "global" and didn't find them.
+            // Make sure context is initialized (has the default loggers),
+            // and look up again, cleaning the stale reference if it hasn't
+            // been cleaned up in between. All this needs to be done inside
+            // a synchronized block.
+            synchronized(this) {
+                // ensure that this context is properly initialized before
+                // looking for loggers.
+                ensureInitialized();
+                ref = namedLoggers.get(name);
+                if (ref == null) {
+                    return null;
+                }
+                logger = ref.get();
+                if (logger == null) {
+                    // The namedLoggers map holds stale weak reference
+                    // to a logger which has been GC-ed.
+                    ref.dispose();
+                }
+                return logger;
             }
-            return logger;
         }
 
         // This method is called before adding a logger to the
@@ -752,7 +777,6 @@
             final LogManager owner = getOwner();
             logger.setLogManager(owner);
             ref = owner.new LoggerWeakRef(logger);
-            namedLoggers.put(name, ref);
 
             // Apply any initial level defined for the new logger, unless
             // the logger's level is already initialized
@@ -789,10 +813,17 @@
             node.walkAndSetParent(logger);
             // new LogNode is ready so tell the LoggerWeakRef about it
             ref.setNode(node);
+
+            // Do not publish 'ref' in namedLoggers before the logger tree
+            // is fully updated - because the named logger will be visible as
+            // soon as it is published in namedLoggers (findLogger takes
+            // benefit of the ConcurrentHashMap implementation of namedLoggers
+            // to avoid synchronizing on retrieval when that is possible).
+            namedLoggers.put(name, ref);
             return true;
         }
 
-        synchronized void removeLoggerRef(String name, LoggerWeakRef ref) {
+        void removeLoggerRef(String name, LoggerWeakRef ref) {
             namedLoggers.remove(name, ref);
         }
 
@@ -800,7 +831,7 @@
             // ensure that this context is properly initialized before
             // returning logger names.
             ensureInitialized();
-            return namedLoggers.keys();
+            return Collections.enumeration(namedLoggers.keySet());
         }
 
         // If logger.getUseParentHandlers() returns 'true' and any of the logger's
@@ -1379,7 +1410,19 @@
         reset();
 
         // Load the properties
-        props.load(ins);
+        try {
+            props.load(ins);
+        } catch (IllegalArgumentException x) {
+            // props.load may throw an IllegalArgumentException if the stream
+            // contains malformed Unicode escape sequences.
+            // We wrap that in an IOException as readConfiguration is
+            // specified to throw IOException if there are problems reading
+            // from the stream.
+            // Note: new IOException(x.getMessage(), x) allow us to get a more
+            // concise error message than new IOException(x);
+            throw new IOException(x.getMessage(), x);
+        }
+
         // Instantiate new configuration objects.
         String names[] = parseClassNames("config");
 
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/SessionManager.java	Wed Jul 05 20:27:20 2017 +0200
@@ -90,6 +90,7 @@
 
     // maximum number of active sessions during this invocation, for debugging
     private int maxActiveSessions;
+    private Object maxActiveSessionsLock;
 
     // flags to use in the C_OpenSession() call
     private final long openSessionFlags;
@@ -113,6 +114,9 @@
         this.token = token;
         this.objSessions = new Pool(this);
         this.opSessions = new Pool(this);
+        if (debug != null) {
+            maxActiveSessionsLock = new Object();
+        }
     }
 
     // returns whether only a fairly low number of sessions are
@@ -212,7 +216,7 @@
         Session session = new Session(token, id);
         activeSessions.incrementAndGet();
         if (debug != null) {
-            synchronized(this) {
+            synchronized(maxActiveSessionsLock) {
                 if (activeSessions.get() > maxActiveSessions) {
                     maxActiveSessions = activeSessions.get();
                     if (maxActiveSessions % 10 == 0) {
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipConstants.java	Wed Jul 05 20:27:20 2017 +0200
@@ -184,10 +184,19 @@
         return (LG(b, n)) | (LG(b, n + 4) << 32);
     }
 
-    static final long GETSIG(byte[] b) {
-        return LG(b, 0);
+    static long getSig(byte[] b, int n) { return LG(b, n); }
+
+    private static boolean pkSigAt(byte[] b, int n, int b1, int b2) {
+        return b[n] == 'P' & b[n + 1] == 'K' & b[n + 2] == b1 & b[n + 3] == b2;
     }
 
+    static boolean cenSigAt(byte[] b, int n) { return pkSigAt(b, n, 1, 2); }
+    static boolean locSigAt(byte[] b, int n) { return pkSigAt(b, n, 3, 4); }
+    static boolean endSigAt(byte[] b, int n) { return pkSigAt(b, n, 5, 6); }
+    static boolean extSigAt(byte[] b, int n) { return pkSigAt(b, n, 7, 8); }
+    static boolean end64SigAt(byte[] b, int n) { return pkSigAt(b, n, 6, 6); }
+    static boolean locator64SigAt(byte[] b, int n) { return pkSigAt(b, n, 6, 7); }
+
     // local file (LOC) header fields
     static final long LOCSIG(byte[] b) { return LG(b, 0); } // signature
     static final int  LOCVER(byte[] b) { return SH(b, 4); } // version needed to extract
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1060,7 +1060,7 @@
         int pos = 0;
         int limit = cen.length - ENDHDR;
         while (pos < limit) {
-            if (CENSIG(cen, pos) != CENSIG)
+            if (!cenSigAt(cen, pos))
                 zerror("invalid CEN header (bad signature)");
             int method = CENHOW(cen, pos);
             int nlen   = CENNAM(cen, pos);
@@ -1894,7 +1894,7 @@
             throws IOException
         {
             byte[] cen = zipfs.cen;
-            if (CENSIG(cen, pos) != CENSIG)
+            if (!cenSigAt(cen, pos))
                 zerror("invalid CEN header (bad signature)");
             versionMade = CENVEM(cen, pos);
             version     = CENVER(cen, pos);
@@ -2057,9 +2057,9 @@
             assert (buf.length >= LOCHDR);
             if (zipfs.readFullyAt(buf, 0, LOCHDR , pos) != LOCHDR)
                 throw new ZipException("loc: reading failed");
-            if (LOCSIG(buf) != LOCSIG)
+            if (!locSigAt(buf, 0))
                 throw new ZipException("loc: wrong sig ->"
-                                       + Long.toString(LOCSIG(buf), 16));
+                                       + Long.toString(getSig(buf, 0), 16));
             //startPos = pos;
             version  = LOCVER(buf);
             flag     = LOCFLG(buf);
@@ -2289,9 +2289,9 @@
                     if (zipfs.readFullyAt(buf, 0, buf.length , locoff)
                         != buf.length)
                         throw new ZipException("loc: reading failed");
-                    if (LOCSIG(buf) != LOCSIG)
+                    if (!locSigAt(buf, 0))
                         throw new ZipException("loc: wrong sig ->"
-                                           + Long.toString(LOCSIG(buf), 16));
+                                           + Long.toString(getSig(buf, 0), 16));
 
                     int locElen = LOCEXT(buf);
                     if (locElen < 9)    // EXTT is at lease 9 bytes
--- a/jdk/test/TEST.groups	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/TEST.groups	Wed Jul 05 20:27:20 2017 +0200
@@ -453,7 +453,6 @@
   java/util/jar/JarInputStream/ExtraFileInMetaInf.java \
   java/util/logging/TestLoggerWeakRefLeak.java \
   java/util/zip/3GBZipFiles.sh \
-  jdk/lambda/FDTest.java \
   jdk/lambda/separate/Compiler.java \
   sun/management/jmxremote/bootstrap/JvmstatCountersTest.java \
   sun/management/jmxremote/bootstrap/LocalManagementTest.java \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.html	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug        6271849
+  @summary    Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet ModalExcludedWindowClickTest.html
+  -->
+<head>
+<title>ModalExcludedWindowClickTest</title>
+</head>
+<body>
+
+<h1>ModalExcludedWindowClickTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="ModalExcludedWindowClickTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/ModalExcludedWindowClickTest/ModalExcludedWindowClickTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,291 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug       6271849
+  @summary   Tests that component in modal excluded Window which parent is blocked responses to mouse clicks.
+  @author    anton.tarasov@sun.com: area=awt.focus
+  @run       applet ModalExcludedWindowClickTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class ModalExcludedWindowClickTest extends Applet {
+    Robot robot;
+    Frame frame = new Frame("Frame");
+    Window w = new Window(frame);
+    Dialog d = new Dialog ((Dialog)null, "NullParentDialog", true);
+    Button button = new Button("Button");
+    boolean actionPerformed = false;
+
+    public static void main (String args[]) {
+        ModalExcludedWindowClickTest app = new ModalExcludedWindowClickTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is an AUTOMATIC test", "simply wait until it is done"});
+    }
+
+    public void start() {
+
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            Sysout.println("No testing on MToolkit.");
+            return;
+        }
+
+        button.addActionListener(new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    actionPerformed = true;
+                    Sysout.println(e.paramString());
+                }
+            });
+
+        EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    frame.setSize(200, 200);
+                    frame.setVisible(true);
+
+                    w.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
+                    w.add(button);
+                    w.setSize(200, 200);
+                    w.setLocation(230, 230);
+                    w.setVisible(true);
+
+                    d.setSize(200, 200);
+                    d.setLocation(0, 230);
+                    d.setVisible(true);
+
+                }
+            });
+
+        waitTillShown(d);
+
+        test();
+    }
+
+    void test() {
+        clickOn(button);
+        waitForIdle();
+        if (!actionPerformed) {
+            throw new RuntimeException("Test failed!");
+        }
+        Sysout.println("Test passed.");
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        Sysout.println("Clicking " + c);
+
+        if (c instanceof Frame) {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+        } else {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+        }
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        waitForIdle();
+    }
+    void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            } catch (IllegalComponentStateException e) {}
+        }
+    }
+    void waitForIdle() {
+        try {
+            robot.waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        }
+
+        // wait longer...
+        robot.delay(200);
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.html	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug        6272324
+  @summary    Modal excluded Window which decorated parent is blocked should be non-focusable.
+  @author     anton.tarasov@sun.com: area=awt.focus
+  @run        applet NonFocusableBlockedOwnerTest.html
+  -->
+<head>
+<title>NonFocusableBlockedOwnerTest</title>
+</head>
+<body>
+
+<h1>NonFocusableBlockedOwnerTest<br>Bug ID: 6272324</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="NonFocusableBlockedOwnerTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/NonFocusableBlockedOwnerTest/NonFocusableBlockedOwnerTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug       6272324
+  @summary   Modal excluded Window which decorated parent is blocked should be non-focusable.
+  @author    anton.tarasov@sun.com: area=awt.focus
+  @run       applet NonFocusableBlockedOwnerTest.html
+*/
+
+import java.applet.Applet;
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+
+public class NonFocusableBlockedOwnerTest extends Applet {
+    Robot robot;
+    Frame frame = new Frame("Modal Blocked Frame");
+    Dialog dialog = new Dialog(frame, "Modal Dialog", true);
+    Window excluded = new Window(frame);
+    Button button = new Button("button");
+
+    public static void main(String[] args) {
+        NonFocusableBlockedOwnerTest app = new NonFocusableBlockedOwnerTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is an AUTOMATIC test", "simply wait until it is done"});
+    }
+
+    public void start() {
+
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            Sysout.println("No testing on MToolkit.");
+            return;
+        }
+
+        try {
+            EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    frame.setSize(300, 200);
+                    frame.setVisible(true);
+
+                    excluded.setSize(300, 200);
+                    excluded.setLocation(0, 400);
+                    excluded.setModalExclusionType(Dialog.ModalExclusionType.TOOLKIT_EXCLUDE);
+                    excluded.setLayout(new FlowLayout());
+                    excluded.add(button);
+                    excluded.setVisible(true);
+
+                    dialog.setSize(200, 100);
+                    dialog.setLocation(0, 250);
+                    dialog.setVisible(true);
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+        waitTillShown(dialog);
+        clickOn(button);
+        if (frame == KeyboardFocusManager.getCurrentKeyboardFocusManager().getActiveWindow()) {
+            throw new RuntimeException("Test failed!");
+        }
+        if (excluded == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow()) {
+            throw new RuntimeException("Test failed!");
+        }
+        if (button == KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner()) {
+            throw new RuntimeException("Test failed!");
+        }
+        Sysout.println("Test passed.");
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        Sysout.println("Clicking " + c);
+
+        if (c instanceof Frame) {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + ((Frame)c).getInsets().top/2);
+        } else {
+            robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+        }
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        waitForIdle();
+    }
+
+    void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException e) {
+                throw new RuntimeException(e);
+            } catch (IllegalComponentStateException e) {}
+        }
+    }
+    void waitForIdle() {
+        try {
+            robot.waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        }
+
+        // wait longer...
+        robot.delay(200);
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.html	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--
+  @test
+  @bug        6253913
+  @summary    Tests that a Window shown before its owner is focusable.
+  @author     anton.tarasov@sun.com: area=awt-focus
+  @run        applet WindowUpdateFocusabilityTest.html
+  -->
+<head>
+<title>WindowUpdateFocusabilityTest</title>
+</head>
+<body>
+ 
+<h1>WindowUpdateFocusabilityTest<br>Bug ID: 6253913</h1>
+ 
+<p>See the dialog box (usually in upper left corner) for instructions</p>
+ 
+<APPLET CODE=WindowUpdateFocusabilityTest.class WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Focus/WindowUpdateFocusabilityTest/WindowUpdateFocusabilityTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug       6253913
+  @summary   Tests that a Window shown before its owner is focusable.
+  @author    anton.tarasov@sun.com: area=awt-focus
+  @run       applet WindowUpdateFocusabilityTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.*;
+
+public class WindowUpdateFocusabilityTest extends Applet {
+    Robot robot;
+    boolean focusGained = false;
+    final Object monitor = new Object();
+    FocusListener listener = new FocusAdapter () {
+            public void focusGained(FocusEvent e) {
+                Sysout.println(e.toString());
+                synchronized (monitor) {
+                    focusGained = true;
+                    monitor.notifyAll();
+                }
+            }
+        };
+
+    public static void main(String[] args) {
+        WindowUpdateFocusabilityTest app = new WindowUpdateFocusabilityTest();
+        app.init();
+        app.start();
+    }
+
+    public void init() {
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: couldn't create robot");
+        }
+        // Create instructions for the user here, as well as set up
+        // the environment -- set the layout manager, add buttons,
+        // etc.
+        this.setLayout (new BorderLayout ());
+        Sysout.createDialogWithInstructions(new String[]
+            {"This is an automatic test. Simply wait until it's done."});
+    }
+
+    public void start() {
+        if ("sun.awt.motif.MToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName())) {
+            Sysout.println("No testing on Motif.");
+            return;
+        }
+
+        test(new Frame("Frame owner"));
+        Frame dialog_owner = new Frame("dialog's owner");
+        test(new Dialog(dialog_owner));
+        test(new Dialog(dialog_owner, Dialog.ModalityType.DOCUMENT_MODAL));
+        test(new Dialog(dialog_owner, Dialog.ModalityType.APPLICATION_MODAL));
+        test(new Dialog(dialog_owner, Dialog.ModalityType.TOOLKIT_MODAL));
+        test(new Dialog((Window) null, Dialog.ModalityType.MODELESS));
+        test(new Dialog((Window) null, Dialog.ModalityType.DOCUMENT_MODAL));
+        test(new Dialog((Window) null, Dialog.ModalityType.APPLICATION_MODAL));
+        test(new Dialog((Window) null, Dialog.ModalityType.TOOLKIT_MODAL));
+        dialog_owner.dispose();
+    }
+
+    private void test(final Window owner)
+    {
+        Window window0 = new Window(owner); // will not be shown
+        Window window1 = new Window(window0);
+        Window window2 = new Window(window1);
+        Button button1 = new Button("button1");
+        Button button2 = new Button("button2");
+        button1.addFocusListener(listener);
+        button2.addFocusListener(listener);
+
+        owner.setBounds(800, 0, 100, 100);
+        window1.setBounds(800, 300, 100, 100);
+        window2.setBounds(800, 150, 100, 100);
+
+        window1.add(button1);
+        window2.add(button2);
+
+        window2.setVisible(true);
+        window1.setVisible(true);
+        EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    owner.setVisible(true);
+                }
+            });
+
+        try {
+            EventQueue.invokeAndWait(new Runnable() {
+                    public void run() {
+                        // do nothing just wait until previous invokeLater will be executed
+                    }
+                });
+        } catch (InterruptedException ie) {
+            throw new RuntimeException(ie);
+        } catch (InvocationTargetException ite) {
+            throw new RuntimeException(ite);
+        }
+
+        robot.delay(1000);
+
+        clickOn(button1);
+
+        if (!isFocusGained()) {
+            throw new RuntimeException("Test failed: window1 is not focusable!");
+        }
+
+        focusGained = false;
+        clickOn(button2);
+
+        if (!isFocusGained()) {
+            throw new RuntimeException("Test failed: window2 is not focusable!");
+        }
+
+        Sysout.println("Test for " + owner.getName() + " passed.");
+        owner.dispose();
+    }
+
+    void clickOn(Component c) {
+        Point p = c.getLocationOnScreen();
+        Dimension d = c.getSize();
+
+        Sysout.println("Clicking " + c);
+
+        robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2));
+
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+        waitForIdle();
+    }
+
+    void waitForIdle() {
+        try {
+            robot.waitForIdle();
+            robot.delay(50);
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            Sysout.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        }
+    }
+
+    boolean isFocusGained() {
+        synchronized (monitor) {
+            if (!focusGained) {
+                try {
+                    monitor.wait(3000);
+                } catch (InterruptedException e) {
+                    Sysout.println("Interrupted unexpectedly!");
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+        return focusGained;
+    }
+}
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
--- a/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -192,8 +192,7 @@
     }
     private void waitForIdle() {
         try {
-            Toolkit.getDefaultToolkit().sync();
-            sun.awt.SunToolkit.flushPendingEvents();
+            robot.waitForIdle();
             EventQueue.invokeAndWait( new Runnable() {
                                             public void run() {
                                                 // dummy implementation
--- a/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -23,13 +23,16 @@
 
 import java.awt.Color;
 import java.awt.Dialog;
+import java.awt.Frame;
 import java.awt.Graphics;
 import java.awt.Graphics2D;
 import java.awt.Panel;
 import java.awt.Rectangle;
 import java.awt.Robot;
 import java.awt.SplashScreen;
+import java.awt.TextField;
 import java.awt.Window;
+import java.awt.event.KeyEvent;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import javax.imageio.ImageIO;
@@ -37,7 +40,7 @@
 
 /**
  * @test
- * @bug 8043869
+ * @bug 8043869 8075244
  * @author Alexander Scherbatiy
  * @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
  * support
@@ -45,6 +48,7 @@
  * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
  * @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
  * @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
+ * @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_FOCUS
  */
 public class MultiResolutionSplashTest {
 
@@ -69,6 +73,9 @@
                 int index = Integer.parseInt(args[1]);
                 testSplash(tests[index]);
                 break;
+            case "TEST_FOCUS":
+                testFocus();
+                break;
             default:
                 throw new RuntimeException("Unknown test: " + test);
         }
@@ -92,12 +99,49 @@
         float scaleFactor = getScaleFactor();
         Color testColor = (1 < scaleFactor) ? test.color2x : test.color1x;
 
-        if (!testColor.equals(splashScreenColor)) {
+        if (!compare(testColor, splashScreenColor)) {
             throw new RuntimeException(
                     "Image with wrong resolution is used for splash screen!");
         }
     }
 
+    static void testFocus() throws Exception {
+
+        System.out.println("Focus Test!");
+        Robot robot = new Robot();
+        robot.setAutoDelay(50);
+
+        Frame frame = new Frame();
+        frame.setSize(100, 100);
+        String test = "123";
+        TextField textField = new TextField(test);
+        frame.add(textField);
+        frame.setVisible(true);
+        robot.waitForIdle();
+
+        robot.keyPress(KeyEvent.VK_A);
+        robot.keyRelease(KeyEvent.VK_A);
+        robot.keyPress(KeyEvent.VK_B);
+        robot.keyRelease(KeyEvent.VK_B);
+        robot.waitForIdle();
+
+        frame.dispose();
+
+        if(!textField.getText().equals("ab")){
+            throw new RuntimeException("Focus is lost!");
+        }
+    }
+
+    static boolean compare(Color c1, Color c2){
+        return compare(c1.getRed(), c2.getRed())
+                && compare(c1.getGreen(), c2.getGreen())
+                && compare(c1.getBlue(), c2.getBlue());
+    }
+
+    static boolean compare(int n, int m){
+        return Math.abs(n - m) <= 50;
+    }
+
     static float getScaleFactor() {
 
         final Dialog dialog = new Dialog((Window) null);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AutoTestOnTop.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,795 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 4632143
+  @summary Unit test for the RFE window/frame/dialog always on top
+  @author dom@sparc.spb.su: area=awt.toplevel
+  @run main AutoTestOnTop
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.lang.reflect.*;
+import javax.swing.*;
+import java.util.Vector;
+
+/**
+ * @author tav@sparc.spb.su
+ * @author dom@sparc.spb.su
+ * Tests that always-on-top windows combine correctly with different kinds of window in different styles and conditions.
+ *
+ * !!! WARNING !!!
+ * The test fails sometimes because the toFront() method doesn't guarantee
+ * that after its invocation the frame will be placed above all other windows.
+ */
+public class AutoTestOnTop {
+    static Window topw;
+    static Frame  parentw = new Frame();
+    static Window f;
+    static Frame  parentf = new Frame();
+
+    static Object  uncheckedSrc = new Object(); // used when no need to check event source
+    static Object  eventSrc = uncheckedSrc;
+    static boolean dispatchedCond;
+
+    static Semaphore STATE_SEMA = new Semaphore();
+    static Semaphore VIS_SEMA = new Semaphore();
+    static Vector errors = new Vector();
+
+    static boolean isUnix = false;
+
+    static StringBuffer msgError = new StringBuffer();
+    static StringBuffer msgCase = new StringBuffer();
+    static StringBuffer msgAction = new StringBuffer();
+    static StringBuffer msgFunc = new StringBuffer();
+    static StringBuffer msgVisibility = new StringBuffer();
+
+    static volatile int stageNum;
+    static volatile int actNum;
+    static volatile int testResult = 0;
+
+    static volatile boolean doCheckEvents;
+    static volatile boolean eventsCheckPassed;
+    static boolean[] eventsCheckInitVals = new boolean[] { // Whether events are checked for abcence or precence
+        true, true, true, true, true, false, false, false, false
+    };
+    static String[] msgEventsChecks = new String[] {
+        null, null, null, null, null,
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+        "expected WindowEvent.WINDOW_STATE_CHANGED hasn't been generated",
+    };
+
+    static final int stagesCount = 7;
+    static final int actionsCount = 9;
+
+    static Method[] preActions = new Method[actionsCount];
+    static Method[] postActions = new Method[actionsCount];
+    static Method[] isActionsAllowed = new Method[actionsCount];
+    static Method[] checksActionEvents = new Method[actionsCount];
+
+    static Robot robot;
+
+    static boolean doStartTest;
+    static String osName = System.getProperty("os.name");
+
+
+    public static void main(String[] args) {
+        checkTesting();
+
+    }
+
+    public static void performTesting() {
+        isUnix = osName.equals("Linux") || osName.equals("SunOS");
+
+        Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
+                public void eventDispatched(AWTEvent e) {
+                    if (e.getID() == MouseEvent.MOUSE_CLICKED) {
+                        if (eventSrc != null & eventSrc != uncheckedSrc && e.getSource() != eventSrc) {
+                            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": " + msgError);
+                            testResult = -1;
+                        }
+                        synchronized (eventSrc) {
+                            dispatchedCond = true;
+                            eventSrc.notify();
+                        }
+                    }
+
+                    if (doCheckEvents && (e.getSource() == topw || e.getSource() == f)) {
+
+                        //System.err.println("AWTEventListener: catched the event " + e);
+
+                        try {
+                            checksActionEvents[actNum].invoke(null, new Object[] {e});
+                        } catch (InvocationTargetException ite) {
+                            ite.printStackTrace();
+                        } catch (IllegalAccessException iae) {
+                            iae.printStackTrace();
+                        }
+                        return;
+                    }
+                }
+            }, 0xffffffffffffffffL);
+
+        Method[] allMethods;
+
+        try {
+            allMethods = AutoTestOnTop.class.getDeclaredMethods();
+        } catch (SecurityException se) {
+            throw new RuntimeException(se);
+        }
+
+        for (int i = 0; i < allMethods.length; i++) {
+            String name = allMethods[i].getName();
+            if (name.startsWith("preAction")) {
+                preActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            } else if (name.startsWith("postAction")) {
+                postActions[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            } else if (name.startsWith("isActionAllowed")) {
+                isActionsAllowed[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            } else if (name.startsWith("checkActionEvents")) {
+                checksActionEvents[name.charAt(name.length() - 1) - '0'] = allMethods[i];
+            }
+        }
+
+        f = new Frame("Auxiliary Frame");
+        f.setBounds(50, 0, 400, 50);
+        f.setVisible(true);
+        waitTillShown(f);
+
+        try {
+            robot = new Robot();
+        } catch (AWTException e) {
+            throw new RuntimeException("Error: unable to create robot", e);
+        }
+
+        mainTest();
+
+        if (testResult != 0) {
+            System.err.println("The following errors were encountered: ");
+            for (int i = 0; i < errors.size(); i++) {
+                System.err.println(errors.get(i).toString());
+            }
+            throw new RuntimeException("Test failed.");
+        } else {
+            System.err.println("Test PASSED.");
+        }
+    }
+
+    public static void mainTest() {
+//         stageNum = 0;
+//         for (int i = 0; i < 5; i++) {
+//             actNum = 2;
+//             System.err.println("************************* A C T I O N " + actNum + " *************************");
+//             doStage(stageNum, actNum);
+// //             pause(500);
+//             actNum = 3;
+//             System.err.println("************************* A C T I O N " + actNum + " *************************");
+//             doStage(stageNum, actNum);
+// //             pause(500);
+//         }
+        for (stageNum = 0; stageNum < stagesCount; stageNum++) {
+            System.err.println("************************* S T A G E " + stageNum + " *************************");
+            for (actNum = 0; actNum < actionsCount; actNum++) {
+                System.err.println("************************* A C T I O N " + actNum + " *************************");
+                doStage(stageNum, actNum);
+            } // for thru actNum
+        } // fow thru stageNum
+
+        eventSrc = null;
+    }
+
+    private static void doStage(int stageNum, int actNum) {
+        try {
+
+            if (!((Boolean)isActionsAllowed[actNum].invoke(null, new Object[0])).booleanValue()) {
+                System.err.println("Action skipped due to a platform limitations");
+                return;
+            }
+
+            STATE_SEMA.reset();
+            createWindow(stageNum);
+
+            //*************************
+            // Set window always-on-top
+            //*************************
+
+            preActions[actNum].invoke(null, new Object[0]);
+            setAlwaysOnTop(topw, true);
+            waitForIdle(true);
+
+            if (!topw.isAlwaysOnTopSupported()) return;
+
+            postActions[actNum].invoke(null, new Object[0]);
+            waitForIdle(false);
+
+            STATE_SEMA.reset();
+
+            testForAlwaysOnTop();
+
+            //*****************************
+            // Set window not always-on-top
+            //*****************************
+
+            preActions[actNum].invoke(null, new Object[0]);
+            setAlwaysOnTop(topw, false);
+            waitForIdle(true);
+            postActions[actNum].invoke(null, new Object[0]);
+            waitForIdle(false);
+            STATE_SEMA.reset();
+
+            testForNotAlwaysOnTop();
+
+        } catch (InvocationTargetException ite) {
+            ite.printStackTrace();
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    private static void checkTesting() {
+        if (Toolkit.getDefaultToolkit().isAlwaysOnTopSupported()) {
+            performTesting();
+        }
+    }
+
+    public static void testForAlwaysOnTop() {
+        System.err.println("Checking for always-on-top " + topw);
+
+        ensureInitialWinPosition(topw);
+
+        // Check that always-on-top window is topmost.
+        // - Click on always-on-top window on the windows cross area.
+        clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+                " window (1) always-on-top didn't make it topmost");
+
+        // Check that we can't change z-order of always-on-top window.
+        // - a) Try to put the other window on the top.
+        f.toFront();
+        clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+        pause(300);
+
+        // - b) Click on always-on-top window on the windows cross area.
+        clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+                " window (1) always-on-top didn't make it such");
+
+        // Ask for always-on-top property
+        if (isAlwaysOnTop(topw) != true)
+                error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+                                   ": isAlwaysOnTop() returned 'false' for window (1) set always-on-top at state "
+                                   + msgVisibility);
+    }
+
+    public static void testForNotAlwaysOnTop() {
+        System.err.println("Checking for non always-on-top of " + topw);
+        ensureInitialWinPosition(topw);
+
+        if (msgVisibility.equals("visible") && actNum != 2) {
+            // Check that the window remains topmost.
+            // - click on the window on the windows cross area.
+            clickOn(topw, f, 10, 30, "setting " + msgVisibility +
+                    " window (1) not always-on-top didn't keep it topmost");
+        }
+
+        // Check that we can change z-order of not always-on-top window.
+        // - a) try to put the other window on the top.
+        f.toFront();
+        clickOn(uncheckedSrc, f, 190, 30, ""); // coz toFront() works not always
+        pause(300);
+
+        // - b) click on not always-on-top window on the windows cross area.
+        clickOn(f, f, 10, 30, "setting " + msgVisibility +
+                " window (1) not always-on-top didn't make it such");
+
+        // Ask for always-on-top property
+        if (isAlwaysOnTop(topw) != false)
+            error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase + ": " + msgAction +
+                               ": isAlwaysOnTop() returned 'true' for window (1) set not always-on-top at state "
+                               + msgVisibility);
+    }
+
+
+    private static void createWindow(int stageNum) {
+        // Free native resourses
+        if (topw != null && topw.isVisible()) {
+            topw.dispose();
+        }
+
+        switch (stageNum) {
+        case 0:
+            topw = new Frame("Top Frame");
+            msgCase.replace(0, msgCase.length(), "Frame (1) over Frame (2)");
+            break;
+        case 1:
+            topw = new JFrame("Top JFrame");
+            msgCase.replace(0, msgCase.length(), "JFrame (1) over Frame (2)");
+            break;
+        case 2:
+            topw = new Dialog(parentw, "Top Dialog");
+            msgCase.replace(0, msgCase.length(), "Dialog (1) over Frame (2)");
+            break;
+        case 3:
+            topw = new JDialog(parentw, "Top JDialog");
+            msgCase.replace(0, msgCase.length(), "JDialog (1) over Frame (2)");
+            break;
+        case 4:
+            topw = new Frame("Top Frame");
+            f.dispose();
+            f = new Dialog(parentf, "Auxiliary Dialog");
+            f.setBounds(50, 0, 250, 50);
+            f.setVisible(true);
+            waitTillShown(f);
+            msgCase.replace(0, msgCase.length(), "Frame (1) over Dialog (2)");
+            break;
+        case 5:
+            topw = new Window(parentw);
+            msgCase.replace(0, msgCase.length(), "Window (1) over Frame (2)");
+            break;
+        case 6:
+            topw = new JWindow(parentw);
+            msgCase.replace(0, msgCase.length(), "JWindow (1) over Frame (2)");
+            break;
+        }
+        topw.addWindowStateListener(new WindowAdapter() {
+                public void windowStateChanged(WindowEvent e) {
+                    System.err.println("* " + e);
+                    STATE_SEMA.raise();
+                }
+            });
+        topw.setSize(200, 50);
+    }
+
+    /**
+     * 0: setting always-on-top to invisible window
+     * 1: setting always-on-top to visible window
+     * 2: always-on-top on visible non-focusable window
+     * 3: always-on-top on visible, dragging topw after that
+     * 4: always-on-top on visible, dragging f after that
+     * 5: always-on-top on (visible, maximized), make normal after that
+     * 6: always-on-top on (visible, iconified), make normal after that
+     * 7: always-on-top on visible, iconify/deiconify after that
+     * 8: always-on-top on visible, maximize/restore after that
+     */
+    public static void preAction_0() {
+        topw.setVisible(false);
+    }
+    public static void postAction_0() {
+        if (topw.isShowing()) {
+            error("Test failed: stage #" + stageNum + ", action #" + actNum + ": " + msgCase +
+                               ": no actions with windows: changing always-on-top property at window (1) state 'invisible' makes window (1) visible");
+        }
+        setWindowVisible("no actions with windows", "invisible");
+    }
+    public static boolean isActionAllowed_0() {
+        // Window on Linux is always always-on-top!
+        return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+    }
+    public static void checkActionEvents_0(AWTEvent e) {
+        System.err.println(e.toString());
+   }
+
+    public static void preAction_1() {
+        setWindowVisible("no actions with windows", "visible");
+    }
+    public static void postAction_1() {}
+    public static boolean isActionAllowed_1() {
+        return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount );
+    }
+    public static void checkActionEvents_1(AWTEvent e) {
+        System.err.println(e.toString());
+        if (e instanceof PaintEvent) {
+            return;
+        }
+        eventsCheckPassed = false;
+        error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                           ":  unexpected event " + e + " was generated");
+    }
+
+    public static void preAction_2() {
+        setWindowVisible("when window (1) set not focusable", "visible");
+        topw.setFocusableWindowState(false);
+        f.toFront();
+        pause(300);
+    }
+    public static void postAction_2() {}
+    public static boolean isActionAllowed_2() {
+        return !((stageNum == 5 || stageNum == 6) && isUnix) && (stageNum < stagesCount);
+    }
+    public static void checkActionEvents_2(AWTEvent e) {
+        System.err.println(e.toString());
+        if ( (e.getID() >= FocusEvent.FOCUS_FIRST && e.getID() <= FocusEvent.FOCUS_LAST) ||
+             (e.getID() == WindowEvent.WINDOW_LOST_FOCUS && e.getID() == WindowEvent.WINDOW_GAINED_FOCUS)) {
+            eventsCheckPassed = false;
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " +
+                               msgAction + ": after call " + msgFunc +
+                               ": unexpected event " + e + " was generated");
+        }
+    }
+
+    public static void preAction_3() {
+        setWindowVisible("after dragging",  "visible");
+    }
+    public static void postAction_3() {
+        Point p = topw.getLocationOnScreen();
+        int x = p.x + 40, y = p.y + 5;
+
+        try {                      // Take a pause to avoid double click
+            Thread.sleep(500);     // when called one after another.
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        } catch (IllegalComponentStateException e) {
+            e.printStackTrace();
+        }
+
+        // Drag the window.
+        robot.mouseMove(x, y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(200, 50);
+        robot.mouseMove(x, y);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+    }
+    public static boolean isActionAllowed_3() {
+        return (stageNum < 5);
+    }
+    public static void checkActionEvents_3(AWTEvent e) {
+        System.err.println(e.toString());
+    }
+
+    public static void preAction_4() {
+        setWindowVisible("after dragging window (2)",  "visible");
+    }
+    public static void postAction_4() {
+        Point p = f.getLocationOnScreen();
+        int x = p.x + 150, y = p.y + 5;
+
+        try {                      // Take a pause to avoid double click
+            Thread.sleep(500);     // when called one after another.
+        } catch (InterruptedException ie) {
+            ie.printStackTrace();
+        } catch (IllegalComponentStateException e) {
+            e.printStackTrace();
+        }
+
+        // Drag the window.
+        robot.mouseMove(x, y);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(200, 50);
+        robot.mouseMove(x, y);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        ensureInitialWinPosition(f);
+    }
+    public static boolean isActionAllowed_4() {
+        return !((stageNum == 5 || stageNum == 6) && isUnix);
+    }
+    public static void checkActionEvents_4(AWTEvent e) {
+        System.err.println(e.toString());
+    }
+
+    // Metacity has a bug not allowing to set a window to NORMAL state!!!
+
+    public static void preAction_5() {
+        setWindowVisible("at state 'maximized'",  "visible");
+        ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+        waitForStateChange();
+    }
+    public static void postAction_5() {
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        waitForStateChange();
+    }
+    public static boolean isActionAllowed_5() {
+        return (stageNum < 2);
+    }
+    public static void checkActionEvents_5(AWTEvent e) {
+        System.err.println("=" + e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+            eventsCheckPassed = true;
+        }
+    }
+
+    public static void preAction_6() {
+        setWindowVisible("at state 'iconified'",  "visible");
+        System.err.println("Iconifying " + topw);
+        ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to ICONIFIED hasn't been generated");
+        }
+    }
+    public static void postAction_6() {
+        System.err.println("Restoring " + topw);
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to NORMAL hasn't been generated");
+        }
+    }
+    public static boolean isActionAllowed_6() {
+        return (stageNum < 2 );
+    }
+    public static void checkActionEvents_6(AWTEvent e) {
+        System.err.println("+" + e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+            eventsCheckPassed = true;
+        }
+    }
+
+    public static void preAction_7() {
+        setWindowVisible("before state 'iconified'",  "visible");
+    }
+    public static void postAction_7() {
+        System.err.println("Setting iconified");
+        ((Frame)topw).setExtendedState(Frame.ICONIFIED);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to ICONIFIED hasn't been generated");
+        }
+        System.err.println("Setting normal");
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to NORMAL hasn't been generated");
+        }
+    }
+    public static boolean isActionAllowed_7() {
+        return (stageNum < 2);
+    }
+    public static void checkActionEvents_7(AWTEvent e) {
+        System.err.println(e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+            eventsCheckPassed = true;
+        }
+    }
+
+    public static void preAction_8() {
+        setWindowVisible("before state 'maximized'",  "visible");
+    }
+    public static void postAction_8() {
+        ((Frame)topw).setExtendedState(Frame.MAXIMIZED_BOTH);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to MAXIMIZED hasn't been generated");
+        }
+        ((Frame)topw).setExtendedState(Frame.NORMAL);
+        if (!waitForStateChange()) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call " + msgFunc +
+                               ":  state change to NORMAL hasn't been generated");
+        }
+    }
+    public static boolean isActionAllowed_8() {
+        return (stageNum < 2);
+    }
+    public static void checkActionEvents_8(AWTEvent e) {
+        System.err.println(e.toString());
+        if (e.getID() == WindowEvent.WINDOW_STATE_CHANGED) {
+           eventsCheckPassed = true;
+        }
+    }
+
+    //***************************************************************************
+
+    private static void setWindowVisible(String mAction, String mVisibility) {
+        msgAction.replace(0, msgAction.length(), mAction);
+        msgVisibility.replace(0, msgVisibility.length(), mVisibility);
+
+        topw.setVisible(true);
+        pause(100); // Needs for Sawfish
+        topw.setLocation(0, 0);
+        waitTillShown(topw);
+        f.toFront();
+        pause(300);
+    }
+
+    private static void clickOn(Object src, Window relwin, int x, int y, String errorStr) {
+        Point p = relwin.getLocationOnScreen();
+        int counter = 10;
+        while (--counter > 0) {
+            eventSrc = src;
+            msgError.replace(0, msgError.length(), errorStr);
+
+            robot.mouseMove(p.x + x, p.y + y);
+            robot.mousePress(InputEvent.BUTTON1_MASK);
+            robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+            synchronized (eventSrc) {
+                if (!dispatchedCond) {
+                    try {
+                        eventSrc.wait(1000);
+                    } catch (InterruptedException e) {
+                        e.printStackTrace();
+                    }
+                }
+                if (!dispatchedCond) {
+                    //System.err.println("clickOn: MOUSE_CLICKED event losed, trying to generate it again...");
+                    continue;
+                }
+                dispatchedCond = false;
+            }
+            break;
+        } // end while
+        if (counter <= 0) {
+            eventSrc = uncheckedSrc;
+            error("Test: internal error: could't catch MOUSE_CLICKED event. Skip testing this stage");
+        }
+    }
+
+    private static void setAlwaysOnTop(Window w, boolean value) {
+        System.err.println("Setting always on top on " + w + " to " + value);
+        robot.mouseMove(0, 100); // Move out of the window
+        msgFunc.replace(0, msgCase.length(), "setAlwaysOnTop()");
+        try {
+            w.setAlwaysOnTop(value);
+        } catch (Exception e) {
+            error("Test failed: stage#" + stageNum + "action #" + actNum + ": " + msgCase + ": " + msgAction +
+                               ": setAlwaysOnTop(" + value + ") called at state " + msgVisibility +
+                               " threw exeption " + e);
+        }
+    }
+
+    private static boolean isAlwaysOnTop(Window w) {
+        robot.mouseMove(0, 100); // Move out of the window
+        msgFunc.replace(0, msgCase.length(), "isAlwaysOnTop()");
+        boolean result = false;
+        try {
+            result = w.isAlwaysOnTop();
+        } catch (Exception e) {
+            error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction +
+                               ": isAlwaysOnTop() called at state " + msgVisibility +
+                               " threw exeption " + e);
+        }
+        return result;
+    }
+
+    private static void waitTillShown(Component c) {
+        while (true) {
+            try {
+                Thread.sleep(100);
+                c.getLocationOnScreen();
+                break;
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                break;
+            }
+        }
+    }
+
+    private static void waitForIdle(boolean doCheck) {
+        try {
+            robot.waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                } );
+        } catch(InterruptedException ite) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        } catch(InvocationTargetException ine) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ine.printStackTrace();
+        }
+        doCheckEvents = doCheck;
+
+        if (doCheck) {
+            eventsCheckPassed = eventsCheckInitVals[actNum]; // Initialize
+        } else if (!eventsCheckPassed &&
+                 msgEventsChecks[actNum] != null) {
+
+
+            // Some expected event hasn't been catched,
+            // so give it one more chance...
+            doCheckEvents = true;
+            pause(500);
+            doCheckEvents = false;
+
+            if (!eventsCheckPassed) {
+                testResult = -1;
+                error("Test failed: stage #" + stageNum + ", action # " + actNum + ": " + msgCase + ": " + msgAction + ": after call "
+                                   + msgFunc + ": " + msgEventsChecks[actNum]);
+            }
+        }
+    }
+
+    private static boolean waitForStateChange() {
+        System.err.println("------- Waiting for state change");
+        try {
+            STATE_SEMA.doWait(3000);
+        } catch (InterruptedException ie) {
+            System.err.println("Wait interrupted: " + ie);
+        }
+        boolean state = STATE_SEMA.getState();
+        STATE_SEMA.reset();
+        return state;
+    }
+
+    private static void ensureInitialWinPosition(Window w) {
+        int counter = 30;
+        while (w.getLocationOnScreen().y != 0 && --counter > 0) {
+            try {
+                Thread.sleep(100);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+                break;
+            }
+        }
+        if (counter <= 0) {
+            w.setLocation(0, 0);
+            pause(100);
+            System.err.println("Test: window set to initial position forcedly");
+        }
+    }
+
+    private static void pause(int mls) {
+        try {
+            Thread.sleep(mls);
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void error(String msg) {
+        errors.add(msg);
+        System.err.println(msg);
+    }
+}
+
+class Semaphore {
+    boolean state = false;
+    int waiting = 0;
+    public Semaphore() {
+    }
+    public synchronized void doWait() throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait();
+        waiting--;
+    }
+    public synchronized void doWait(int timeout) throws InterruptedException {
+        if (state) {
+            return;
+        }
+        waiting++;
+        wait(timeout);
+        waiting--;
+    }
+    public synchronized void raise() {
+        state = true;
+        if (waiting > 0) {
+            notifyAll();
+        }
+    }
+
+    public synchronized void doNotify() {
+        notifyAll();
+    }
+    public synchronized boolean getState() {
+        return state;
+    }
+
+    public synchronized void reset() {
+        state = false;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.html	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,43 @@
+<!--
+ Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+-->
+
+<html>
+<!--  
+  @test
+  @bug          4985250
+  @summary      COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+  @author       tav@sparc.spb.su
+  @run applet MovedResizedTardyEventTest.html
+  -->
+<head>
+<title>MovedResizedTardyEventTest</title>
+</head>
+<body>
+
+<h1>MovedResizedTardyEventTest<br>Bug ID: 4985250</h1>
+
+<p> See the dialog box (usually in upper left corner) for instructions</p>
+
+<APPLET CODE="MovedResizedTardyEventTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTardyEventTest/MovedResizedTardyEventTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug      4985250
+  @summary  COMPONENT_MOVED/RESIZED tardy events shouldn't be generated.
+  @author   tav@sparc.spb.su
+  @run applet MovedResizedTardyEventTest.html
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import java.applet.Applet;
+import java.lang.reflect.InvocationTargetException;
+
+public class MovedResizedTardyEventTest extends Applet {
+    Frame f1 = new Frame("F-1");
+    Frame f2 = new Frame("F-2");
+
+    boolean eventFlag = false;
+
+    public static void main(String[] args) {
+        Applet a = new MovedResizedTardyEventTest();
+        a.start();
+    }
+
+    public void start() {
+        f1.setVisible(true);
+        f2.setVisible(true);
+
+        try {
+            Thread.sleep(500);
+        } catch (InterruptedException e) {}
+
+        f1.addComponentListener(new ComponentAdapter() {
+                public void componentMoved(ComponentEvent e) {
+                    MovedResizedTardyEventTest.this.eventFlag = true;
+                    System.err.println(e);
+                }
+                public void componentResized(ComponentEvent e) {
+                    MovedResizedTardyEventTest.this.eventFlag = true;
+                    System.err.println(e);
+                }
+            });
+
+        f1.toFront();
+
+        waitForIdle();
+
+        try { // wait more...
+            Thread.sleep(500);
+        } catch (InterruptedException e) {}
+
+        if (eventFlag) {
+            throw new RuntimeException("Test failed!");
+        }
+    }
+
+    void waitForIdle() {
+        try {
+            (new Robot()).waitForIdle();
+            EventQueue.invokeAndWait( new Runnable() {
+                    public void run() {} // Dummy implementation
+                });
+        } catch(InterruptedException ie) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ie.printStackTrace();
+        } catch(InvocationTargetException ite) {
+            System.err.println("waitForIdle, non-fatal exception caught:");
+            ite.printStackTrace();
+        } catch(AWTException rex) {
+            rex.printStackTrace();
+            throw new RuntimeException("unexpected exception");
+        }
+    }
+}
--- a/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/java/awt/event/KeyEvent/AltCharAcceleratorTest/AltCharAcceleratorTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -29,8 +29,6 @@
 @run main AltCharAcceleratorTest
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
@@ -103,13 +101,12 @@
     }
 
     void test() throws Exception {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Robot robot = new Robot();
+        robot.setAutoDelay(100);
+        robot.waitForIdle();
 
         focusLatch.await(5, TimeUnit.SECONDS);
 
-        Robot robot = new Robot();
-        robot.setAutoDelay(100);
-
         robot.keyPress(KeyEvent.VK_ALT);
         robot.keyPress(KeyEvent.VK_T);
         robot.keyRelease(KeyEvent.VK_T);
@@ -133,4 +130,4 @@
         AltCharAcceleratorTest t = new AltCharAcceleratorTest();
         t.test();
     }
-}
\ No newline at end of file
+}
--- a/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/java/awt/keyboard/EqualKeyCode/EqualKeyCode.java	Wed Jul 05 20:27:20 2017 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,18 +24,14 @@
 /*
   @test
   @bug 6799551
-  @library ../../regtesthelpers
-  @build Util Sysout
   @summary Extended key codes for small letters undefined
   @author Andrei Dmitriev: area=awt.keyboard
   @run main EqualKeyCode
 */
 
 
-import sun.awt.*;
 import java.awt.*;
-import test.java.awt.regtesthelpers.Util;
-import test.java.awt.regtesthelpers.Sysout;
+import java.awt.event.KeyEvent;
 
 public class EqualKeyCode {
 
@@ -46,13 +42,13 @@
             char cSmall = LETTERS.charAt(i);
             char cLarge = Character.toUpperCase(cSmall);
 
-            int iSmall = ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall);
-            int iLarge = ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge);
+            int iSmall = KeyEvent.getExtendedKeyCodeForChar(cSmall);
+            int iLarge = KeyEvent.getExtendedKeyCodeForChar(cLarge);
 
             System.out.print(" " + cSmall + ":" + iSmall + " ---- ");
             System.out.println(" " + cLarge + " : " + iLarge);
-            if (ExtendedKeyCodes.getExtendedKeyCodeForChar(cSmall) !=
-                ExtendedKeyCodes.getExtendedKeyCodeForChar(cLarge))
+            if (KeyEvent.getExtendedKeyCodeForChar(cSmall) !=
+                KeyEvent.getExtendedKeyCodeForChar(cLarge))
             {
                 throw new RuntimeException("ExtendedKeyCode doesn't exist or doesn't match between capital and small letters.");
             }
--- a/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/java/nio/channels/DatagramChannel/MulticastSendReceiveTests.java	Wed Jul 05 20:27:20 2017 +0200
@@ -97,7 +97,7 @@
                 // no datagram received
                 if (sa == null) {
                     if (expectedSender != null) {
-                        throw new RuntimeException("Expected message not recieved");
+                        throw new RuntimeException("Expected message not received");
                     }
                     System.out.println("No message received (correct)");
                     return;
@@ -109,10 +109,15 @@
                 buf.flip();
                 byte[] bytes = new byte[buf.remaining()];
                 buf.get(bytes);
-                int receivedId = Integer.parseInt(new String(bytes));
-
-                System.out.format("Received message from %s (id=0x%x)\n",
-                    sender, receivedId);
+                String s = new String(bytes, "UTF-8");
+                int receivedId = -1;
+                try {
+                    receivedId = Integer.parseInt(s);
+                    System.out.format("Received message from %s (id=0x%x)\n",
+                            sender, receivedId);
+                } catch (NumberFormatException x) {
+                    System.out.format("Received message from %s (msg=%s)\n", sender, s);
+                }
 
                 if (expectedSender == null) {
                     if (receivedId == id)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Calendar/Bug8075548.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8075548
+ * @summary Make sure that the format form of month names are produced when there are
+ *          no stand-alone ones available.
+ */
+
+import java.text.*;
+import java.util.*;
+import static java.util.Calendar.*;
+
+public class Bug8075548 {
+    static int errors = 0;
+
+    public static void main(String[] args) throws Throwable {
+        Date date = new SimpleDateFormat("yyyy-MM-dd", Locale.US).parse("2010-09-15");
+        String[][] FORMAT_PAIRS = {
+            { "LLLL", "MMMM" },
+            { "LLL",  "MMM" }
+        };
+        Locale[] LOCALES = {
+            Locale.ENGLISH, Locale.FRENCH, Locale.GERMAN, Locale.JAPANESE
+        };
+
+        for (Locale locale : LOCALES) {
+            for (String[] formats : FORMAT_PAIRS) {
+                String el = new SimpleDateFormat(formats[0], locale).format(date);
+                String em = new SimpleDateFormat(formats[1], locale).format(date);
+                if (!el.equals(em)) {
+                    errors++;
+                    System.err.println(locale + ": " +
+                                       formats[0] + " -> " + el + ", " +
+                                       formats[1] + " -> " + em);
+                }
+            }
+        }
+
+        // Test Calendar.getDisplayName() and .getDisplayNames().
+        for (Locale locale : LOCALES) {
+            testDisplayNames(locale, LONG_FORMAT, LONG_STANDALONE);
+            testDisplayNames(locale, SHORT_FORMAT, SHORT_STANDALONE);
+            testDisplayNames(locale, NARROW_FORMAT, NARROW_STANDALONE);
+        }
+
+        if (errors > 0) {
+            throw new RuntimeException("Failed");
+        }
+    }
+
+    private static void testDisplayNames(Locale locale, int formatStyle, int standaloneStyle) {
+        Map<String, Integer> map = new HashMap<>();
+        for (int month = JANUARY; month <= DECEMBER; month++) {
+            Calendar cal = new GregorianCalendar(2015, month, 1);
+            String format = cal.getDisplayName(MONTH, formatStyle, locale);
+            String standalone = cal.getDisplayName(MONTH, standaloneStyle, locale);
+            if (!format.equals(standalone)) {
+                System.err.println("Calendar.getDisplayName: " + (month+1) +
+                                   ", locale=" + locale +
+                                   ", format=" + format + ", standalone=" + standalone);
+                errors++;
+            }
+            if (standalone != null) {
+                map.put(standalone, month);
+            }
+        }
+        if (formatStyle == NARROW_FORMAT) {
+            // Narrow styles don't support unique names.
+            // (e.g., "J" for JANUARY, JUNE, and JULY)
+            return;
+        }
+        Calendar cal = new GregorianCalendar(2015, JANUARY, 1);
+        Map<String, Integer> mapStandalone = cal.getDisplayNames(MONTH, standaloneStyle, locale);
+        if (!map.equals(mapStandalone)) {
+            System.err.printf("Calendar.getDisplayNames: locale=%s%n    map=%s%n    mapStandalone=%s%n",
+                              locale, map, mapStandalone);
+            errors++;
+        }
+        Map<String, Integer> mapAll = cal.getDisplayNames(MONTH, ALL_STYLES, locale);
+        if (!mapAll.entrySet().containsAll(map.entrySet())) {
+            System.err.printf("Calendar.getDisplayNames: locale=%s%n    map=%s%n    mapAll=%s%n",
+                              locale, map, mapAll);
+            errors++;
+        }
+    }
+}
--- a/jdk/test/java/util/Calendar/NarrowNamesTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/java/util/Calendar/NarrowNamesTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -86,7 +86,19 @@
                 "\u6728",
                 "\u91d1",
                 "\u571f");
-        testMap(THTH, MONTH, NARROW_FORMAT); // expect null
+        testMap(THTH, MONTH, NARROW_FORMAT,
+                "\u0e21.\u0e04.",
+                "\u0e01.\u0e1e.",
+                "\u0e21\u0e35.\u0e04.",
+                "\u0e40\u0e21.\u0e22.",
+                "\u0e1e.\u0e04.",
+                "\u0e21\u0e34.\u0e22",  // no last dot
+                "\u0e01.\u0e04.",
+                "\u0e2a.\u0e04.",
+                "\u0e01.\u0e22.",
+                "\u0e15.\u0e04.",
+                "\u0e1e.\u0e22.",
+                "\u0e18.\u0e04.");
         testMap(THTH, MONTH, NARROW_STANDALONE,
                 "\u0e21.\u0e04.",
                 "\u0e01.\u0e1e.",
@@ -146,7 +158,7 @@
         Calendar cal = Calendar.getInstance(locale);
         Map<String, Integer> got = cal.getDisplayNames(field, style, locale);
         if (!(expectedMap == null && got == null)
-            && !expectedMap.equals(got)) {
+            && !(expectedMap != null && expectedMap.equals(got))) {
             System.err.printf("testMap: locale=%s, field=%d, style=%d, expected=%s, got=%s%n",
                               locale, field, style, expectedMap, got);
             errors++;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Map/FunctionalCMEs.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2015 Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Arrays;
+import java.util.ConcurrentModificationException;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.function.BiFunction;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.DataProvider;
+
+/**
+ * @test
+ * @bug 8071667
+ * @summary Ensure that ConcurrentModificationExceptions are thrown as specified from Map methods that accept Functions
+ * @author bchristi
+ * @build Defaults
+ * @run testng FunctionalCMEs
+ */
+public class FunctionalCMEs {
+    final static String KEY = "key";
+
+    @DataProvider(name = "Maps", parallel = true)
+    private static Iterator<Object[]> makeMaps() {
+        return Arrays.asList(
+                // Test maps that CME
+                new Object[]{new HashMap<>(), true},
+                new Object[]{new Hashtable<>(), true},
+                new Object[]{new LinkedHashMap<>(), true},
+                // Test default Map methods - no CME
+                new Object[]{new Defaults.ExtendsAbstractMap<>(), false}
+        ).iterator();
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testComputeIfAbsent(Map<String,String> map, boolean expectCME) {
+        checkCME(() -> {
+            map.computeIfAbsent(KEY, k -> {
+                putToForceRehash(map);
+                return "computedValue";
+            });
+        }, expectCME);
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testCompute(Map<String,String> map, boolean expectCME) {
+        checkCME(() -> {
+            map.compute(KEY, mkBiFunc(map));
+        }, expectCME);
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testComputeWithKeyMapped(Map<String,String> map, boolean expectCME) {
+        map.put(KEY, "firstValue");
+        checkCME(() -> {
+            map.compute(KEY, mkBiFunc(map));
+        }, expectCME);
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testComputeIfPresent(Map<String,String> map, boolean expectCME) {
+        map.put(KEY, "firstValue");
+        checkCME(() -> {
+           map.computeIfPresent(KEY, mkBiFunc(map));
+        }, expectCME);
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testMerge(Map<String,String> map, boolean expectCME) {
+        map.put(KEY, "firstValue");
+        checkCME(() -> {
+            map.merge(KEY, "nextValue", mkBiFunc(map));
+        }, expectCME);
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testForEach(Map<String,String> map, boolean ignored) {
+        checkCME(() -> {
+            map.put(KEY, "firstValue");
+            putToForceRehash(map);
+            map.forEach((k,v) -> {
+                map.remove(KEY);
+            });
+        }, true);
+    }
+
+    @Test(dataProvider = "Maps")
+    public void testReplaceAll(Map<String,String> map, boolean ignored) {
+        checkCME(() -> {
+            map.put(KEY, "firstValue");
+            putToForceRehash(map);
+            map.replaceAll((k,v) -> {
+                map.remove(KEY);
+                return "computedValue";
+            });
+        },true);
+    }
+
+    private static void checkCME(Runnable code, boolean expectCME) {
+        try {
+            code.run();
+        } catch (ConcurrentModificationException cme) {
+            if (expectCME) { return; } else { throw cme; }
+        }
+        if (expectCME) {
+            throw new RuntimeException("Expected CME, but wasn't thrown");
+        }
+    }
+
+    private static BiFunction<String,String,String> mkBiFunc(Map<String,String> map) {
+        return (k,v) -> {
+            putToForceRehash(map);
+            return "computedValue";
+        };
+    }
+
+    private static void putToForceRehash(Map<String,String> map) {
+        for (int i = 0; i < 64; ++i) {
+            map.put(i + "", "value");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LogManager/Configuration/InvalidEscapeConfigurationTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.UncheckedIOException;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.Properties;
+import java.util.logging.LogManager;
+
+
+/**
+ * @test
+ * @bug 8075810
+ * @run main/othervm InvalidEscapeConfigurationTest
+ * @author danielfuchs
+ */
+public class InvalidEscapeConfigurationTest {
+
+    public static void main(String[] args)
+            throws UnsupportedEncodingException, IOException {
+        String[] validEscapes = {
+            "com.f\\u006fo.level = INF\\u004f",
+            "com.f\\u006fo.level = INFO",
+            "com.foo.level = INF\\u004f"
+        };
+        String[] invalidEscapes = {
+            "com.fo\\u0O6f.level = INF\\u0O4f",
+            "com.fo\\u0O6f.level = INFO",
+            "com.foo.level = INF\\u0O4f"
+        };
+        for (String line : validEscapes) {
+            test(line, true);
+        }
+        for (String line : invalidEscapes) {
+            test(line, false);
+        }
+        try {
+            Properties props = new Properties();
+            props.load((InputStream)null);
+            throw new RuntimeException("Properties.load(null): "
+                    + "NullPointerException exception not raised");
+        } catch (NullPointerException x) {
+            System.out.println("Properties.load(null): "
+                    + "got expected exception: " + x);
+        }
+        try {
+            LogManager.getLogManager().readConfiguration(null);
+            throw new RuntimeException("LogManager.readConfiguration(null): "
+                    + "NullPointerException exception not raised");
+        } catch (NullPointerException x) {
+            System.out.println("LogManager.readConfiguration(null): "
+                    + "got expected exception: " + x);
+        }
+
+
+    }
+
+    public static void test(String line, boolean valid) throws IOException {
+        String test = (valid ? "valid" : "invalid")
+                + " line \"" +line + "\"";
+        System.out.println("Testing " + test);
+
+        // First verify that we get the expected result from Properties.load()
+        try {
+            ByteArrayInputStream bais =
+                    new ByteArrayInputStream(line.getBytes("UTF-8"));
+            Properties props = new Properties();
+            props.load(bais);
+            if (!valid) {
+                throw new RuntimeException(test
+                        + "\n\tProperties.load: expected exception not raised");
+            } else {
+                System.out.println("Properties.load passed for " + test);
+            }
+        } catch(IllegalArgumentException x) {
+            if (!valid) {
+                System.out.println(
+                        "Properties.load: Got expected exception: "
+                        + x + "\n\tfor " + test);
+            } else {
+                throw x;
+            }
+        }
+
+        // Then verify that we get the expected result from
+        // LogManager.readConfiguration
+        try {
+            String content = defaultConfiguration() + '\n' + line + '\n';
+            ByteArrayInputStream bais =
+                    new ByteArrayInputStream(content.getBytes("UTF-8"));
+            LogManager.getLogManager().readConfiguration(bais);
+            if (!valid) {
+                throw new RuntimeException(test
+                        + "\n\tLogManager.readConfiguration: "
+                        + "expected exception not raised");
+            } else {
+                System.out.println("LogManager.readConfiguration passed for "
+                        + test);
+            }
+        } catch(IOException x) {
+            if (!valid) {
+                System.out.println(
+                        "LogManager.readConfiguration: Got expected exception: "
+                        + x + "\n\tfor " + test);
+            } else {
+                throw x;
+            }
+        }
+    }
+
+    static String getConfigurationFileName() {
+        String fname = System.getProperty("java.util.logging.config.file");
+        if (fname == null) {
+            fname = System.getProperty("java.home");
+            if (fname == null) {
+                throw new Error("Can't find java.home ??");
+            }
+            fname = Paths.get(fname, "conf", "logging.properties")
+                    .toAbsolutePath().normalize().toString();
+        }
+        return fname;
+    }
+
+    static String defaultConfiguration() throws IOException {
+        Properties props = new Properties();
+        String fileName = getConfigurationFileName();
+        if (Files.exists(Paths.get(fileName))) {
+            try (InputStream is = new FileInputStream(fileName);) {
+                props.load(is);
+            } catch(IOException x) {
+                throw new UncheckedIOException(x);
+            }
+        }
+        ByteArrayOutputStream bos = new ByteArrayOutputStream();
+        props.store(bos, null);
+        return bos.toString();
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/logging/LogManager/TestLoggerNames.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.Phaser;
+import java.util.concurrent.Semaphore;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+
+/**
+ * @test
+ * @bug 7113878
+ * @summary This is not a test that will check that 7113878 is fixed, but
+ *          rather a test that will invoke the modified code & try to verify
+ *          that fixing 7113878 has not introduced some big regression.
+ *          This test should pass, whether 7113878 is there or not.
+ * @run main/othervm TestLoggerNames
+ * @author danielfuchs
+ */
+public class TestLoggerNames {
+
+    static final class TestLogger extends java.util.logging.Logger {
+
+        final Semaphore sem = new Semaphore(0);
+        final Semaphore wait = new Semaphore(0);
+
+        public TestLogger(String name, String resourceBundleName) {
+            super(name, resourceBundleName);
+        }
+
+        @Override
+        public Handler[] getHandlers() {
+           boolean found = false;
+           try {
+                System.out.println("Entering "+getName()+" getHandlers()");
+                for (StackTraceElement ste : Thread.currentThread().getStackTrace()) {
+                    if (LogManager.class.getName().equals(ste.getClassName())
+                            && "reset".equals(ste.getMethodName())) {
+                        found = true;
+                        System.out.println(getName()+" getHandlers() called by " + ste);
+                    }
+                }
+                sem.release();
+                try {
+                    System.out.println("TestLogger: Acquiring wait for "+getName());
+                    wait.acquire();
+                    try {
+                        System.out.println("TestLogger: Acquired wait for "+getName());
+                        return super.getHandlers();
+                    } finally {
+                        System.out.println("TestLogger: Releasing wait for "+getName());
+                        wait.release();
+                    }
+                } finally {
+                    System.out.println("Unblocking "+getName());
+                    sem.acquire();
+                    System.out.println("Unblocked "+getName());
+                    if (found) {
+                        System.out.println("Reset will proceed...");
+                    }
+                }
+            } catch (InterruptedException x) {
+                throw new IllegalStateException(x);
+            }
+        }
+    }
+
+    static volatile boolean stop;
+    static volatile Throwable resetFailed;
+    static volatile Throwable checkLoggerNamesFailed;
+    static volatile Phaser phaser = new Phaser(2);
+
+
+    static void checkLoggerNames(List<Logger> loggers) {
+        Enumeration<String> names = LogManager.getLogManager().getLoggerNames();
+        if (names instanceof Iterator) {
+            for (Iterator<?> it = Iterator.class.cast(names); it.hasNext(); ) {
+                try {
+                    it.remove();
+                    throw new RuntimeException("Iterator supports remove!");
+                } catch (UnsupportedOperationException x) {
+                    System.out.println("OK: Iterator doesn't support remove.");
+                }
+            }
+        }
+        List<String> loggerNames = Collections.list(names);
+        if (!loggerNames.contains("")) {
+            throw new RuntimeException("\"\"" +
+                    " not found in " + loggerNames);
+        }
+        if (!loggerNames.contains("global")) {
+            throw new RuntimeException("global" +
+                    " not found in " + loggerNames);
+        }
+        for (Logger l : loggers) {
+            if (!loggerNames.contains(l.getName())) {
+                throw new RuntimeException(l.getName() +
+                        " not found in " + loggerNames);
+            }
+        }
+        System.out.println("Got all expected logger names");
+    }
+
+
+    public static void main(String[] args) throws InterruptedException {
+        LogManager.getLogManager().addLogger(new TestLogger("com.foo.bar.zzz", null));
+        try {
+            Logger.getLogger(null);
+            throw new RuntimeException("Logger.getLogger(null) didn't throw expected NPE");
+        } catch (NullPointerException x) {
+            System.out.println("Got expected NullPointerException for Logger.getLogger(null)");
+        }
+        List<Logger> loggers = new CopyOnWriteArrayList<>();
+        loggers.add(Logger.getLogger("one.two.addMeAChild"));
+        loggers.add(Logger.getLogger("aaa.bbb.replaceMe"));
+        loggers.add(Logger.getLogger("bbb.aaa.addMeAChild"));
+        TestLogger test = (TestLogger)Logger.getLogger("com.foo.bar.zzz");
+        loggers.add(Logger.getLogger("ddd.aaa.addMeAChild"));
+
+        checkLoggerNames(loggers);
+
+        Thread loggerNamesThread = new Thread(() -> {
+            try {
+                while (!stop) {
+                    checkLoggerNames(loggers);
+                    Thread.sleep(10);
+                    if (!stop) {
+                        phaser.arriveAndAwaitAdvance();
+                    }
+                }
+            } catch (Throwable t) {
+                t.printStackTrace(System.err);
+                checkLoggerNamesFailed = t;
+            }
+        }, "loggerNames");
+
+        Thread resetThread = new Thread(() -> {
+            try {
+                System.out.println("Calling reset...");
+                LogManager.getLogManager().reset();
+                System.out.println("Reset done...");
+                System.out.println("Reset again...");
+                LogManager.getLogManager().reset();
+                System.out.println("Reset done...");
+            } catch(Throwable t) {
+                resetFailed = t;
+                System.err.println("Unexpected exception or error in reset Thread");
+                t.printStackTrace(System.err);
+            }
+        }, "reset");
+
+        resetThread.setDaemon(true);
+        resetThread.start();
+
+        System.out.println("Waiting for reset to get handlers");
+        test.sem.acquire();
+        try {
+            loggerNamesThread.start();
+            System.out.println("Reset has called getHandlers on " + test.getName());
+            int i = 0;
+            for (Enumeration<String> e = LogManager.getLogManager().getLoggerNames();
+                e.hasMoreElements();) {
+                String name = e.nextElement();
+                if (name.isEmpty()) continue;
+                if (name.endsWith(".addMeAChild")) {
+                    Logger l =  Logger.getLogger(name+".child");
+                    loggers.add(l);
+                    System.out.println("*** Added " + l.getName());
+                    i++;
+                } else if (name.endsWith("replaceMe")) {
+                    Logger l = Logger.getLogger(name);
+                    loggers.remove(l);
+                    l = Logger.getLogger(name.replace("replaceMe", "meReplaced"));
+                    loggers.add(l);
+                    System.gc();
+                    if (LogManager.getLogManager().getLogger(name) == null) {
+                        System.out.println("*** "+ name + " successfully replaced with " + l.getName());
+                    }
+                    i++;
+                } else {
+                    System.out.println("Nothing to do for logger: " + name);
+                }
+                phaser.arriveAndAwaitAdvance();
+                if (i >= 3 && i++ == 3) {
+                    System.out.println("Loggers are now: " +
+                            Collections.list(LogManager.getLogManager().getLoggerNames()));
+                    test.wait.release();
+                    test.sem.release();
+                    System.out.println("Joining " + resetThread);
+                    resetThread.join();
+                }
+            }
+        } catch (RuntimeException | InterruptedException | Error x) {
+            test.wait.release();
+            test.sem.release();
+            throw x;
+        } finally {
+            stop = true;
+            phaser.arriveAndDeregister();
+            loggerNamesThread.join();
+            loggers.clear();
+        }
+
+
+        if (resetFailed != null || checkLoggerNamesFailed != null) {
+            RuntimeException r = new RuntimeException("Some of the concurrent threads failed");
+            if (resetFailed != null) r.addSuppressed(resetFailed);
+            if (checkLoggerNamesFailed != null) r.addSuppressed(checkLoggerNamesFailed);
+            throw r;
+        }
+
+    }
+
+}
--- a/jdk/test/java/util/zip/EntryCount64k.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/java/util/zip/EntryCount64k.java	Wed Jul 05 20:27:20 2017 +0200
@@ -24,33 +24,76 @@
 /**
  * @test
  * @summary Test java.util.zip behavior with ~64k entries
+ * @library /lib/testlibrary
  * @run main/othervm EntryCount64k
  * @run main/othervm -Djdk.util.zip.inhibitZip64=true EntryCount64k
  * @run main/othervm -Djdk.util.zip.inhibitZip64=false EntryCount64k
  */
 
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.nio.file.Files;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.RandomAccessFile;
+import java.nio.file.Paths;
+import java.util.Enumeration;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
+import java.util.zip.ZipInputStream;
+import java.util.zip.ZipOutputStream;
+
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
 
 public class EntryCount64k {
+    public static class Main {
+        public static void main(String[] args) {
+            System.out.print("Main");
+        }
+    }
 
-    public static void main(String[] args) throws Exception {
-        for (int i = (1 << 16) - 2; i < (1 << 16) + 2; i++)
+    static final String MAIN_CLASS = "EntryCount64k$Main";
+    static final String THIS_CLASS = "EntryCount64k";
+    static final String[] SPECIAL_CLASSES = { MAIN_CLASS, THIS_CLASS };
+    // static final String[] SPECIAL_CLASSES = { MAIN_CLASS };
+    static final int SPECIAL_COUNT = 1 + SPECIAL_CLASSES.length;
+
+    public static void main(String[] args) throws Throwable {
+        for (int i = (1 << 16) - 3; i < (1 << 16) + 2; i++)
             test(i);
     }
 
-    static void test(int entryCount) throws Exception {
+    static void test(int entryCount) throws Throwable {
         File zipFile = new File("EntryCount64k-tmp.zip");
         zipFile.delete();
 
-        try (ZipOutputStream zos =
-             new ZipOutputStream(
-                new BufferedOutputStream(
-                    new FileOutputStream(zipFile)))) {
-            for (int i = 0; i < entryCount; i++) {
-                ZipEntry e = new ZipEntry(Integer.toString(i));
-                zos.putNextEntry(e);
+        try (FileOutputStream fos = new FileOutputStream(zipFile);
+             BufferedOutputStream bos = new BufferedOutputStream(fos);
+             ZipOutputStream zos = new ZipOutputStream(bos)) {
+
+            // Add entries to allow the zip file to be used with "java -jar"
+            zos.putNextEntry(new ZipEntry("META-INF/MANIFEST.MF"));
+            for (String line : new String[] {
+                     "Manifest-Version: 1.0",
+                     "Main-Class: " + MAIN_CLASS,
+                 })
+                zos.write((line + "\n").getBytes("US-ASCII"));
+            zos.closeEntry();
+
+            String testClasses = System.getProperty("test.classes");
+            for (String className : SPECIAL_CLASSES) {
+                String baseName = className + ".class";
+                ZipEntry ze = new ZipEntry(baseName);
+                File file = new File(testClasses, baseName);
+                zos.putNextEntry(ze);
+                Files.copy(file.toPath(), zos);
+                zos.closeEntry();
+            }
+
+            for (int i = SPECIAL_COUNT; i < entryCount; i++) {
+                zos.putNextEntry(new ZipEntry(Integer.toString(i)));
                 zos.closeEntry();
             }
         }
@@ -86,16 +129,16 @@
         return false;
     }
 
-    static void checkCanRead(File zipFile, int entryCount) throws Exception {
+    static void checkCanRead(File zipFile, int entryCount) throws Throwable {
         // Check ZipInputStream API
-        try (ZipInputStream zis =
-             new ZipInputStream(
-                 new BufferedInputStream(
-                     new FileInputStream(zipFile)))) {
+        try (FileInputStream fis = new FileInputStream(zipFile);
+             BufferedInputStream bis = new BufferedInputStream(fis);
+             ZipInputStream zis = new ZipInputStream(bis)) {
             for (int i = 0; i < entryCount; i++) {
                 ZipEntry e = zis.getNextEntry();
-                if (Integer.parseInt(e.getName()) != i)
-                    throw new AssertionError();
+                if (i >= SPECIAL_COUNT) // skip special entries
+                    if (Integer.parseInt(e.getName()) != i)
+                        throw new AssertionError(e.getName());
             }
             if (zis.getNextEntry() != null)
                 throw new AssertionError();
@@ -106,8 +149,9 @@
             Enumeration<? extends ZipEntry> en = zf.entries();
             for (int i = 0; i < entryCount; i++) {
                 ZipEntry e = en.nextElement();
-                if (Integer.parseInt(e.getName()) != i)
-                    throw new AssertionError();
+                if (i >= SPECIAL_COUNT) // skip special entries
+                    if (Integer.parseInt(e.getName()) != i)
+                        throw new AssertionError();
             }
             if (en.hasMoreElements()
                 || (zf.size() != entryCount)
@@ -115,5 +159,15 @@
                 || (zf.getEntry(Integer.toString(entryCount)) != null))
                 throw new AssertionError();
         }
+
+        // Check java -jar
+        String javaHome = System.getProperty("java.home");
+        String java = Paths.get(javaHome, "bin", "java").toString();
+        String[] cmd = { java, "-jar", zipFile.getName() };
+        ProcessBuilder pb = new ProcessBuilder(cmd);
+        OutputAnalyzer a = ProcessTools.executeProcess(pb);
+        a.shouldHaveExitValue(0);
+        a.stdoutShouldMatch("\\AMain\\Z");
+        a.stderrShouldMatch("\\A\\Z");
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/imageio/stream/ShortStreamTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,127 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug     8074954
+ * @summary Test verifies that an IOException is triggered if input stream
+ *          does not contain enough data to read a multi-byte type.
+ *
+ * @run     main ShortStreamTest
+ */
+
+import javax.imageio.ImageIO;
+import javax.imageio.stream.ImageInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+public class ShortStreamTest {
+    public static void main(String[] args) throws IOException {
+        TestCase[]  tests = createTests();
+
+        for (TestCase t : tests) {
+            t.test();
+        }
+    }
+
+    private static abstract class TestCase {
+        abstract void testRead(ImageInputStream iis) throws IOException;
+
+        public void test() {
+            boolean gotException = false;
+
+            ImageInputStream iis = createShortStream();
+
+            try {
+                testRead(iis);
+            } catch (IOException e) {
+                e.printStackTrace(System.out);
+                gotException = true;
+            }
+
+            if (!gotException) {
+                throw new RuntimeException("Test failed.");
+            }
+            System.out.println("Test PASSED");
+        }
+    }
+
+
+    private static ImageInputStream createShortStream() {
+        try {
+            byte[] integerTestArray = new byte[] { 80 };
+            ByteArrayInputStream bais = new ByteArrayInputStream(integerTestArray);
+
+            return ImageIO.createImageInputStream(bais);
+        } catch (IOException e) {
+            return null;
+        }
+    }
+
+    private static TestCase[] createTests() {
+        return new TestCase[]{
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readInt();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readShort();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readDouble();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readFloat();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readLong();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readUnsignedInt();
+                    }
+                },
+                new TestCase() {
+                    @Override
+                    void testRead(ImageInputStream iis) throws IOException {
+                        iis.readUnsignedShort();
+                    }
+                }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/JTableHeader/4473075/bug4473075.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 4473075
+   @summary JTable header rendering problem (after setting preferred size)
+   @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.table.DefaultTableModel;
+import java.awt.*;
+import java.awt.event.InputEvent;
+
+public class bug4473075 {
+    public static final int USER_HEADER_HEIGHT = 40;
+    private static JTable table;
+    private static JScrollPane scpScroll;
+    private static Point point;
+    private static JFrame frame;
+
+    public static void main(String[] args) throws Exception {
+        Robot robot = new Robot();
+        robot.setAutoDelay(20);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new JFrame();
+                frame.setUndecorated(true);
+                frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                table = new JTable();
+                String t = "a cell text";
+                table.setModel(new DefaultTableModel(
+                        new Object[][]{new Object[]{t, t, t, t, t}},
+                        new Object[]{t, t, t, t, t}));
+                table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
+                scpScroll = new JScrollPane(table);
+
+                // Manually set preferred size of header...
+                Dimension preferredSize = new Dimension(table.getSize().width,
+                        USER_HEADER_HEIGHT);
+                table.getTableHeader().setPreferredSize(preferredSize);
+
+                frame.setContentPane(scpScroll);
+                frame.setSize(250, 480);
+                frame.setLocationRelativeTo(null);
+                frame.setVisible(true);
+                point = scpScroll.getHorizontalScrollBar()
+                        .getLocationOnScreen();
+            }
+        });
+        robot.waitForIdle();
+
+        robot.mouseMove(point.x + 100, point.y + 5);
+        robot.mousePress(InputEvent.BUTTON1_MASK);
+        robot.mouseMove(point.x + 150, point.y + 5);
+        robot.mouseRelease(InputEvent.BUTTON1_MASK);
+
+        int headerH = table.getTableHeader().getHeight();
+        if (headerH != USER_HEADER_HEIGHT) {
+            throw new RuntimeException("TableHeader height was not set: "
+                    + headerH + " !=" + USER_HEADER_HEIGHT);
+        }
+
+        double tableX = table.getX();
+        int headerX = table.getTableHeader().getX();
+        if (tableX != headerX) {
+            throw new RuntimeException("TableHeader X position is wrong: "
+                    + tableX + " !=" + headerX);
+        }
+
+        double tableW = table.getWidth();
+        int headerW = table.getTableHeader().getWidth();
+        if (tableW != headerW) {
+            throw new RuntimeException("TableHeader width is wrong: "
+                    + tableW + " !=" + headerW);
+        }
+
+        SwingUtilities.invokeLater(new Runnable() {
+            @Override
+            public void run() {
+                frame.dispose();
+            }
+        });
+        System.out.println("ok");
+    }
+}
--- a/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/javax/swing/ToolTipManager/7123767/bug7123767.java	Wed Jul 05 20:27:20 2017 +0200
@@ -28,8 +28,6 @@
    @run main bug7123767
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.plaf.metal.MetalLookAndFeel;
 import java.awt.*;
@@ -160,8 +158,10 @@
 
     // Moves mouse pointer to the corners of every GraphicsConfiguration
     private static void testToolTip() throws AWTException {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+
+        robot = new Robot();
+        robot.setAutoDelay(20);
+        robot.waitForIdle();
 
         GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice[] devices = environment.getScreenDevices();
@@ -169,28 +169,28 @@
             GraphicsConfiguration[] configs = device.getConfigurations();
             for (GraphicsConfiguration config : configs) {
                 Rectangle rect = config.getBounds();
-                Insets insets = toolkit.getScreenInsets(config);
+                Insets insets = Toolkit.getDefaultToolkit().getScreenInsets(config);
                 adjustInsets(rect, insets);
 
                 // Upper left
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + MARGIN, rect.y + MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 // Lower left
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + MARGIN, rect.y + rect.height - MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 // Upper right
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + rect.width - MARGIN, rect.y + MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
 
                 // Lower right
                 glide(rect.x + rect.width / 2, rect.y + rect.height / 2,
                         rect.x + rect.width - MARGIN, rect.y + rect.height - MARGIN);
-                toolkit.realSync();
+                robot.waitForIdle();
             }
         }
     }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/javax/swing/plaf/synth/8040328/bug8040328.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 8040328
+   @summary JSlider has wrong preferred size with Synth LAF
+   @author Semyon Sadetsky
+*/
+
+import javax.swing.*;
+import javax.swing.plaf.synth.SynthLookAndFeel;
+import java.awt.*;
+import java.io.ByteArrayInputStream;
+
+public class bug8040328 {
+    private static String synthXml = "<synth>" +
+            " <style id=\"all\">" +
+            " <font name=\"Segoe UI\" size=\"12\"/>" +
+            " </style>" +
+            " <bind style=\"all\" type=\"REGION\" key=\".*\"/>" +
+            " <style id=\"slider\">" +
+            " <insets top=\"10\" left=\"5\" bottom=\"10\" right=\"5\"/>" +
+            " </style>" +
+            " <bind style=\"slider\" type=\"region\" key=\"Slider\"/>" +
+            "</synth>";
+
+    public static void main(String[] args) throws Exception {
+        SynthLookAndFeel lookAndFeel = new SynthLookAndFeel();
+        lookAndFeel.load(new ByteArrayInputStream(synthXml.getBytes("UTF8")),
+                bug8040328.class);
+        UIManager.setLookAndFeel(lookAndFeel);
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                final JFrame frame = new JFrame();
+                try {
+                    frame.setUndecorated(true);
+                    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                    frame.setVisible(true);
+                    test(frame);
+                } finally {
+                    frame.dispose();
+                }
+            }
+        });
+        System.out.println("ok");
+    }
+
+    static void test(JFrame frame) {
+        JSlider hslider = new JSlider(JSlider.HORIZONTAL);
+        hslider.setBackground(Color.DARK_GRAY);
+        frame.getContentPane().add(hslider, BorderLayout.CENTER);
+        frame.getContentPane().setBackground(Color.CYAN);
+        frame.pack();
+        Insets insets = hslider.getInsets();
+        if (hslider.getWidth() != 200 + insets.left + insets.right) {
+            throw new RuntimeException(
+                    "Horizontal slider width is wrong " + hslider.getWidth());
+        }
+        if (hslider.getHeight() != hslider.getMinimumSize().height) {
+            throw new RuntimeException(
+                    "Horizontal slider height is wrong " + hslider.getHeight());
+        }
+        frame.getContentPane().remove(hslider);
+
+        JSlider vslider = new JSlider(JSlider.VERTICAL);
+        frame.getContentPane().add(vslider);
+        frame.pack();
+        insets = vslider.getInsets();
+        if (vslider.getWidth() != vslider.getMinimumSize().width) {
+            throw new RuntimeException(
+                    "Verical slider width is wrong " + vslider.getWidth());
+        }
+        if (vslider.getHeight() != 200 + insets.top + insets.bottom) {
+            throw new RuntimeException(
+                    "Verical slider height is wrong " + vslider.getHeight());
+        }
+    }
+}
--- a/jdk/test/javax/xml/jaxp/transform/8062923/XslSubstringTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/javax/xml/jaxp/transform/8062923/XslSubstringTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -23,10 +23,11 @@
 
 /**
  * @test
- * @bug 8062923 8062924
+ * @bug 8062923 8062924 8074297 8076290
  * @run testng XslSubstringTest
  * @summary Test xsl substring function with negative, Inf and
- * NaN length and few other use cases
+ * NaN length and few other use cases. Also test proper
+ * processing of supplementary characters by substring function.
  */
 
 import java.io.StringReader;
@@ -39,6 +40,7 @@
 import javax.xml.transform.stream.StreamSource;
 
 import static org.testng.Assert.assertEquals;
+import org.testng.annotations.DataProvider;
 import org.testng.annotations.Test;
 
 public class XslSubstringTest {
@@ -50,6 +52,36 @@
             + "<xsl:template match='/'><t>";
     final String xslPost = "</t></xsl:template></xsl:stylesheet>";
 
+    @DataProvider(name = "GeneralTestsData")
+    private Object[][] xmls() {
+        return new Object[][] {
+            { "|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|", "<t>|s|</t>"},
+            { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>"},
+            { "|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|", "<t>||</t>" },
+            { "|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|", "<t>|sdf|</t>" },
+            // 8076290 bug test case
+            { "|<xsl:value-of select=\"substring('123', 0, 3)\"/>|", "<t>|12|</t>"},
+        };
+    }
+
+    @DataProvider(name = "SupplementaryCharactersTestData")
+    private Object[][] dataSupplementaryCharacters() {
+        return new Object[][] {
+            // 8074297 bug test cases
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 3)\"/>|",    "<t>|BC|</t>"},
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 3, 1)\"/>|", "<t>|B|</t>" },
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 2, 2)\"/>|", "<t>|AB|</t>"},
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 3, 2)\"/>|", "<t>|BC|</t>"},
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 3, 4)\"/>|", "<t>|BC|</t>"},
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 1, 1)\"/>|", "<t>|&#131083;|</t>"},
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 2, 1)\"/>|", "<t>|A|</t>"},
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 1, 1 div 0)\"/>|", "<t>|&#131083;ABC|</t>"},
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', -10, 1 div 0)\"/>|", "<t>|&#131083;ABC|</t>"},
+            // 8076290 bug test case
+            { "|<xsl:value-of select=\"substring('&#131083;ABC', 0, 2)\"/>|", "<t>|&#131083;|</t>"},
+        };
+    }
+
     private String testTransform(String xsl) throws Exception {
         //Prepare sources for transormation
         Source src = new StreamSource(new StringReader(xml));
@@ -78,27 +110,14 @@
                 "<t>||</t>");
     }
 
-    @Test
-    public void testGeneral1() throws Exception {
-        assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1)\"/>|"),
-                "<t>|s|</t>");
-    }
-
-    @Test
-    public void testGeneral2() throws Exception {
-        assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 1 div 0)\"/>|"),
-                "<t>|sdf|</t>");
+    @Test(dataProvider = "GeneralTestsData")
+    public void testGeneralAll(String xsl, String result) throws Exception {
+        assertEquals(testTransform(xsl), result);
     }
 
-    @Test
-    public void testGeneral3() throws Exception {
-        assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, -0 div 0)\"/>|"),
-                "<t>||</t>");
+    @Test(dataProvider = "SupplementaryCharactersTestData")
+    public void testSupplementCharacters(String xsl, String result) throws Exception {
+        assertEquals(testTransform(xsl), result);
     }
 
-    @Test
-    public void testGeneral4() throws Exception {
-        assertEquals(testTransform("|<xsl:value-of select=\"substring('asdf',2, 0 div 0)\"/>|"),
-                "<t>||</t>");
-    }
 }
--- a/jdk/test/jdk/lambda/FDTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,192 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import shapegen.*;
-
-import com.sun.source.util.JavacTask;
-import com.sun.tools.javac.util.Pair;
-
-import java.net.URI;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.tools.Diagnostic;
-import javax.tools.JavaCompiler;
-import javax.tools.JavaFileObject;
-import javax.tools.SimpleJavaFileObject;
-import javax.tools.StandardJavaFileManager;
-import javax.tools.ToolProvider;
-
-import org.testng.annotations.Test;
-import org.testng.annotations.BeforeSuite;
-import org.testng.annotations.DataProvider;
-import static org.testng.Assert.*;
-
-public class FDTest {
-
-    public enum TestKind {
-        POSITIVE,
-        NEGATIVE;
-
-        Collection<Hierarchy> getHierarchy(HierarchyGenerator hg) {
-            return this == POSITIVE ?
-                    hg.getOK() : hg.getErr();
-        }
-    }
-
-    public static JavaCompiler comp;
-    public static StandardJavaFileManager fm;
-
-    @BeforeSuite
-    static void init() {
-        // create default shared JavaCompiler - reused across multiple
-        // compilations
-
-        comp = ToolProvider.getSystemJavaCompiler();
-        fm = comp.getStandardFileManager(null, null, null);
-    }
-
-    public static void main(String[] args) throws Exception {
-        init();
-
-        for (Pair<TestKind,Hierarchy> fdtest : generateCases()) {
-            runTest(fdtest.fst, fdtest.snd, comp, fm);
-        }
-    }
-
-    @Test(dataProvider = "fdCases")
-    public void testOneCase(TestKind tk, Hierarchy hs)
-            throws Exception {
-        FDTest.runTest(tk, hs, comp, fm);
-    }
-
-    @DataProvider(name = "fdCases")
-    public Object[][] caseGenerator() {
-        List<Pair<TestKind, Hierarchy>> cases = generateCases();
-        Object[][] fdCases = new Object[cases.size()][];
-        for (int i = 0; i < cases.size(); ++i) {
-            fdCases[i] = new Object[2];
-            fdCases[i][0] = cases.get(i).fst;
-            fdCases[i][1] = cases.get(i).snd;
-        }
-        return fdCases;
-    }
-
-    public static List<Pair<TestKind, Hierarchy>> generateCases() {
-        ArrayList<Pair<TestKind,Hierarchy>> list = new ArrayList<>();
-        HierarchyGenerator hg = new HierarchyGenerator();
-        for (TestKind tk : TestKind.values()) {
-            for (Hierarchy hs : tk.getHierarchy(hg)) {
-                list.add(new Pair<>(tk, hs));
-            }
-        }
-        return list;
-    }
-
-    public static void runTest(TestKind tk, Hierarchy hs,
-            JavaCompiler comp, StandardJavaFileManager fm) throws Exception {
-        new FDTest(tk, hs).run(comp, fm);
-    }
-
-    TestKind tk;
-    Hierarchy hs;
-    DefenderTestSource source;
-    DiagnosticChecker diagChecker;
-
-    public FDTest() {}
-
-    FDTest(TestKind tk, Hierarchy hs) {
-        this.tk = tk;
-        this.hs = hs;
-        this.source = new DefenderTestSource();
-        this.diagChecker = new DiagnosticChecker();
-    }
-
-    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
-        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
-                null, null, Arrays.asList(source));
-        try {
-            ct.analyze();
-        } catch (Throwable ex) {
-            fail("Error thrown when analyzing the following source:\n" + source.getCharContent(true));
-        }
-        check();
-    }
-
-    void check() {
-        boolean errorExpected = tk == TestKind.NEGATIVE;
-        if (errorExpected != diagChecker.errorFound) {
-            fail("problem in source: \n" +
-                 "\nerror found = " + diagChecker.errorFound +
-                 "\nerror expected = " + errorExpected +
-                 "\n" + dumpHierarchy() +
-                 "\n" + source.getCharContent(true));
-        }
-    }
-
-    String dumpHierarchy() {
-        StringBuilder buf = new StringBuilder();
-        buf.append("root = " + hs.root + "\n");
-        for (ClassCase cc : hs.all) {
-            buf.append("  class name = " + cc.getName() + "\n");
-            buf.append("    class OK = " + cc.get_OK() + "\n");
-            buf.append("    prov = " + cc.get_mprov() + "\n");
-
-        }
-        return buf.toString();
-    }
-
-    class DefenderTestSource extends SimpleJavaFileObject {
-
-        String source;
-
-        public DefenderTestSource() {
-            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
-            StringBuilder buf = new StringBuilder();
-            List<ClassCase> defaultRef = new ArrayList<>();
-            for (ClassCase cc : hs.all) {
-                Hierarchy.genClassDef(buf, cc, null, defaultRef);
-            }
-            source = buf.toString();
-        }
-
-        @Override
-        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
-            return source;
-        }
-    }
-
-    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
-
-        boolean errorFound;
-
-        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
-            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
-                errorFound = true;
-            }
-        }
-    }
-}
--- a/jdk/test/jdk/lambda/LambdaTranslationInInterface.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-/**
- * @author Robert Field
- */
-
-interface LTII {
-
-    interface ILsp1 {
-        String m();
-    }
-
-    interface ILsp2 {
-        String m(String x);
-    }
-
-    default ILsp1 t1() {
-        return () -> { return "yo"; };
-    }
-
-    default ILsp2 t2() {
-        return (x) -> { return "snur" + x; };
-    }
-
-}
-
-@Test
-public class LambdaTranslationInInterface implements LTII {
-
-    public void testLambdaInDefaultMethod() {
-        assertEquals(t1().m(), "yo");
-        assertEquals(t2().m("p"), "snurp");
-    }
-
-}
--- a/jdk/test/jdk/lambda/LambdaTranslationInnerConstructor.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import static org.testng.Assert.assertEquals;
-import org.testng.annotations.Test;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class LambdaTranslationInnerConstructor  {
-
-    public void testLambdaWithInnerConstructor() {
-        assertEquals(seq1().m().toString(), "Cbl:nada");
-        assertEquals(seq2().m("rats").toString(), "Cbl:rats");
-    }
-
-    Ib1 seq1() {
-        return () -> { return new Cbl(); };
-    }
-
-    Ib2 seq2() {
-        return (x) -> { return new Cbl(x); };
-    }
-
-    class Cbl {
-        String val;
-
-        Cbl() {
-            this.val = "nada";
-        }
-
-        Cbl(String z) {
-            this.val = z;
-        }
-
-        public String toString() {
-            return "Cbl:" + val;
-        }
-    }
-
-    interface Ib1 {
-        Object m();
-    }
-
-    interface Ib2 {
-        Object m(String x);
-    }
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestFDCCE.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-/**
- * Method references and raw types.
- * @author Robert Field
- */
-
-@Test
-@SuppressWarnings({"rawtypes", "unchecked"})
-public class MethodReferenceTestFDCCE {
-
-    static void assertCCE(Throwable t) {
-        assertEquals(t.getClass().getName(), "java.lang.ClassCastException");
-    }
-
-    interface Pred<T> { boolean accept(T x); }
-
-    interface Ps { boolean accept(short x); }
-
-    interface Oo { Object too(int x); }
-
-    interface Reto<T> { T m(); }
-
-    class A {}
-    class B extends A {}
-
-    static boolean isMinor(int x) {
-        return x < 18;
-    }
-
-    static boolean tst(A x) {
-        return true;
-    }
-
-    static Object otst(Object x) {
-        return x;
-    }
-
-    static boolean stst(Short x) {
-        return x < 18;
-    }
-
-    static short ritst() {
-        return 123;
-    }
-
-    public void testMethodReferenceFDPrim1() {
-        Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
-        Pred p2 = p;
-        assertTrue(p2.accept((Byte)(byte)15));
-    }
-
-    public void testMethodReferenceFDPrim2() {
-        Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
-        Pred p2 = p;
-        assertTrue(p2.accept((byte)15));
-    }
-
-    public void testMethodReferenceFDPrimICCE() {
-        Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
-        Pred p2 = p;
-        try {
-            p2.accept(15); // should throw CCE
-            fail("Exception should have been thrown");
-        } catch (Throwable t) {
-            assertCCE(t);
-        }
-    }
-
-    public void testMethodReferenceFDPrimOCCE() {
-        Pred<Byte> p = MethodReferenceTestFDCCE::isMinor;
-        Pred p2 = p;
-        try {
-            p2.accept(new Object()); // should throw CCE
-            fail("Exception should have been thrown");
-        } catch (Throwable t) {
-            assertCCE(t);
-        }
-    }
-
-    public void testMethodReferenceFDRef() {
-        Pred<B> p = MethodReferenceTestFDCCE::tst;
-        Pred p2 = p;
-        assertTrue(p2.accept(new B()));
-    }
-
-    public void testMethodReferenceFDRefCCE() {
-        Pred<B> p = MethodReferenceTestFDCCE::tst;
-        Pred p2 = p;
-        try {
-            p2.accept(new A()); // should throw CCE
-            fail("Exception should have been thrown");
-        } catch (Throwable t) {
-            assertCCE(t);
-        }
-    }
-
-    public void testMethodReferenceFDPrimPrim() {
-        Ps p = MethodReferenceTestFDCCE::isMinor;
-        assertTrue(p.accept((byte)15));
-    }
-
-    public void testMethodReferenceFDPrimBoxed() {
-        Ps p = MethodReferenceTestFDCCE::stst;
-        assertTrue(p.accept((byte)15));
-    }
-
-    public void testMethodReferenceFDPrimRef() {
-        Oo p = MethodReferenceTestFDCCE::otst;
-        assertEquals(p.too(15).getClass().getName(), "java.lang.Integer");
-    }
-
-    public void testMethodReferenceFDRet1() {
-        Reto<Short> p = MethodReferenceTestFDCCE::ritst;
-        assertEquals(p.m(), (Short)(short)123);
-    }
-
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestInnerDefault.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface IDSs { String m(String a); }
-
-interface InDefA {
-    default String xsA__(String s) {
-        return "A__xsA:" + s;
-    }
-
-    default String xsAB_(String s) {
-        return "AB_xsA:" + s;
-    }
-
-}
-
-interface InDefB extends InDefA {
-
-    default String xsAB_(String s) {
-        return "AB_xsB:" + s;
-    }
-
-    default String xs_B_(String s) {
-        return "_B_xsB:" + s;
-    }
-}
-
-@Test
-public class MethodReferenceTestInnerDefault implements InDefB {
-
-    public void testMethodReferenceInnerDefault() {
-        (new In()).testMethodReferenceInnerDefault();
-    }
-
-    class In {
-
-        public void testMethodReferenceInnerDefault() {
-            IDSs q;
-
-            q = MethodReferenceTestInnerDefault.this::xsA__;
-            assertEquals(q.m("*"), "A__xsA:*");
-
-            q = MethodReferenceTestInnerDefault.this::xsAB_;
-            assertEquals(q.m("*"), "AB_xsB:*");
-
-            q = MethodReferenceTestInnerDefault.this::xs_B_;
-            assertEquals(q.m("*"), "_B_xsB:*");
-        }
-    }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestInnerInstance.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestInnerInstance {
-
-    public void testMethodReferenceInnerInstance() {
-        cia().cib().testMethodReferenceInstance();
-    }
-
-    public void testMethodReferenceInnerExternal() {
-        cia().cib().testMethodReferenceExternal();
-    }
-
-    interface SI {
-        String m(Integer a);
-    }
-
-    class CIA {
-
-        String xI(Integer i) {
-            return "xI:" + i;
-        }
-
-        public class CIB {
-
-            public void testMethodReferenceInstance() {
-                SI q;
-
-                q = CIA.this::xI;
-                assertEquals(q.m(55), "xI:55");
-            }
-
-            public void testMethodReferenceExternal() {
-                SI q;
-
-                q = (new E())::xI;
-                assertEquals(q.m(77), "ExI:77");
-            }
-        }
-
-        CIB cib() {
-            return new CIB();
-        }
-
-        class E {
-
-            String xI(Integer i) {
-                return "ExI:" + i;
-            }
-        }
-
-    }
-
-    CIA cia() {
-        return new CIA();
-    }
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestInnerVarArgsThis.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestInnerVarArgsThis {
-
-    interface NsII {
-
-        String m(Integer a, Integer b);
-    }
-
-    interface Nsiii {
-
-        String m(int a, int b, int c);
-    }
-
-    interface Nsi {
-
-        String m(int a);
-    }
-
-    interface NsaO {
-
-        String m(Object[] a);
-    }
-
-    interface Nsai {
-
-        String m(int[] a);
-    }
-
-    interface Nsvi {
-
-        String m(int... va);
-    }
-
-    class CIA {
-
-        String xvI(Integer... vi) {
-            StringBuilder sb = new StringBuilder("xvI:");
-            for (Integer i : vi) {
-                sb.append(i);
-                sb.append("-");
-            }
-            return sb.toString();
-        }
-
-        String xIvI(Integer f, Integer... vi) {
-            StringBuilder sb = new StringBuilder("xIvI:");
-            sb.append(f);
-            for (Integer i : vi) {
-                sb.append(i);
-                sb.append("-");
-            }
-            return sb.toString();
-        }
-
-        String xvi(int... vi) {
-            int sum = 0;
-            for (int i : vi) {
-                sum += i;
-            }
-            return "xvi:" + sum;
-        }
-
-        String xIvi(Integer f, int... vi) {
-            int sum = 0;
-            for (int i : vi) {
-                sum += i;
-            }
-            return "xIvi:(" + f + ")" + sum;
-        }
-
-        String xvO(Object... vi) {
-            StringBuilder sb = new StringBuilder("xvO:");
-            for (Object i : vi) {
-                if (i.getClass().isArray()) {
-                    sb.append("[");
-                    int len = Array.getLength(i);
-                    for (int x = 0; x < len; ++x) {
-                        sb.append(Array.get(i, x));
-                        sb.append(",");
-                    }
-                    sb.append("]");
-
-                } else {
-                    sb.append(i);
-                }
-                sb.append("*");
-            }
-            return sb.toString();
-        }
-
-        public class CIB {
-
-            // These should be processed as var args
-            public void testVarArgsNsSuperclass() {
-                NsII q;
-
-                q = CIA.this::xvO;
-                assertEquals(q.m(55, 66), "xvO:55*66*");
-            }
-
-            public void testVarArgsNsArray() {
-                Nsai q;
-
-                q = CIA.this::xvO;
-                assertEquals(q.m(new int[]{55, 66}), "xvO:[55,66,]*");
-            }
-
-            public void testVarArgsNsII() {
-                NsII q;
-
-                q = CIA.this::xvI;
-                assertEquals(q.m(33, 7), "xvI:33-7-");
-
-                q = CIA.this::xIvI;
-                assertEquals(q.m(50, 40), "xIvI:5040-");
-
-                q = CIA.this::xvi;
-                assertEquals(q.m(100, 23), "xvi:123");
-
-                q = CIA.this::xIvi;
-                assertEquals(q.m(9, 21), "xIvi:(9)21");
-            }
-
-            public void testVarArgsNsiii() {
-                Nsiii q;
-
-                q = CIA.this::xvI;
-                assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
-                q = CIA.this::xIvI;
-                assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
-                q = CIA.this::xvi;
-                assertEquals(q.m(900, 80, 7), "xvi:987");
-
-                q = CIA.this::xIvi;
-                assertEquals(q.m(333, 27, 72), "xIvi:(333)99");
-            }
-
-            public void testVarArgsNsi() {
-                Nsi q;
-
-                q = CIA.this::xvI;
-                assertEquals(q.m(3), "xvI:3-");
-
-                q = CIA.this::xIvI;
-                assertEquals(q.m(888), "xIvI:888");
-
-                q = CIA.this::xvi;
-                assertEquals(q.m(900), "xvi:900");
-
-                q = CIA.this::xIvi;
-                assertEquals(q.m(333), "xIvi:(333)0");
-            }
-
-            // These should NOT be processed as var args
-            public void testVarArgsNsaO() {
-                NsaO q;
-
-                q = CIA.this::xvO;
-                assertEquals(q.m(new String[]{"yo", "there", "dude"}), "xvO:yo*there*dude*");
-            }
-        }
-
-        CIB cib() {
-            return new CIB();
-        }
-
-        class E {
-
-            String xI(Integer i) {
-                return "ExI:" + i;
-            }
-        }
-    }
-
-    CIA cia() {
-        return new CIA();
-    }
-
-    // These should be processed as var args
-    public void testVarArgsNsSuperclass() {
-        cia().cib().testVarArgsNsSuperclass();
-    }
-
-    public void testVarArgsNsArray() {
-        cia().cib().testVarArgsNsArray();
-    }
-
-    public void testVarArgsNsII() {
-        cia().cib().testVarArgsNsII();
-    }
-
-    public void testVarArgsNsiii() {
-        cia().cib().testVarArgsNsiii();
-    }
-
-    public void testVarArgsNsi() {
-        cia().cib().testVarArgsNsi();
-    }
-
-    // These should NOT be processed as var args
-
-    public void testVarArgsNsaO() {
-        cia().cib().testVarArgsNsaO();
-    }
-
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestInstance.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-class MethodReferenceTestInstance_E {
-    String xI(Integer i) {
-        return "ExI:" + i;
-    }
-}
-
-@Test
-public class MethodReferenceTestInstance {
-
-    interface SI { String m(Integer a); }
-
-    String xI(Integer i) {
-        return "xI:" + i;
-    }
-
-    public void testMethodReferenceInstance() {
-        SI q;
-
-        q = this::xI;
-        assertEquals(q.m(55), "xI:55");
-    }
-
-    public void testMethodReferenceExternal() {
-        SI q;
-
-        q = (new MethodReferenceTestInstance_E())::xI;
-        assertEquals(q.m(77), "ExI:77");
-    }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestKinds.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestKinds extends MethodReferenceTestKindsSup {
-
-    interface S0 { String get(); }
-    interface S1 { String get(MethodReferenceTestKinds x); }
-    interface S2 { String get(MethodReferenceTestKinds x, MethodReferenceTestKinds y); }
-
-    interface SXN0 { MethodReferenceTestKindsBase make(MethodReferenceTestKinds x); }
-    interface SXN1 { MethodReferenceTestKindsBase make(MethodReferenceTestKinds x, String str); }
-
-    interface SN0 { MethodReferenceTestKindsBase make(); }
-    interface SN1 { MethodReferenceTestKindsBase make(String x); }
-
-    class In extends MethodReferenceTestKindsBase {
-        In(String val) {
-            this.val = val;
-        }
-
-        In() {
-            this("blank");
-        }
-    }
-
-    String instanceMethod0() { return "IM:0-" + this; }
-    String instanceMethod1(MethodReferenceTestKinds x) { return "IM:1-" + this + x; }
-
-    static String staticMethod0() { return "SM:0"; }
-    static String staticMethod1(MethodReferenceTestKinds x) { return "SM:1-" + x; }
-
-    MethodReferenceTestKinds(String val) {
-        super(val);
-    }
-
-    MethodReferenceTestKinds() {
-        super("blank");
-    }
-
-    MethodReferenceTestKinds inst(String val) {
-        return new MethodReferenceTestKinds(val);
-    }
-
-    public void testMRBound() {
-        S0 var = this::instanceMethod0;
-        assertEquals(var.get(), "IM:0-MethodReferenceTestKinds(blank)");
-    }
-
-    public void testMRBoundArg() {
-        S1 var = this::instanceMethod1;
-        assertEquals(var.get(inst("arg")), "IM:1-MethodReferenceTestKinds(blank)MethodReferenceTestKinds(arg)");
-    }
-
-    public void testMRUnbound() {
-        S1 var = MethodReferenceTestKinds::instanceMethod0;
-        assertEquals(var.get(inst("rcvr")), "IM:0-MethodReferenceTestKinds(rcvr)");
-    }
-
-    public void testMRUnboundArg() {
-        S2 var = MethodReferenceTestKinds::instanceMethod1;
-        assertEquals(var.get(inst("rcvr"), inst("arg")), "IM:1-MethodReferenceTestKinds(rcvr)MethodReferenceTestKinds(arg)");
-    }
-
-    public void testMRSuper() {
-        S0 var = super::instanceMethod0;
-        assertEquals(var.get(), "SIM:0-MethodReferenceTestKinds(blank)");
-    }
-
-    public void testMRSuperArg() {
-        S1 var = super::instanceMethod1;
-        assertEquals(var.get(inst("arg")), "SIM:1-MethodReferenceTestKinds(blank)MethodReferenceTestKinds(arg)");
-    }
-
-    public void testMRStatic() {
-        S0 var = MethodReferenceTestKinds::staticMethod0;
-        assertEquals(var.get(), "SM:0");
-    }
-
-    public void testMRStaticArg() {
-        S1 var = MethodReferenceTestKinds::staticMethod1;
-        assertEquals(var.get(inst("arg")), "SM:1-MethodReferenceTestKinds(arg)");
-    }
-
-    public void testMRTopLevel() {
-        SN0 var = MethodReferenceTestKindsBase::new;
-        assertEquals(var.make().toString(), "MethodReferenceTestKindsBase(blank)");
-    }
-
-    public void testMRTopLevelArg() {
-        SN1 var = MethodReferenceTestKindsBase::new;
-        assertEquals(var.make("name").toString(), "MethodReferenceTestKindsBase(name)");
-    }
-/* unbound inner case not supported anymore (dropped by EG)
-    public void testMRUnboundInner() {
-        SXN0 var = MethodReferenceTestKinds.In::new;
-        assertEquals(var.make(inst("out")).toString(), "In(blank)");
-    }
-
-   public void testMRUnboundInnerArg() {
-        SXN1 var = MethodReferenceTestKinds.In::new;
-        assertEquals(var.make(inst("out"), "name").toString(), "In(name)");
-    }
-*/
-    public void testMRImplicitInner() {
-        SN0 var = MethodReferenceTestKinds.In::new;
-        assertEquals(var.make().toString(), "In(blank)");
-    }
-
-    public void testMRImplicitInnerArg() {
-        SN1 var = MethodReferenceTestKinds.In::new;
-        assertEquals(var.make("name").toString(), "In(name)");
-    }
-
-}
-
-
-class MethodReferenceTestKindsBase {
-    String val = "unset";
-
-    public String toString() {
-        return getClass().getSimpleName() + "(" + val + ")";
-    }
-
-    MethodReferenceTestKindsBase(String val) {
-        this.val = val;
-    }
-
-    MethodReferenceTestKindsBase() {
-        this("blank");
-    }
-
-}
-
-class MethodReferenceTestKindsSup extends MethodReferenceTestKindsBase {
-    String instanceMethod0() { return "SIM:0-" + this; }
-    String instanceMethod1(MethodReferenceTestKinds x) { return "SIM:1-" + this + x; }
-
-    MethodReferenceTestKindsSup(String val) {
-        super(val);
-    }
-
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestNew.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,130 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestNew {
-
-    interface M0<T> {
-
-        T m();
-    }
-
-    static class N0 {
-
-        N0() {
-        }
-    }
-
-    interface M1<T> {
-
-        T m(Integer a);
-    }
-
-    static class N1 {
-
-        int i;
-
-        N1(int i) {
-            this.i = i;
-        }
-    }
-
-    interface M2<T> {
-
-        T m(Integer n, String o);
-    }
-
-    static class N2 {
-
-        Number n;
-        Object o;
-
-        N2(Number n, Object o) {
-            this.n = n;
-            this.o = o;
-        }
-
-        public String toString() {
-            return "N2(" + n + "," + o + ")";
-        }
-    }
-
-    interface MV {
-
-        NV m(Integer ai, int i);
-    }
-
-    static class NV {
-
-        int i;
-
-        NV(int... v) {
-            i = 0;
-            for (int x : v) {
-                i += x;
-            }
-        }
-
-        public String toString() {
-            return "NV(" + i + ")";
-        }
-    }
-
-    public void testConstructorReference0() {
-        M0<N0> q;
-
-        q = N0::new;
-        assertEquals(q.m().getClass().getSimpleName(), "N0");
-    }
-
-    public void testConstructorReference1() {
-        M1<N1> q;
-
-        q = N1::new;
-        assertEquals(q.m(14).getClass().getSimpleName(), "N1");
-    }
-
-    public void testConstructorReference2() {
-        M2<N2> q;
-
-        q = N2::new;
-        assertEquals(q.m(7, "hi").toString(), "N2(7,hi)");
-    }
-
-    public void testConstructorReferenceVarArgs() {
-        MV q;
-
-        q = NV::new;
-        assertEquals(q.m(5, 45).toString(), "NV(50)");
-    }
-
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestNewInner.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestNewInner {
-
-    String note = "NO NOTE";
-
-    interface M0<T> {
-
-        T m();
-    }
-
-    interface MP<T> {
-
-        T m(MethodReferenceTestNewInner m);
-    }
-
-    class N0 {
-
-        N0() {
-        }
-    }
-
-    interface M1<T> {
-
-        T m(Integer a);
-    }
-
-    class N1 {
-
-        int i;
-
-        N1(int i) {
-            this.i = i;
-        }
-    }
-
-    interface M2<T> {
-
-        T m(Integer n, String o);
-    }
-
-    class N2 {
-
-        Number n;
-        Object o;
-
-        N2(Number n, Object o) {
-            this.n = n;
-            this.o = o;
-        }
-
-        public String toString() {
-            return note + ":N2(" + n + "," + o + ")";
-        }
-    }
-
-    interface MV {
-
-        NV m(Integer ai, int i);
-    }
-
-    class NV {
-
-        int i;
-
-        NV(int... v) {
-            i = 0;
-            for (int x : v) {
-                i += x;
-            }
-        }
-
-        public String toString() {
-            return note + ":NV(" + i + ")";
-        }
-    }
-
-/* unbound constructor case not supported anymore (dropped by EG)
-    public static void testConstructorReferenceP() {
-        MP<N0> q;
-
-        q = N0::new;
-        assertEquals(q.m(new MethodReferenceTestNewInner()).getClass().getSimpleName(), "N0");
-    }
-*/
-    public void testConstructorReference0() {
-        M0<N0> q;
-
-        q = N0::new;
-        assertEquals(q.m().getClass().getSimpleName(), "N0");
-    }
-
-    public void testConstructorReference1() {
-        M1<N1> q;
-
-        q = N1::new;
-        assertEquals(q.m(14).getClass().getSimpleName(), "N1");
-    }
-
-    public void testConstructorReference2() {
-        M2<N2> q;
-
-        note = "T2";
-        q = N2::new;
-        assertEquals(q.m(7, "hi").toString(), "T2:N2(7,hi)");
-    }
-
-    /***
-    public void testConstructorReferenceVarArgs() {
-        MV q;
-
-        note = "TVA";
-        q = NV::new;
-        assertEquals(q.m(5, 45).toString(), "TNV:NV(50)");
-    }
-    ***/
-
-}
-
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestSueCase1.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestSueCase1 {
-
-    public interface Sam2<T> { public String get(T target, String s); }
-
-    String instanceMethod(String s) { return "2"; }
-    Sam2<MethodReferenceTestSueCase1> var = MethodReferenceTestSueCase1::instanceMethod;
-
-    String m() {  return var.get(new MethodReferenceTestSueCase1(), ""); }
-
-    public void testSueCase1() {
-        assertEquals(m(), "2");
-    }
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestSueCase2.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestSueCase2 {
-
-    public interface Sam2<T> { public String get(T target, String s); }
-
-    String instanceMethod(String s) { return "2"; }
-    static Sam2<MethodReferenceTestSueCase2> var = MethodReferenceTestSueCase2::instanceMethod;
-
-    String m() {  return var.get(new MethodReferenceTestSueCase2(), ""); }
-
-    public void testSueCase2() {
-        assertEquals(m(), "2");
-    }
-
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestSueCase4.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestSueCase4 {
-
-    public interface Sam2<T> { public String get(T target, String s); }
-
-    Sam2<Target> var = new Object().equals(new Object()) ? Target::instanceMethod : Target::instanceMethod;
-
-    String m() {
-        return var.get(new Target(), "");
-    }
-
-    static class Target {
-        String instanceMethod(String s) { return "2"; }
-    }
-
-    public void testSueCase4() {
-        assertEquals(m(), "2");
-    }
-
-}
\ No newline at end of file
--- a/jdk/test/jdk/lambda/MethodReferenceTestSuper.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-
-
-/**
- * @author Robert Field
- */
-
-interface SPRI { String m(String a); }
-
-class SPRA {
-    String xsA__(String s) {
-        return "A__xsA:" + s;
-    }
-
-    String xsA_M(String s) {
-        return "A_MxsA:" + s;
-    }
-
-    String xsAB_(String s) {
-        return "AB_xsA:" + s;
-    }
-
-    String xsABM(String s) {
-        return "ABMxsA:" + s;
-    }
-
-}
-
-class SPRB extends SPRA {
-
-    String xsAB_(String s) {
-        return "AB_xsB:" + s;
-    }
-
-    String xsABM(String s) {
-        return "ABMxsB:" + s;
-    }
-
-    String xs_B_(String s) {
-        return "_B_xsB:" + s;
-    }
-
-    String xs_BM(String s) {
-        return "_BMxsB:" + s;
-    }
-
-}
-
-@Test
-public class MethodReferenceTestSuper extends SPRB {
-
-    String xsA_M(String s) {
-        return "A_MxsM:" + s;
-    }
-
-
-    String xsABM(String s) {
-        return "ABMxsM:" + s;
-    }
-
-    String xs_BM(String s) {
-        return "_BMxsM:" + s;
-    }
-
-    public void testMethodReferenceSuper() {
-        SPRI q;
-
-        q = super::xsA__;
-        assertEquals(q.m("*"), "A__xsA:*");
-
-        q = super::xsA_M;
-        assertEquals(q.m("*"), "A_MxsA:*");
-
-        q = super::xsAB_;
-        assertEquals(q.m("*"), "AB_xsB:*");
-
-        q = super::xsABM;
-        assertEquals(q.m("*"), "ABMxsB:*");
-
-        q = super::xs_B_;
-        assertEquals(q.m("*"), "_B_xsB:*");
-
-        q = super::xs_BM;
-        assertEquals(q.m("*"), "_BMxsB:*");
-    }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestSuperDefault.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-
-/**
- * @author Robert Field
- */
-
-interface DSPRI { String m(String a); }
-
-interface DSPRA {
-    default String xsA__(String s) {
-        return "A__xsA:" + s;
-    }
-
-    default String xsAB_(String s) {
-        return "AB_xsA:" + s;
-    }
-
-}
-
-interface DSPRB extends DSPRA {
-
-    default String xsAB_(String s) {
-        return "AB_xsB:" + s;
-    }
-
-    default String xs_B_(String s) {
-        return "_B_xsB:" + s;
-    }
-
-}
-
-@Test
-public class MethodReferenceTestSuperDefault implements DSPRB {
-
-    public void testMethodReferenceSuper() {
-        DSPRI q;
-
-        q = DSPRB.super::xsA__;
-        assertEquals(q.m("*"), "A__xsA:*");
-
-        q = DSPRB.super::xsAB_;
-        assertEquals(q.m("*"), "AB_xsB:*");
-
-        q = DSPRB.super::xs_B_;
-        assertEquals(q.m("*"), "_B_xsB:*");
-    }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestTypeConversion.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-class MethodReferenceTestTypeConversion_E<T> {
-    T xI(T t) { return t; }
-}
-
-@Test
-public class MethodReferenceTestTypeConversion {
-
-    interface ISi { int m(Short a); }
-
-    interface ICc { char m(Character a); }
-
-    public void testUnboxObjectToNumberWiden() {
-        ISi q = (new MethodReferenceTestTypeConversion_E<Short>())::xI;
-        assertEquals(q.m((short)77), (short)77);
-    }
-
-    public void testUnboxObjectToChar() {
-        ICc q = (new MethodReferenceTestTypeConversion_E<Character>())::xI;
-        assertEquals(q.m('@'), '@');
-    }
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgs.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,195 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-@Test
-public class MethodReferenceTestVarArgs {
-
-    interface SII {
-
-        String m(Integer a, Integer b);
-    }
-
-    interface Siii {
-
-        String m(int a, int b, int c);
-    }
-
-    interface Si {
-
-        String m(int a);
-    }
-
-    interface SaO {
-
-        String m(Object[] a);
-    }
-
-    interface Sai {
-
-        String m(int[] a);
-    }
-
-    interface Svi {
-
-        String m(int... va);
-    }
-
-    // These should be processed as var args
-
-    static String xvI(Integer... vi) {
-        StringBuilder sb = new StringBuilder("xvI:");
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    static String xIvI(Integer f, Integer... vi) {
-        StringBuilder sb = new StringBuilder("xIvI:");
-        sb.append(f);
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    static String xvi(int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xvi:" + sum;
-    }
-
-    static String xIvi(Integer f, int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xIvi:(" + f + ")" + sum;
-    }
-
-    static String xvO(Object... vi) {
-        StringBuilder sb = new StringBuilder("xvO:");
-        for (Object i : vi) {
-            if (i.getClass().isArray()) {
-                sb.append("[");
-                int len = Array.getLength(i);
-                for (int x = 0; x < len; ++x)  {
-                    sb.append(Array.get(i, x));
-                    sb.append(",");
-                }
-                sb.append("]");
-
-            } else {
-                sb.append(i);
-            }
-            sb.append("*");
-        }
-        return sb.toString();
-    }
-
-    public void testVarArgsSuperclass() {
-        SII q;
-
-        q = MethodReferenceTestVarArgs::xvO;
-        assertEquals(q.m(55,66), "xvO:55*66*");
-    }
-
-    public void testVarArgsArray() {
-        Sai q;
-
-        q = MethodReferenceTestVarArgs::xvO;
-        assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
-    }
-
-    public void testVarArgsII() {
-        SII q;
-
-        q = MethodReferenceTestVarArgs::xvI;
-        assertEquals(q.m(33,7), "xvI:33-7-");
-
-        q = MethodReferenceTestVarArgs::xIvI;
-        assertEquals(q.m(50,40), "xIvI:5040-");
-
-        q = MethodReferenceTestVarArgs::xvi;
-        assertEquals(q.m(100,23), "xvi:123");
-
-        q = MethodReferenceTestVarArgs::xIvi;
-        assertEquals(q.m(9,21), "xIvi:(9)21");
-    }
-
-    public void testVarArgsiii() {
-        Siii q;
-
-        q = MethodReferenceTestVarArgs::xvI;
-        assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
-        q = MethodReferenceTestVarArgs::xIvI;
-        assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
-        q = MethodReferenceTestVarArgs::xvi;
-        assertEquals(q.m(900,80,7), "xvi:987");
-
-        q = MethodReferenceTestVarArgs::xIvi;
-        assertEquals(q.m(333,27, 72), "xIvi:(333)99");
-    }
-
-    public void testVarArgsi() {
-        Si q;
-
-        q = MethodReferenceTestVarArgs::xvI;
-        assertEquals(q.m(3), "xvI:3-");
-
-        q = MethodReferenceTestVarArgs::xIvI;
-        assertEquals(q.m(888), "xIvI:888");
-
-        q = MethodReferenceTestVarArgs::xvi;
-        assertEquals(q.m(900), "xvi:900");
-
-        q = MethodReferenceTestVarArgs::xIvi;
-        assertEquals(q.m(333), "xIvi:(333)0");
-    }
-
-    // These should NOT be processed as var args
-
-    public void testVarArgsaO() {
-        SaO q;
-
-        q = MethodReferenceTestVarArgs::xvO;
-        assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
-    }
-
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsExt.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface NXII { String m(Integer a, Integer b); }
-
-interface NXiii { String m(int a, int b, int c); }
-
-interface NXi { String m(int a); }
-
-interface NXaO { String m(Object[] a); }
-
-interface NXai { String m(int[] a); }
-
-interface NXvi { String m(int... va); }
-
-@Test
-public class MethodReferenceTestVarArgsExt {
-
-    // These should be processed as var args
-
-    public void testVarArgsNXSuperclass() {
-        NXII q;
-
-        q = (new Ext())::xvO;
-        assertEquals(q.m(55,66), "xvO:55*66*");
-    }
-
-    public void testVarArgsNXArray() {
-        NXai q;
-
-        q = (new Ext())::xvO;
-        assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
-    }
-
-    public void testVarArgsNXII() {
-        NXII q;
-
-        q = (new Ext())::xvI;
-        assertEquals(q.m(33,7), "xvI:33-7-");
-
-        q = (new Ext())::xIvI;
-        assertEquals(q.m(50,40), "xIvI:5040-");
-
-        q = (new Ext())::xvi;
-        assertEquals(q.m(100,23), "xvi:123");
-
-        q = (new Ext())::xIvi;
-        assertEquals(q.m(9,21), "xIvi:(9)21");
-    }
-
-    public void testVarArgsNXiii() {
-        NXiii q;
-
-        q = (new Ext())::xvI;
-        assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
-        q = (new Ext())::xIvI;
-        assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
-        q = (new Ext())::xvi;
-        assertEquals(q.m(900,80,7), "xvi:987");
-
-        q = (new Ext())::xIvi;
-        assertEquals(q.m(333,27, 72), "xIvi:(333)99");
-    }
-
-    public void testVarArgsNXi() {
-        NXi q;
-
-        q = (new Ext())::xvI;
-        assertEquals(q.m(3), "xvI:3-");
-
-        q = (new Ext())::xIvI;
-        assertEquals(q.m(888), "xIvI:888");
-
-        q = (new Ext())::xvi;
-        assertEquals(q.m(900), "xvi:900");
-
-        q = (new Ext())::xIvi;
-        assertEquals(q.m(333), "xIvi:(333)0");
-    }
-
-    // These should NOT be processed as var args
-
-    public void testVarArgsNXaO() {
-        NXaO q;
-
-        q = (new Ext())::xvO;
-        assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
-    }
-
-
-}
-
-class Ext {
-
-    String xvI(Integer... vi) {
-        StringBuilder sb = new StringBuilder("xvI:");
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    String xIvI(Integer f, Integer... vi) {
-        StringBuilder sb = new StringBuilder("xIvI:");
-        sb.append(f);
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    String xvi(int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xvi:" + sum;
-    }
-
-    String xIvi(Integer f, int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xIvi:(" + f + ")" + sum;
-    }
-
-    String xvO(Object... vi) {
-        StringBuilder sb = new StringBuilder("xvO:");
-        for (Object i : vi) {
-            if (i.getClass().isArray()) {
-                sb.append("[");
-                int len = Array.getLength(i);
-                for (int x = 0; x < len; ++x)  {
-                    sb.append(Array.get(i, x));
-                    sb.append(",");
-                }
-                sb.append("]");
-
-            } else {
-                sb.append(i);
-            }
-            sb.append("*");
-        }
-        return sb.toString();
-    }
-
-
-}
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsSuper.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,200 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-
-/**
- * @author Robert Field
- */
-
-class MethodReferenceTestVarArgsSuper_Sub {
-
-    String xvI(Integer... vi) {
-        StringBuilder sb = new StringBuilder("xvI:");
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    String xIvI(Integer f, Integer... vi) {
-        StringBuilder sb = new StringBuilder("xIvI:");
-        sb.append(f);
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    String xvi(int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xvi:" + sum;
-    }
-
-    String xIvi(Integer f, int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xIvi:(" + f + ")" + sum;
-    }
-
-    String xvO(Object... vi) {
-        StringBuilder sb = new StringBuilder("xvO:");
-        for (Object i : vi) {
-            if (i.getClass().isArray()) {
-                sb.append("[");
-                int len = Array.getLength(i);
-                for (int x = 0; x < len; ++x)  {
-                    sb.append(Array.get(i, x));
-                    sb.append(",");
-                }
-                sb.append("]");
-
-            } else {
-                sb.append(i);
-            }
-            sb.append("*");
-        }
-        return sb.toString();
-    }
-}
-
-@Test
-public class MethodReferenceTestVarArgsSuper extends MethodReferenceTestVarArgsSuper_Sub {
-
-    interface SPRII { String m(Integer a, Integer b); }
-
-    interface SPRiii { String m(int a, int b, int c); }
-
-    interface SPRi { String m(int a); }
-
-    interface SPRaO { String m(Object[] a); }
-
-    interface SPRai { String m(int[] a); }
-
-    interface SPRvi { String m(int... va); }
-
-    String xvI(Integer... vi) {
-        return "ERROR";
-    }
-
-    String xIvI(Integer f, Integer... vi) {
-        return "ERROR";
-    }
-
-    String xvi(int... vi) {
-        return "ERROR";
-    }
-
-    String xIvi(Integer f, int... vi) {
-        return "ERROR";
-   }
-
-    String xvO(Object... vi) {
-        return "ERROR";
-    }
-
-    // These should be processed as var args
-
-    public void testVarArgsSPRSuperclass() {
-        SPRII q;
-
-        q = super::xvO;
-        assertEquals(q.m(55,66), "xvO:55*66*");
-    }
-
-    public void testVarArgsSPRArray() {
-        SPRai q;
-
-        q = super::xvO;
-        assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
-    }
-
-    public void testVarArgsSPRII() {
-        SPRII q;
-
-        q = super::xvI;
-        assertEquals(q.m(33,7), "xvI:33-7-");
-
-        q = super::xIvI;
-        assertEquals(q.m(50,40), "xIvI:5040-");
-
-        q = super::xvi;
-        assertEquals(q.m(100,23), "xvi:123");
-
-        q = super::xIvi;
-        assertEquals(q.m(9,21), "xIvi:(9)21");
-    }
-
-    public void testVarArgsSPRiii() {
-        SPRiii q;
-
-        q = super::xvI;
-        assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
-        q = super::xIvI;
-        assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
-        q = super::xvi;
-        assertEquals(q.m(900,80,7), "xvi:987");
-
-        q = super::xIvi;
-        assertEquals(q.m(333,27, 72), "xIvi:(333)99");
-    }
-
-    public void testVarArgsSPRi() {
-        SPRi q;
-
-        q = super::xvI;
-        assertEquals(q.m(3), "xvI:3-");
-
-        q = super::xIvI;
-        assertEquals(q.m(888), "xIvI:888");
-
-        q = super::xvi;
-        assertEquals(q.m(900), "xvi:900");
-
-        q = super::xIvi;
-        assertEquals(q.m(333), "xIvi:(333)0");
-    }
-
-    // These should NOT be processed as var args
-
-    public void testVarArgsSPRaO() {
-        SPRaO q;
-
-        q = super::xvO;
-        assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
-    }
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsSuperDefault.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface MethodReferenceTestVarArgsSuperDefault_I {
-
-    default String xvI(Integer... vi) {
-        StringBuilder sb = new StringBuilder("xvI:");
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    default String xIvI(Integer f, Integer... vi) {
-        StringBuilder sb = new StringBuilder("xIvI:");
-        sb.append(f);
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    default String xvi(int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xvi:" + sum;
-    }
-
-    default String xIvi(Integer f, int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xIvi:(" + f + ")" + sum;
-    }
-
-    default String xvO(Object... vi) {
-        StringBuilder sb = new StringBuilder("xvO:");
-        for (Object i : vi) {
-            if (i.getClass().isArray()) {
-                sb.append("[");
-                int len = Array.getLength(i);
-                for (int x = 0; x < len; ++x)  {
-                    sb.append(Array.get(i, x));
-                    sb.append(",");
-                }
-                sb.append("]");
-
-            } else {
-                sb.append(i);
-            }
-            sb.append("*");
-        }
-        return sb.toString();
-    }
-}
-
-@Test
-public class MethodReferenceTestVarArgsSuperDefault implements MethodReferenceTestVarArgsSuperDefault_I {
-
-    interface DSPRII { String m(Integer a, Integer b); }
-
-    interface DSPRiii { String m(int a, int b, int c); }
-
-    interface DSPRi { String m(int a); }
-
-    interface DSPRaO { String m(Object[] a); }
-
-    interface DSPRai { String m(int[] a); }
-
-    interface DSPRvi { String m(int... va); }
-
-    // These should be processed as var args
-
-    public void testVarArgsSPRSuperclass() {
-        DSPRII q;
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvO;
-        assertEquals(q.m(55,66), "xvO:55*66*");
-    }
-
-    public void testVarArgsSPRArray() {
-        DSPRai q;
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvO;
-        assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
-    }
-
-    public void testVarArgsSPRII() {
-        DSPRII q;
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvI;
-        assertEquals(q.m(33,7), "xvI:33-7-");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvI;
-        assertEquals(q.m(50,40), "xIvI:5040-");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvi;
-        assertEquals(q.m(100,23), "xvi:123");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvi;
-        assertEquals(q.m(9,21), "xIvi:(9)21");
-    }
-
-    public void testVarArgsSPRiii() {
-        DSPRiii q;
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvI;
-        assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvI;
-        assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvi;
-        assertEquals(q.m(900,80,7), "xvi:987");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvi;
-        assertEquals(q.m(333,27, 72), "xIvi:(333)99");
-    }
-
-    public void testVarArgsSPRi() {
-        DSPRi q;
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvI;
-        assertEquals(q.m(3), "xvI:3-");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvI;
-        assertEquals(q.m(888), "xIvI:888");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvi;
-        assertEquals(q.m(900), "xvi:900");
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xIvi;
-        assertEquals(q.m(333), "xIvi:(333)0");
-    }
-
-    // These should NOT be processed as var args
-
-    public void testVarArgsSPRaO() {
-        DSPRaO q;
-
-        q = MethodReferenceTestVarArgsSuperDefault_I.super::xvO;
-        assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
-    }
-
-
-}
-
--- a/jdk/test/jdk/lambda/MethodReferenceTestVarArgsThis.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,177 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import org.testng.annotations.Test;
-import java.lang.reflect.Array;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * @author Robert Field
- */
-
-interface NsII { String m(Integer a, Integer b); }
-
-interface Nsiii { String m(int a, int b, int c); }
-
-interface Nsi { String m(int a); }
-
-interface NsaO { String m(Object[] a); }
-
-interface Nsai { String m(int[] a); }
-
-interface Nsvi { String m(int... va); }
-
-@Test
-public class MethodReferenceTestVarArgsThis {
-
-    // These should be processed as var args
-
-    String xvI(Integer... vi) {
-        StringBuilder sb = new StringBuilder("xvI:");
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    String xIvI(Integer f, Integer... vi) {
-        StringBuilder sb = new StringBuilder("xIvI:");
-        sb.append(f);
-        for (Integer i : vi) {
-            sb.append(i);
-            sb.append("-");
-        }
-        return sb.toString();
-    }
-
-    String xvi(int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xvi:" + sum;
-    }
-
-    String xIvi(Integer f, int... vi) {
-        int sum = 0;
-        for (int i : vi) {
-            sum += i;
-        }
-        return "xIvi:(" + f + ")" + sum;
-    }
-
-    String xvO(Object... vi) {
-        StringBuilder sb = new StringBuilder("xvO:");
-        for (Object i : vi) {
-            if (i.getClass().isArray()) {
-                sb.append("[");
-                int len = Array.getLength(i);
-                for (int x = 0; x < len; ++x)  {
-                    sb.append(Array.get(i, x));
-                    sb.append(",");
-                }
-                sb.append("]");
-
-            } else {
-                sb.append(i);
-            }
-            sb.append("*");
-        }
-        return sb.toString();
-    }
-
-    public void testVarArgsNsSuperclass() {
-        NsII q;
-
-        q = this::xvO;
-        assertEquals(q.m(55,66), "xvO:55*66*");
-    }
-
-    public void testVarArgsNsArray() {
-        Nsai q;
-
-        q = this::xvO;
-        assertEquals(q.m(new int[] { 55,66 } ), "xvO:[55,66,]*");
-    }
-
-    public void testVarArgsNsII() {
-        NsII q;
-
-        q = this::xvI;
-        assertEquals(q.m(33,7), "xvI:33-7-");
-
-        q = this::xIvI;
-        assertEquals(q.m(50,40), "xIvI:5040-");
-
-        q = this::xvi;
-        assertEquals(q.m(100,23), "xvi:123");
-
-        q = this::xIvi;
-        assertEquals(q.m(9,21), "xIvi:(9)21");
-    }
-
-    public void testVarArgsNsiii() {
-        Nsiii q;
-
-        q = this::xvI;
-        assertEquals(q.m(3, 2, 1), "xvI:3-2-1-");
-
-        q = this::xIvI;
-        assertEquals(q.m(888, 99, 2), "xIvI:88899-2-");
-
-        q = this::xvi;
-        assertEquals(q.m(900,80,7), "xvi:987");
-
-        q = this::xIvi;
-        assertEquals(q.m(333,27, 72), "xIvi:(333)99");
-    }
-
-    public void testVarArgsNsi() {
-        Nsi q;
-
-        q = this::xvI;
-        assertEquals(q.m(3), "xvI:3-");
-
-        q = this::xIvI;
-        assertEquals(q.m(888), "xIvI:888");
-
-        q = this::xvi;
-        assertEquals(q.m(900), "xvi:900");
-
-        q = this::xIvi;
-        assertEquals(q.m(333), "xIvi:(333)0");
-    }
-
-    // These should NOT be processed as var args
-
-    public void testVarArgsNsaO() {
-        NsaO q;
-
-        q = this::xvO;
-        assertEquals(q.m(new String[] { "yo", "there", "dude" }), "xvO:yo*there*dude*");
-    }
-
-
-}
--- a/jdk/test/jdk/lambda/shapegen/ClassCase.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,310 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- *
- * @author Robert Field
- */
-public class ClassCase {
-
-    public enum Kind {
-        IVAC        (true,  "v"),
-        IPRESENT    (true,  "p"),
-        IDEFAULT    (true,  "d"),
-        CNONE       (false, "n"),
-        CABSTRACT   (false, "a"),
-        CCONCRETE   (false, "c");
-
-        private final String prefix;
-        public final boolean isInterface;
-
-        Kind(boolean isInterface, String prefix) {
-            this.isInterface = isInterface;
-            this.prefix = prefix;
-        }
-
-        public String getPrefix() { return prefix; }
-    }
-
-    public final Kind kind;
-    private final ClassCase superclass;
-    private final List<ClassCase> supertypes;
-
-    private String name;
-    private boolean _OK;
-    private boolean _HasClassMethod;
-    private Set<ClassCase> _mprov;
-    private boolean _IsConcrete;
-    private boolean _HasDefault;
-    private ClassCase _mres;
-    private ClassCase _mdefend;
-
-    private Set<RuleGroup> executed = new HashSet<RuleGroup>();
-
-    public ClassCase(Kind kind, ClassCase superclass, List<ClassCase> interfaces) {
-        this.kind = kind;
-        this.superclass = superclass;
-
-        // Set supertypes from superclass (if any) and interfaces
-        List<ClassCase> lc;
-        if (superclass == null) {
-            lc = interfaces;
-        } else {
-            lc = new ArrayList<>();
-            lc.add(superclass);
-            lc.addAll(interfaces);
-        }
-        this.supertypes = lc;
-    }
-
-    public final boolean isInterface() { return kind.isInterface; }
-    public final boolean isClass() { return !kind.isInterface; }
-
-    public Set<ClassCase> get_mprov() {
-        exec(RuleGroup.PROVENENCE);
-        return _mprov;
-    }
-
-    public void set_mprov(ClassCase cc) {
-        Set<ClassCase> s = new HashSet<>();
-        s.add(cc);
-        _mprov = s;
-    }
-
-    public void set_mprov(Set<ClassCase> s) {
-        _mprov = s;
-    }
-
-    public ClassCase get_mres() {
-        exec(RuleGroup.RESOLUTION);
-        return _mres;
-    }
-
-    public void set_mres(ClassCase cc) {
-        _mres = cc;
-    }
-
-    public ClassCase get_mdefend() {
-        exec(RuleGroup.DEFENDER);
-        return _mdefend;
-    }
-
-    public void set_mdefend(ClassCase cc) {
-        _mdefend = cc;
-    }
-
-    public boolean get_HasClassMethod() {
-        exec(RuleGroup.PROVENENCE);
-        return _HasClassMethod;
-    }
-
-    public void set_HasClassMethod(boolean bool) {
-        _HasClassMethod = bool;
-    }
-
-    public boolean get_HasDefault() {
-        exec(RuleGroup.MARKER);
-        return _HasDefault;
-    }
-
-    public void set_HasDefault(boolean bool) {
-        _HasDefault = bool;
-    }
-
-    public boolean get_IsConcrete() {
-        exec(RuleGroup.MARKER);
-        return _IsConcrete;
-    }
-
-    public void set_IsConcrete(boolean bool) {
-        _IsConcrete = bool;
-    }
-
-    public boolean get_OK() {
-        exec(RuleGroup.CHECKING);
-        return _OK;
-    }
-
-    public void set_OK(boolean bool) {
-        _OK = bool;
-    }
-
-    public boolean isMethodDefined() {
-        for (ClassCase cc : supertypes) {
-            if (cc.isMethodDefined()) {
-                return true;
-            }
-        }
-        switch (kind) {
-            case CCONCRETE:
-            case CABSTRACT:
-            case IPRESENT:
-            case IDEFAULT:
-                return true;
-            default:
-                return false;
-        }
-    }
-
-    public boolean isAbstract() {
-        return isMethodDefined() && (get_mres()==null);
-    }
-
-    public boolean hasSuperclass() {
-        return superclass != null;
-    }
-
-    public ClassCase getSuperclass() {
-        return superclass;
-    }
-
-    public List<ClassCase> getSupertypes() {
-        return supertypes;
-    }
-
-    public List<ClassCase> getInterfaces() {
-        if (superclass != null) {
-            if (supertypes.get(0) != superclass) {
-                throw new AssertionError("superclass missing from supertypes");
-            }
-            return supertypes.subList(1, supertypes.size());
-        } else {
-            return supertypes;
-        }
-    }
-
-    public boolean isSubtypeOf(ClassCase cc) {
-        // S-Refl
-        if (cc.equals(this)) {
-            return true;
-        }
-
-        // S-Def
-        for (ClassCase sp : getSupertypes()) {
-            if (cc.equals(sp)) {
-                return true;
-            }
-        }
-
-        // _S-Trans
-        for (ClassCase sp : getSupertypes()) {
-            if (sp.isSubtypeOf(cc)) {
-                return true;
-            }
-        }
-
-        return false;
-    }
-
-    public void init(Map<String, Integer> namingContext) {
-        if (name != null) {
-            return; // Already inited
-        }
-
-        for (ClassCase sup : supertypes) {
-            sup.init(namingContext);
-        }
-
-        // Build name
-        StringBuilder sb = new StringBuilder();
-        if (!supertypes.isEmpty()) {
-            sb.append(isInterface() ? "I" : "C");
-            for (ClassCase cc : supertypes) {
-                sb.append(cc.getName());
-            }
-            sb.append(kind.isInterface ? "i" : "c");
-        }
-        sb.append(kind.prefix);
-        String pname = sb.toString();
-        Integer icnt = namingContext.get(pname);
-        int cnt = icnt == null ? 0 : icnt;
-        ++cnt;
-        namingContext.put(pname, cnt);
-        if (cnt > 1) {
-            sb.append(cnt);
-        }
-        this.name = sb.toString();
-    }
-
-    public boolean isa(Kind... kinds) {
-        for (Kind k : kinds) {
-            if (kind == k) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    private void exec(RuleGroup rg ) {
-        if (!executed.contains(rg)) {
-            rg.exec(this);
-            executed.add(rg);
-        }
-    }
-
-    public void collectClasses(Set<ClassCase> seen) {
-        seen.add(this);
-        for (ClassCase cc : supertypes) {
-            cc.collectClasses(seen);
-        }
-    }
-
-    public String getID() {
-        if (name == null) {
-            throw new Error("Access to uninitialized ClassCase");
-        } else {
-            return name;
-        }
-    }
-
-    public final String getName() {
-        if (name == null) {
-            return "ClassCase uninited@" + hashCode();
-        } else {
-            return name;
-        }
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return obj instanceof ClassCase && getID().equals(((ClassCase)obj).getID());
-    }
-
-    @Override
-    public int hashCode() {
-        return getID().hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return getName();
-    }
-}
--- a/jdk/test/jdk/lambda/shapegen/Hierarchy.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,207 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import static shapegen.ClassCase.Kind.*;
-
-/**
- *
- * @author Robert Field
- */
-public class Hierarchy {
-
-    public final ClassCase root;
-    public final Set<ClassCase> all;
-
-    public Hierarchy(ClassCase root) {
-        this.root = root;
-        root.init(new HashMap<String,Integer>());
-        Set<ClassCase> allClasses = new HashSet<>();
-        root.collectClasses(allClasses);
-        this.all = allClasses;
-    }
-
-    public boolean anyDefaults() {
-        for (ClassCase cc : all) {
-            if (cc.kind == IDEFAULT) {
-                return true;
-            }
-        }
-        return false;
-    }
-
-    public boolean get_OK() {
-        return root.get_OK();
-    }
-
-    public String testName() {
-        return root + "Test";
-    }
-
-    private static void genInterfaceList(StringBuilder buf, String prefix, List<ClassCase> interfaces) {
-            if (!interfaces.isEmpty()) {
-                buf.append(" ");
-                buf.append(prefix);
-                buf.append(" ");
-                buf.append(interfaces.get(0));
-                for (int i = 1; i < interfaces.size(); ++i) {
-                    buf.append(", " + interfaces.get(i));
-                }
-            }
-    }
-
-    public static void genClassDef(StringBuilder buf, ClassCase cc, String implClass, List<ClassCase> defaultRef) {
-        if (cc.isInterface()) {
-            buf.append("interface ");
-            buf.append(cc.getName() + " ");
-            genInterfaceList(buf, "extends", cc.getInterfaces());
-            buf.append(" {\n");
-
-            switch (cc.kind) {
-                case IDEFAULT:
-                    buf.append("    default String m() { return \"\"; }\n");
-                    defaultRef.add(cc);
-                    break;
-                case IPRESENT:
-                    buf.append("    String m();\n");
-                    break;
-                case IVAC:
-                    break;
-                default:
-                    throw new AssertionError("Unexpected kind");
-            }
-            buf.append("}\n\n");
-        } else {
-            buf.append((cc.isAbstract()? "abstract " : ""));
-            buf.append(" class " + cc.getName());
-            if (cc.getSuperclass() != null) {
-                buf.append(" extends " + cc.getSuperclass());
-            }
-
-            genInterfaceList(buf, "implements", cc.getInterfaces());
-            buf.append(" {\n");
-
-            switch (cc.kind) {
-                case CCONCRETE:
-                    buf.append("   public String m() { return \"\"; }\n");
-                    break;
-                case CABSTRACT:
-                    buf.append("   public abstract String m();\n");
-                    break;
-                case CNONE:
-                    break;
-                default:
-                    throw new AssertionError("Unexpected kind");
-            }
-            buf.append("}\n\n");
-        }
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        return obj instanceof Hierarchy && root.getID().equals(((Hierarchy)obj).root.getID());
-    }
-
-    @Override
-    public int hashCode() {
-        return root.getID().hashCode();
-    }
-
-    @Override
-    public String toString() {
-        return root.getName();
-    }
-
-    private static String classNames[] = {
-        "C", "D", "E", "F", "G", "H", "S", "T", "U", "V"
-    };
-
-    private static String interfaceNames[] = {
-        "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R"
-    };
-
-    private static int CLASS_INDEX = 0;
-    private static int INTERFACE_INDEX = 1;
-    private static int NUM_INDICIES = 2;
-
-    public List<String> getDescription() {
-        Map<ClassCase,String> nameMap = new HashMap<>();
-        assignNames(root, new int[NUM_INDICIES], nameMap);
-
-        ArrayList<String> res = new ArrayList<>();
-        if (root.getSupertypes().size() == 0) {
-           res.add(nameMap.get(root) + root.kind.getPrefix() + "()");
-        } else {
-            genCaseDescription(root, res, new HashSet<ClassCase>(), nameMap);
-        }
-        return res;
-    }
-
-    private static void assignNames(
-            ClassCase cc, int indices[], Map<ClassCase,String> names) {
-        String name = names.get(cc);
-        if (name == null) {
-            if (cc.isInterface()) {
-                names.put(cc, interfaceNames[indices[INTERFACE_INDEX]++]);
-            } else {
-                names.put(cc, classNames[indices[CLASS_INDEX]++]);
-            }
-            for (int i = 0; i < cc.getSupertypes().size(); ++i) {
-                assignNames(cc.getSupertypes().get(i), indices, names);
-            }
-        }
-    }
-
-    private static void genCaseDescription(
-            ClassCase cc, List<String> res, Set<ClassCase> alreadyDone,
-            Map<ClassCase,String> nameMap) {
-        if (!alreadyDone.contains(cc)) {
-            if (cc.getSupertypes().size() > 0) {
-                StringBuilder sb = new StringBuilder();
-                sb.append(nameMap.get(cc));
-                sb.append(cc.kind.getPrefix());
-                sb.append("(");
-                for (int i = 0; i < cc.getSupertypes().size(); ++i) {
-                    ClassCase supertype = cc.getSupertypes().get(i);
-                    if (i != 0) {
-                        sb.append(",");
-                    }
-                    genCaseDescription(supertype, res, alreadyDone, nameMap);
-                    sb.append(nameMap.get(supertype));
-                    sb.append(supertype.kind.getPrefix());
-                }
-                sb.append(")");
-                res.add(sb.toString());
-            }
-        }
-        alreadyDone.add(cc);
-    }
-}
--- a/jdk/test/jdk/lambda/shapegen/HierarchyGenerator.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,190 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-import shapegen.ClassCase.Kind;
-
-import java.util.Collection;
-import java.util.Set;
-import java.util.HashSet;
-import java.util.Collections;
-import java.util.ArrayList;
-import java.util.List;
-
-import static shapegen.ClassCase.Kind.*;
-
-import static java.lang.Math.pow;
-
-/**
- *
- * @author Robert Field
- */
-public final class HierarchyGenerator {
-
-    private int okcnt = 0;
-    private int errcnt = 0;
-    private Set<Hierarchy> uniqueOK = new HashSet<>();
-    private Set<Hierarchy> uniqueErr = new HashSet<>();
-
-    /**
-     * @param args the command line arguments
-     */
-    public HierarchyGenerator() {
-        organize("exhaustive interface", iExhaustive(2));
-        organize("exhaustive class", cExhaustive());
-        organize("shapes interface", iShapes());
-        organize("shapes class/interface", ciShapes());
-
-        System.out.printf("\nExpect OK:    %d -- unique %d",   okcnt,  uniqueOK.size());
-        System.out.printf("\nExpect Error: %d -- unique %d\n", errcnt, uniqueErr.size());
-    }
-
-    public Collection<Hierarchy> getOK() {
-        return uniqueOK;
-    }
-
-    public Collection<Hierarchy> getErr() {
-        return uniqueErr;
-    }
-
-    private void organize(String tname, List<Hierarchy> totest) {
-        System.out.printf("\nGenerating %s....\n", tname);
-        int nodefault = 0;
-        List<Hierarchy> ok = new ArrayList<>();
-        List<Hierarchy> err = new ArrayList<>();
-        for (Hierarchy cc : totest) {
-            if (cc.anyDefaults()) {
-                //System.out.printf("  %s\n", cc);
-                if (cc.get_OK()) {
-                    ok.add(cc);
-                } else {
-                    err.add(cc);
-                }
-            } else {
-                ++nodefault;
-            }
-        }
-
-        errcnt += err.size();
-        okcnt += ok.size();
-        uniqueErr.addAll(err);
-        uniqueOK.addAll(ok);
-
-        System.out.printf("  %5d No default\n  %5d Error\n  %5d OK\n  %5d Total\n",
-                nodefault, err.size(), ok.size(), totest.size());
-    }
-
-    public List<Hierarchy> iExhaustive(int idepth) {
-        List<ClassCase> current = new ArrayList<>();
-        for (int i = 0; i < idepth; ++i) {
-            current = ilayer(current);
-        }
-        return wrapInClassAndHierarchy(current);
-    }
-
-    private List<ClassCase> ilayer(List<ClassCase> srcLayer) {
-        List<ClassCase> lay = new ArrayList<>();
-        for (int i = (int) pow(2, srcLayer.size()) - 1; i >= 0; --i) {
-            List<ClassCase> itfs = new ArrayList<>();
-            for (int b = srcLayer.size() - 1; b >= 0; --b) {
-                if ((i & (1<<b)) != 0) {
-                    itfs.add(srcLayer.get(b));
-                }
-            }
-            lay.add(new ClassCase(IVAC, null, itfs));
-            lay.add(new ClassCase(IPRESENT, null, itfs));
-            lay.add(new ClassCase(IDEFAULT, null, itfs));
-            lay.add(new ClassCase(IDEFAULT, null, itfs));
-        }
-        return lay;
-    }
-
-    public List<Hierarchy> cExhaustive() {
-        final Kind[] iKinds = new Kind[]{IDEFAULT, IVAC, IPRESENT, null};
-        final Kind[] cKinds = new Kind[]{CNONE, CABSTRACT, CCONCRETE};
-        List<Hierarchy> totest = new ArrayList<>();
-        for (int i1 = 0; i1 < iKinds.length; ++i1) {
-            for (int i2 = 0; i2 < iKinds.length; ++i2) {
-                for (int i3 = 0; i3 < iKinds.length; ++i3) {
-                    for (int c1 = 0; c1 < cKinds.length; ++c1) {
-                        for (int c2 = 0; c2 < cKinds.length; ++c2) {
-                            for (int c3 = 0; c3 < cKinds.length; ++c3) {
-                                totest.add( new Hierarchy(
-                                        new ClassCase(cKinds[c1],
-                                            new ClassCase(cKinds[c2],
-                                                new ClassCase(cKinds[c3],
-                                                    null,
-                                                    iList(iKinds[i1])
-                                                ),
-                                                iList(iKinds[i2])
-                                            ),
-                                            iList(iKinds[i3])
-                                        )));
-                            }
-                        }
-                    }
-                }
-            }
-        }
-        return totest;
-    }
-
-    public static final List<ClassCase> EMPTY_LIST = new ArrayList<>();
-
-    private List<ClassCase> iList(Kind kind) {
-        if (kind == null) {
-            return EMPTY_LIST;
-        } else {
-            List<ClassCase> itfs = new ArrayList<>();
-            itfs.add(new ClassCase(kind, null, EMPTY_LIST));
-            return itfs;
-        }
-    }
-
-    public List<Hierarchy> ciShapes() {
-        return wrapInHierarchy(TTShape.allCases(true));
-    }
-
-    public List<Hierarchy> iShapes() {
-        return wrapInClassAndHierarchy(TTShape.allCases(false));
-    }
-
-    public List<Hierarchy> wrapInClassAndHierarchy(List<ClassCase> ihs) {
-        List<Hierarchy> totest = new ArrayList<>();
-        for (ClassCase cc : ihs) {
-            List<ClassCase> interfaces = new ArrayList<>();
-            interfaces.add(cc);
-            totest.add(new Hierarchy(new ClassCase(CNONE, null, interfaces)));
-        }
-        return totest;
-    }
-
-    public List<Hierarchy> wrapInHierarchy(List<ClassCase> ihs) {
-        List<Hierarchy> totest = new ArrayList<>();
-        for (ClassCase cc : ihs) {
-            totest.add(new Hierarchy(cc));
-        }
-        return totest;
-    }
-}
--- a/jdk/test/jdk/lambda/shapegen/Rule.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-/**
- *
- * @author Robert Field
- */
-public abstract class Rule {
-
-    public final String name;
-
-    public Rule(String name) {
-        this.name = name;
-    }
-
-    abstract boolean guard(ClassCase cc);
-
-    abstract void eval(ClassCase cc);
-
-    @Override
-    public String toString() {
-        return name;
-    }
-}
--- a/jdk/test/jdk/lambda/shapegen/RuleGroup.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,204 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import static shapegen.ClassCase.Kind.*;
-
-/**
- *
- * @author Robert Field
- */
-public class RuleGroup {
-
-    final String name;
-    private final Rule[] rules;
-
-    public RuleGroup(String name, Rule[] rules) {
-        this.name = name;
-        this.rules = rules;
-    }
-
-    public boolean exec(ClassCase cc) {
-        boolean found = false;
-        for (Rule rule : rules) {
-            if (rule.guard(cc)) {
-                if (found) {
-                    throw new RuntimeException("Bad rules -- multiple matches " + toString() + " for " + cc);
-                } else {
-                    rule.eval(cc);
-                    found = true;
-                }
-            }
-        }
-        return found;
-    }
-
-    @Override
-    public String toString() {
-        return name;
-    }
-
-    public static RuleGroup PROVENENCE = new RuleGroup("Provenence", new Rule[] {
-      new Rule("P-CDeclare") {
-          boolean guard(ClassCase cc) {
-              return cc.isa(CCONCRETE, CABSTRACT);
-          }
-
-          void eval(ClassCase cc) {
-              cc.set_mprov(cc);
-              cc.set_HasClassMethod(true);
-          }
-      },
-
-      new Rule("P-IDeclare") {
-          boolean guard(ClassCase cc) {
-              return cc.isa(IDEFAULT, IPRESENT);
-          }
-
-          void eval(ClassCase cc) {
-              cc.set_mprov(cc);
-          }
-      },
-
-      new Rule("P-IntfInh") {
-          boolean guard(ClassCase cc) {
-              return cc.isa(IVAC, CNONE) && !(cc.hasSuperclass() && cc.getSuperclass().get_HasClassMethod());
-          }
-
-          void eval(ClassCase cc) {
-              Set<ClassCase> _S = new HashSet<>();
-              for (ClassCase t : cc.getSupertypes()) {
-                  _S.addAll(t.get_mprov());
-              }
-              Set<ClassCase> tops = new HashSet<>();
-              for (ClassCase _W : _S) {
-                  for (ClassCase _V : _S) {
-                      if (_V.equals(_W) || !(_V.isSubtypeOf(_W))) {
-                          tops.add(_W);
-                      }
-                  }
-              }
-              cc.set_mprov(tops);
-          }
-      },
-
-      new Rule("P-ClassInh") {
-          boolean guard(ClassCase cc) {
-              return cc.isa(CNONE) && (cc.hasSuperclass() && cc.getSuperclass().get_HasClassMethod());
-          }
-
-          void eval(ClassCase cc) {
-              cc.set_mprov(cc.getSuperclass());
-              cc.set_HasClassMethod(true);
-          }
-      },
-
-    });
-
-    public static RuleGroup MARKER = new RuleGroup("Marker", new Rule[] {
-      new Rule("M-Default") {
-          boolean guard(ClassCase cc) {
-              return cc.isa(IDEFAULT);
-          }
-
-          void eval(ClassCase cc) {
-              cc.set_HasDefault(true);
-          }
-      },
-
-      new Rule("M-Conc") {
-          boolean guard(ClassCase cc) {
-            return cc.isa(CCONCRETE);
-          }
-
-          void eval(ClassCase cc) {
-              cc.set_IsConcrete(true);
-          }
-      },
-
-    });
-
-    public static RuleGroup RESOLUTION = new RuleGroup("Resolution", new Rule[] {
-      new Rule("R-Resolve") {
-          boolean guard(ClassCase cc) {
-              if (!(cc.isClass() && cc.get_mprov().size() == 1)) {
-                  return false;
-              }
-              ClassCase _V = cc.get_mprov().iterator().next();
-              return _V.get_IsConcrete() || _V.get_HasDefault();
-          }
-
-          void eval(ClassCase cc) {
-              ClassCase _V = cc.get_mprov().iterator().next();
-              cc.set_mres(_V);
-          }
-      },
-
-    });
-
-    public static RuleGroup DEFENDER = new RuleGroup("Defender", new Rule[] {
-      new Rule("D-Defend") {
-          boolean guard(ClassCase cc) {
-              ClassCase mresSuper = cc.hasSuperclass() ? cc.getSuperclass().get_mres() : null;
-              boolean eq = cc.get_mres() == null ? mresSuper == null : cc.get_mres().equals(mresSuper);
-              return cc.isa(CNONE) && !eq;
-          }
-
-          void eval(ClassCase cc) {
-              cc.set_mdefend(cc.get_mres());
-          }
-      },
-
-    });
-
-    public static RuleGroup CHECKING = new RuleGroup("Checking", new Rule[] {
-      new Rule("C-Check") {
-          boolean guard(ClassCase cc) {
-              for (ClassCase t : cc.getSupertypes()) {
-                  if (! t.get_OK()) {
-                      return false;
-                  }
-              }
-              int defenderCount = 0;
-              int provCount = 0;
-              for (ClassCase prov : cc.get_mprov()) {
-                  if (prov.get_HasDefault()) {
-                      defenderCount++;
-                  }
-                  provCount++;
-              }
-              return provCount <= 1 || defenderCount == 0;
-          }
-
-          void eval(ClassCase cc) {
-              cc.set_OK(true);
-          }
-      },
-
-    });
-
-}
--- a/jdk/test/jdk/lambda/shapegen/TTNode.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-import shapegen.ClassCase.Kind;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import static shapegen.ClassCase.Kind.*;
-
-/**
- * Type Template Node
- *
- * @author Robert Field
- */
-public class TTNode {
-
-    final List<TTNode> supertypes;
-    final boolean canBeClass;
-
-    private int currentKindIndex;
-    private Kind[] kinds;
-
-    public TTNode(List<TTNode> subtypes, boolean canBeClass) {
-        this.supertypes = subtypes;
-        this.canBeClass = canBeClass;
-    }
-
-    public void start(boolean includeClasses) {
-        kinds =
-             supertypes.isEmpty()?
-                (new Kind[]{IDEFAULT, IPRESENT})
-             :  ((includeClasses && canBeClass)?
-                  new Kind[]{CNONE, IVAC, IDEFAULT, IPRESENT}
-                : new Kind[]{IVAC, IDEFAULT, IPRESENT});
-        currentKindIndex = 0;
-
-        for (TTNode sub : supertypes) {
-            sub.start(includeClasses);
-        }
-    }
-
-    public boolean next() {
-        ++currentKindIndex;
-        if (currentKindIndex >= kinds.length) {
-            currentKindIndex = 0;
-            return false;
-        } else {
-            return true;
-        }
-    }
-
-    public void collectAllSubtypes(Set<TTNode> subs) {
-        subs.add(this);
-        for (TTNode n : supertypes) {
-            n.collectAllSubtypes(subs);
-        }
-    }
-
-    private Kind getKind() {
-        return kinds[currentKindIndex];
-    }
-
-    boolean isInterface() {
-        return getKind().isInterface;
-    }
-
-    boolean isClass() {
-        return !isInterface();
-    }
-
-    boolean hasDefault() {
-        return getKind() == IDEFAULT;
-    }
-
-    public boolean isValid() {
-        for (TTNode n : supertypes) {
-            if (!n.isValid() || (isInterface() && n.isClass())) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    public ClassCase genCase() {
-        ClassCase subclass;
-        List<TTNode> ttintfs;
-        if (isClass() && !supertypes.isEmpty() && supertypes.get(0).isClass()) {
-            subclass = supertypes.get(0).genCase();
-            ttintfs = supertypes.subList(1, supertypes.size());
-        } else {
-            subclass = null;
-            ttintfs = supertypes;
-        }
-        List<ClassCase> intfs = new ArrayList<>();
-        for (TTNode node : ttintfs) {
-            intfs.add(node.genCase());
-        }
-        return new ClassCase(getKind(), subclass, intfs);
-    }
-}
--- a/jdk/test/jdk/lambda/shapegen/TTParser.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.io.IOException;
-import java.io.StringReader;
-
-import static java.lang.Character.isLetter;
-import static java.lang.Character.isUpperCase;
-import static java.lang.Character.isWhitespace;
-
-/**
- * Parse a type template definition string
- *
- *   input     :: classDef
- *   classDef  :: letter [ ( classDef* ) ]
- *
- * @author Robert Field
- */
-public class TTParser extends StringReader {
-
-    private Map<Character, TTNode> letterMap = new HashMap<>();
-    private char ch;
-
-    private final String def;
-
-    public TTParser(String s) {
-        super(s);
-        this.def = s;
-    }
-
-    private void advance() throws IOException {
-        do {
-            ch = (char)read();
-        } while (isWhitespace(ch));
-    }
-
-    public TTNode parse() {
-        try {
-            advance();
-            return classDef();
-        } catch (IOException t) {
-            throw new RuntimeException(t);
-        }
-    }
-
-    private TTNode classDef() throws IOException {
-        if (!isLetter(ch)) {
-            if (ch == (char)-1) {
-                throw new IOException("Unexpected end of type template in " + def);
-            } else {
-                throw new IOException("Unexpected character in type template: " + (Character)ch + " in " + def);
-            }
-        }
-        char nodeCh = ch;
-        TTNode node = letterMap.get(nodeCh);
-        boolean canBeClass = isUpperCase(nodeCh);
-        advance();
-        if (node == null) {
-            List<TTNode> subtypes = new ArrayList<>();
-            if (ch == '(') {
-                advance();
-                while (ch != ')') {
-                    subtypes.add(classDef());
-                }
-                advance();
-            }
-            node = new TTNode(subtypes, canBeClass);
-            letterMap.put(nodeCh, node);
-        }
-        return node;
-    }
-}
--- a/jdk/test/jdk/lambda/shapegen/TTShape.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package shapegen;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- *
- * @author Robert Field
- */
-public class TTShape {
-
-    private final TTNode root;
-    private final TTNode[] nodes;
-
-    TTShape(TTNode root) {
-        this.root = root;
-        Set<TTNode> subs = new HashSet<>();
-        root.collectAllSubtypes(subs);
-        nodes = subs.toArray(new TTNode[subs.size()]);
-    }
-
-    private List<ClassCase> toCases(boolean includeClasses) {
-        List<ClassCase> ccs = new ArrayList<>();
-        root.start(includeClasses);
-        int i;
-        outer:
-        while (true) {
-            if (root.isValid()) {
-                ClassCase cc = root.genCase();
-                //System.out.println(cc);
-                ccs.add(cc);
-            }
-
-            i = 0;
-            do {
-                if (i >= nodes.length) {
-                    break outer;
-                }
-            } while(!nodes[i++].next());
-        }
-        return ccs;
-    }
-
-   public static List<ClassCase> allCases(boolean includeClasses) {
-        List<ClassCase> ccs = new ArrayList<>();
-        for (TTShape shape : SHAPES) {
-            ccs.addAll(shape.toCases(includeClasses));
-        }
-        return ccs;
-    }
-
-    public static TTShape parse(String s) {
-        return new TTShape(new TTParser(s).parse());
-    }
-
-    public static final TTShape[] SHAPES = new TTShape[] {
-        parse("a"),
-        parse("a(b)"),
-        parse("A(bb)"),
-        parse("A(B(d)c(d))"),
-        parse("A(b(c))"),
-        parse("A(B(cd)d)"),
-        parse("A(B(c)c)"),
-        parse("A(B(Ce)d(e))"),
-        parse("A(B(C)d(e))"),
-        parse("A(Bc(d))"),
-        parse("A(B(d)dc)"),
-        parse("A(B(dc)dc)"),
-        parse("A(B(c(d))d)"),
-        parse("A(B(C(d))d)"),
-        parse("A(B(C(e)d(e))e)"),
-        parse("A(B(c(d))c)"),
-        parse("A(B(dc(d))c)"),
-        parse("A(B(C(d))d)"),
-    };
-
-}
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION	Wed Jul 05 20:27:20 2017 +0200
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2015a
+tzdata2015b
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia	Wed Jul 05 20:27:20 2017 +0200
@@ -1927,6 +1927,13 @@
 # was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
 # this is almost surely wrong.
 
+# From Ganbold Tsagaankhuu (2015-03-10):
+# It seems like yesterday Mongolian Government meeting has concluded to use
+# daylight saving time in Mongolia....  Starting at 2:00AM of last Saturday of
+# March 2015, daylight saving time starts.  And 00:00AM of last Saturday of
+# September daylight saving time ends.  Source:
+# http://zasag.mn/news/view/8969
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mongol	1983	1984	-	Apr	1	0:00	1:00	S
 Rule	Mongol	1983	only	-	Oct	1	0:00	0	-
@@ -1947,6 +1954,8 @@
 Rule	Mongol	2001	only	-	Apr	lastSat	2:00	1:00	S
 Rule	Mongol	2001	2006	-	Sep	lastSat	2:00	0	-
 Rule	Mongol	2002	2006	-	Mar	lastSat	2:00	1:00	S
+Rule	Mongol	2015	max	-	Mar	lastSat	2:00	1:00	S
+Rule	Mongol	2015	max	-	Sep	lastSat	0:00	0	-
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 # Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
@@ -2365,13 +2374,19 @@
 # official source...:
 # http://www.palestinecabinet.gov.ps/ar/Views/ViewDetails.aspx?pid=1252
 
-# From Paul Eggert (2013-09-24):
-# For future dates, guess the last Thursday in March at 24:00 through
-# the first Friday on or after September 21 at 00:00.  This is consistent with
-# the predictions in today's editions of the following URLs,
-# which are for Gaza and Hebron respectively:
-# http://www.timeanddate.com/worldclock/timezone.html?n=702
-# http://www.timeanddate.com/worldclock/timezone.html?n=2364
+# From Steffen Thorsen (2015-03-03):
+# Sources such as http://www.alquds.com/news/article/view/id/548257
+# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
+# start DST on 2015-03-28 00:00 which is one day later than expected.
+#
+# From Paul Eggert (2015-03-03):
+# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
+# says that the fall 2014 transition was Oct 23 at 24:00.
+# For future dates, guess the last Friday in March at 24:00 through
+# the first Friday on or after October 21 at 00:00.  This is consistent with
+# the predictions in today's editions of the following URLs:
+# http://www.timeanddate.com/time/change/gaza-strip/gaza
+# http://www.timeanddate.com/time/change/west-bank/hebron
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
@@ -2397,9 +2412,11 @@
 Rule Palestine	2011	only	-	Aug	 1	0:00	0	-
 Rule Palestine	2011	only	-	Aug	30	0:00	1:00	S
 Rule Palestine	2011	only	-	Sep	30	0:00	0	-
-Rule Palestine	2012	max	-	Mar	lastThu	24:00	1:00	S
+Rule Palestine	2012	2014	-	Mar	lastThu	24:00	1:00	S
 Rule Palestine	2012	only	-	Sep	21	1:00	0	-
-Rule Palestine	2013	max	-	Sep	Fri>=21	0:00	0	-
+Rule Palestine	2013	only	-	Sep	Fri>=21	0:00	0	-
+Rule Palestine	2014	max	-	Oct	Fri>=21	0:00	0	-
+Rule Palestine	2015	max	-	Mar	lastFri	24:00	1:00	S
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct
--- a/jdk/test/sun/util/calendar/zi/tzdata/australasia	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia	Wed Jul 05 20:27:20 2017 +0200
@@ -396,6 +396,7 @@
 			 9:39:00 -	LMT	1901        # Agana
 			10:00	-	GST	2000 Dec 23 # Guam
 			10:00	-	ChST	# Chamorro Standard Time
+Link Pacific/Guam Pacific/Saipan # N Mariana Is
 
 # Kiribati
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -411,12 +412,7 @@
 			 14:00	-	LINT
 
 # N Mariana Is
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Pacific/Saipan	-14:17:00 -	LMT	1844 Dec 31
-			 9:43:00 -	LMT	1901
-			 9:00	-	MPT	1969 Oct    # N Mariana Is Time
-			10:00	-	MPT	2000 Dec 23
-			10:00	-	ChST	# Chamorro Standard Time
+# See Pacific/Guam.
 
 # Marshall Is
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -586,6 +582,7 @@
 			-11:00	-	NST	1967 Apr    # N=Nome
 			-11:00	-	BST	1983 Nov 30 # B=Bering
 			-11:00	-	SST	            # S=Samoa
+Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
 
 # Samoa (formerly and also known as Western Samoa)
 
@@ -767,23 +764,7 @@
 # uninhabited
 
 # Midway
-#
-# From Mark Brader (2005-01-23):
-# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
-# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
-# reproduced a Pan American Airways timetable from 1936, for their weekly
-# "Orient Express" flights between San Francisco and Manila, and connecting
-# flights to Chicago and the US East Coast.  As it uses some time zone
-# designations that I've never seen before:....
-# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I.   H.L.T. Ar. 5:30P Sun.
-#  "   3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A  "
-#
-Zone Pacific/Midway	-11:49:28 -	LMT	1901
-			-11:00	-	NST	1956 Jun  3
-			-11:00	1:00	NDT	1956 Sep  2
-			-11:00	-	NST	1967 Apr    # N=Nome
-			-11:00	-	BST	1983 Nov 30 # B=Bering
-			-11:00	-	SST	            # S=Samoa
+# See Pacific/Pago_Pago.
 
 # Palmyra
 # uninhabited since World War II; was probably like Pacific/Kiritimati
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe	Wed Jul 05 20:27:20 2017 +0200
@@ -2423,7 +2423,7 @@
 			 4:00	Russia	VOL%sT	1989 Mar 26  2:00s # Volgograd T
 			 3:00	Russia	VOL%sT	1991 Mar 31  2:00s
 			 4:00	-	VOLT	1992 Mar 29  2:00s
-			 3:00	Russia	MSK	2011 Mar 27  2:00s
+			 3:00	Russia	MSK/MSD	2011 Mar 27  2:00s
 			 4:00	-	MSK	2014 Oct 26  2:00s
 			 3:00	-	MSK
 
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica	Wed Jul 05 20:27:20 2017 +0200
@@ -2335,8 +2335,24 @@
 # "...the new time zone will come into effect at two o'clock on the first Sunday
 # of February, when we will have to advance the clock one hour from its current
 # time..."
+# Also, the new zone will not use DST.
 #
-# Also, the new zone will not use DST.
+# From Carlos Raúl Perasso (2015-02-02):
+# The decree that modifies the Mexican Hour System Law has finally
+# been published at the Diario Oficial de la Federación
+# http://www.dof.gob.mx/nota_detalle.php?codigo=5380123&fecha=31/01/2015
+# It establishes 5 zones for Mexico:
+# 1- Zona Centro (Central Zone): Corresponds to longitude 90 W,
+#    includes most of Mexico, excluding what's mentioned below.
+# 2- Zona Pacífico (Pacific Zone): Longitude 105 W, includes the
+#    states of Baja California Sur; Chihuahua; Nayarit (excluding Bahía
+#    de Banderas which lies in Central Zone); Sinaloa and Sonora.
+# 3- Zona Noroeste (Northwest Zone): Longitude 120 W, includes the
+#    state of Baja California.
+# 4- Zona Sureste (Southeast Zone): Longitude 75 W, includes the state
+#    of Quintana Roo.
+# 5- The islands, reefs and keys shall take their timezone from the
+#    longitude they are located at.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Mexico	1939	only	-	Feb	5	0:00	1:00	D
@@ -2531,14 +2547,9 @@
 ###############################################################################
 
 # Anguilla
+# Antigua and Barbuda
 # See America/Port_of_Spain.
 
-# Antigua and Barbuda
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	America/Antigua	-4:07:12 -	LMT	1912 Mar 2
-			-5:00	-	EST	1951
-			-4:00	-	AST
-
 # Bahamas
 #
 # For 1899 Milne gives -5:09:29.5; round that.
@@ -2604,10 +2615,7 @@
 			-4:00	US	A%sT
 
 # Cayman Is
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	America/Cayman	-5:25:32 -	LMT	1890     # Georgetown
-			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
-			-5:00	-	EST
+# See America/Panama.
 
 # Costa Rica
 
@@ -3130,6 +3138,7 @@
 Zone	America/Panama	-5:18:08 -	LMT	1890
 			-5:19:36 -	CMT	1908 Apr 22 # Colón Mean Time
 			-5:00	-	EST
+Link America/Panama America/Cayman
 
 # Puerto Rico
 # There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Wed Apr 08 13:12:48 2015 -0700
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica	Wed Jul 05 20:27:20 2017 +0200
@@ -1229,10 +1229,13 @@
 # DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
 # http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
 
-# From Juan Correa (2015-01-28):
-# ... today the Ministry of Energy announced that Chile will drop DST, will keep
-# "summer time" (UTC -3 / UTC -5) all year round....
-# http://www.minenergia.cl/ministerio/noticias/generales/ministerio-de-energia-anuncia.html
+# From Eduardo Romero Urra (2015-03-03):
+# Today has been published officially that Chile will use the DST time
+# permanently until March 25 of 2017
+# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg
+#
+# From Paul Eggert (2015-03-03):
+# For now, assume that the extension will persist indefinitely.
 
 # NOTE: ChileAQ rules for Antarctic bases are stored separately in the
 # 'antarctica' file.
@@ -1291,7 +1294,7 @@
 			-3:00	-	CLT
 Zone Pacific/Easter	-7:17:44 -	LMT	1890
 			-7:17:28 -	EMT	1932 Sep    # Easter Mean Time
-			-7:00	Chile	EAS%sT	1982 Mar 13 3:00u # Easter Time
+			-7:00	Chile	EAS%sT	1982 Mar 14 3:00u # Easter Time
 			-6:00	Chile	EAS%sT	2015 Apr 26 3:00u
 			-5:00	-	EAST
 #
@@ -1626,6 +1629,7 @@
 
 # These all agree with Trinidad and Tobago since 1970.
 Link America/Port_of_Spain America/Anguilla
+Link America/Port_of_Spain America/Antigua
 Link America/Port_of_Spain America/Dominica
 Link America/Port_of_Spain America/Grenada
 Link America/Port_of_Spain America/Guadeloupe
--- a/make/CompileJavaModules.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/make/CompileJavaModules.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -151,9 +151,19 @@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   # exclude all X11 on Mac.
-  java.desktop_EXCLUDES += sun/awt/X11
+  java.desktop_EXCLUDES += \
+      sun/awt/X11 \
+      sun/java2d/x11 \
+      sun/java2d/jules \
+      sun/java2d/xr \
+      com/sun/java/swing/plaf/gtk \
+      #
   java.desktop_EXCLUDE_FILES += \
-      $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/BackBufferCapsProvider.java \
+      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/*.java) \
+      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/java2d/opengl/*.java) \
+      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/awt/*.java) \
+      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/awt/motif/*.java) \
+      $(wildcard $(JDK_TOPDIR)/src/java.desktop/unix/classes/sun/font/*.java) \
       #
 else
   # TBD: figure out how to eliminate this long list
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/Help.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,115 @@
+#
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+###
+### Global targets for printing help etc.
+###
+
+# Helper macro to allow $(info) to properly print strings beginning with spaces.
+_:=
+
+help:
+	$(info )
+	$(info OpenJDK Makefile help)
+	$(info =====================)
+	$(info )
+	$(info Common make targets)
+	$(info $(_) make [default]         # Compile all modules in langtools, hotspot, jdk, jaxws,)
+	$(info $(_)                        # jaxp and corba, and create a runnable "exploded" image)
+	$(info $(_) make all               # Compile everything, all repos, docs and images)
+	$(info $(_) make images            # Create complete jdk and jre images)
+	$(info $(_) make <phase>           # Build the specified phase and everything it depends on)
+	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
+	$(info $(_) make *-only            # Applies to most targets and disables compling the)
+	$(info $(_)                        # dependencies for the target. This is faster but may)
+	$(info $(_)                        # result in incorrect build results!)
+	$(info $(_) make docs              # Create all docs)
+	$(info $(_) make docs-javadoc      # Create just javadocs, depends on less than full docs)
+	$(info $(_) make profiles          # Create complete jre compact profile images)
+	$(info $(_) make bootcycle-images  # Build images twice, second time with newly built JDK)
+	$(info $(_) make install           # Install the generated images locally)
+	$(info $(_) make reconfigure       # Rerun configure with the same arguments as last time)
+	$(info $(_) make help              # Give some help on using make)
+	$(info $(_) make test              # Run tests, default is all tests (see TEST below))
+	$(info )
+	$(info Targets for cleaning)
+	$(info $(_) make clean             # Remove all files generated by make, but not those)
+	$(info $(_)                        # generated by configure)
+	$(info $(_) make dist-clean        # Remove all files, including configuration)
+	$(info $(_) make clean-<outputdir> # Remove the subdir in the output dir with the name)
+	$(info $(_) make clean-<phase>     # Remove all build results related to a certain build)
+	$(info $(_)                        # phase (gensrc, java, libs, launchers))
+	$(info $(_) make clean-<module>    # Remove all build results related to a certain module)
+	$(info $(_) make clean-<module>-<phase> # Remove all build results related to a certain)
+	$(info $(_)                        # module and phase)
+	$(info )
+	$(info Targets for specific modules)
+	$(info $(_) make <module>          # Build <module> and everything it depends on)
+	$(info $(_) make <module>-<phase>  # Compile the specified phase for the specified module)
+	$(info $(_)                        # and everything it depends on)
+	$(info $(_)                        # (gensrc, java, copy, libs, launchers, gendata, rmic))
+	$(info )
+	$(info Make control variables)
+	$(info $(_) CONF=                  # Build all configurations (note, assignment is empty))
+	$(info $(_) CONF=<substring>       # Build the configuration(s) with a name matching)
+	$(info $(_)                        # <substring>)
+	$(info $(_) SPEC=<spec file>       # Build the configuration given by the spec file)
+	$(info $(_) LOG=<loglevel>         # Change the log level from warn to <loglevel>)
+	$(info $(_)                        # Available log levels are:)
+	$(info $(_)                        # 'warn' (default), 'info', 'debug' and 'trace')
+	$(info $(_)                        # To see executed command lines, use LOG=debug)
+	$(info $(_) JOBS=<n>               # Run <n> parallel make jobs)
+	$(info $(_)                        # Note that -jN does not work as expected!)
+	$(info $(_) CONF_CHECK=<method>    # What to do if spec file is out of date)
+	$(info $(_)                        # method is 'auto', 'ignore' or 'fail' (default))
+	$(info $(_) make test TEST=<test>  # Only run the given test or tests, e.g.)
+	$(info $(_)                        # make test TEST="jdk_lang jdk_net")
+	$(info )
+	$(if $(all_confs), $(info Available configurations in $(build_dir):) $(foreach var,$(all_confs),$(info * $(var))),\
+	    $(info No configurations were found in $(build_dir).) $(info Run 'bash configure' to create a configuration))
+        # We need a dummy rule otherwise make will complain
+	@true
+
+print-targets:
+	$(if $(any_spec_file), ,\
+	  @echo "Note: More targets will be available when at least one configuration exists." 1>&2\
+	)
+	@echo $(ALL_TARGETS)
+
+print-modules:
+	$(if $(any_spec_file), \
+	  @$(MAKE) -s -f $(topdir)/make/Main.gmk -I $(topdir)/make/common SPEC=$(any_spec_file) print-modules \
+	, \
+	  @echo print-modules can currently only be run when at least one configuration exists \
+	)
+
+print-configurations:
+	$(foreach var, $(all_confs), $(info $(var)))
+        # We need a dummy rule otherwise make will complain
+	@true
+
+ALL_GLOBAL_TARGETS := help print-modules print-targets print-configurations
+
+.PHONY: $(ALL_GLOBAL_TARGETS)
--- a/make/HotspotWrapper.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/make/HotspotWrapper.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -42,7 +42,7 @@
 # not doing it breaks builds on msys.
 $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp: $(HOTSPOT_FILES)
 	@$(MKDIR) -p $(HOTSPOT_OUTPUTDIR)
-	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
+	@($(CD) $(HOTSPOT_TOPDIR)/make && $(MAKE) $(HOTSPOT_MAKE_ARGS) LOG_LEVEL=$(LOG_LEVEL) SPEC=$(HOTSPOT_SPEC) BASE_SPEC=$(BASE_SPEC))
 	$(TOUCH) $@
 
 hotspot: $(HOTSPOT_OUTPUTDIR)/_hotspot.timestamp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/Init.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,229 @@
+#
+# Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  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 is the bootstrapping part of the build. This file is included from the
+# top level Makefile, and is responsible for launching the Main.gmk file with
+# the proper make and the proper make arguments.
+################################################################################
+
+# This must be the first rule
+default:
+.PHONY: default
+
+# Inclusion of this pseudo-target will cause make to execute this file
+# serially, regardless of -j.
+.NOTPARALLEL:
+
+# If included from the top-level Makefile then topdir is set, but not when
+# recursively calling ourself with a spec.
+ifeq ($(topdir),)
+  topdir := $(strip $(patsubst %/make/, %, $(dir $(lastword $(MAKEFILE_LIST)))))
+endif
+
+# Our helper functions. Will include $(SPEC) if $(HAS_SPEC) is true.
+include $(topdir)/make/InitSupport.gmk
+
+# Here are "global" targets, i.e. targets that can be executed without having a configuration.
+# This will define ALL_GLOBAL_TARGETS.
+include $(topdir)/make/Help.gmk
+
+# Extract main targets from Main.gmk.
+ifneq ($(any_spec_file), )
+  ifeq ($(wildcard $(dir $(any_spec_file))/make-support/module-deps.gmk),)
+    # If make-support does not exist, we need to build the genmodules java tool first.
+    $(info Creating data for first make execution in new configuration...)
+    ignore_output := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \
+        -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true FRC)
+    $(info Done)
+  endif
+  ALL_MAIN_TARGETS := $(shell $(MAKE) -r -R -f $(topdir)/make/Main.gmk \
+      -I $(topdir)/make/common SPEC=$(any_spec_file) NO_RECIPES=true print-targets)
+else
+  # Without at least a single valid configuration, we cannot extract any real
+  # targets. To provide a helpful error message about the missing configuration
+  # later on, accept whatever targets the user has provided for now.
+  ALL_MAIN_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
+endif
+
+# Targets provided by this file.
+ALL_INIT_TARGETS := reconfigure
+
+ALL_TARGETS := $(sort $(ALL_GLOBAL_TARGETS) $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS))
+
+ifneq ($(findstring qp, $(MAKEFLAGS)),)
+  ##############################################################################
+  # When called with -qp, assume an external part (e.g. bash completion) is trying
+  # to understand our targets. Just list our targets and do no more checking.
+  ##############################################################################
+
+  $(ALL_TARGETS):
+
+  .PHONY: $(ALL_TARGETS)
+
+else ifeq ($(HAS_SPEC),)
+
+  ##############################################################################
+  # This is the normal case, we have been called from the command line by the
+  # user and we need to call ourself back with a proper SPEC.
+  ##############################################################################
+
+  $(eval $(call CheckControlVariables))
+  $(eval $(call CheckDeprecatedEnvironment))
+  $(eval $(call CheckInvalidMakeFlags))
+
+  $(eval $(call ParseConfCheckOption))
+
+  # Check that the LOG given is valid, and set LOG_LEVEL, LOG_NOFILE and MAKE_LOG_FLAGS.
+  $(eval $(call ParseLogLevel))
+
+  ifneq ($(findstring $(LOG_LEVEL),info debug trace),)
+    $(info Running make as '$(strip $(MAKE) $(MFLAGS) $(COMMAND_LINE_VARIABLES) $(MAKECMDGOALS))')
+  endif
+
+  # CALLED_TARGETS is the list of targets that the user provided,
+  # or "default" if unspecified.
+  CALLED_TARGETS := $(if $(MAKECMDGOALS), $(MAKECMDGOALS), default)
+  CALLED_SPEC_TARGETS := $(filter $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS), $(CALLED_TARGETS))
+  ifneq ($(CALLED_SPEC_TARGETS),)
+    # We have at least one non-global target, which need a SPEC
+    $(eval $(call ParseConfAndSpec))
+    # Now SPECS contain 1..N spec files (otherwise ParseConfAndSpec fails)
+
+    INIT_TARGETS := $(filter $(ALL_INIT_TARGETS), $(CALLED_SPEC_TARGETS))
+    SEQUENTIAL_TARGETS := $(filter dist-clean clean%, $(CALLED_SPEC_TARGETS))
+    PARALLEL_TARGETS := $(filter-out $(INIT_TARGETS) $(SEQUENTIAL_TARGETS), $(CALLED_SPEC_TARGETS))
+
+    # The spec files depend on the autoconf source code. This check makes sure
+    # the configuration is up to date after changes to configure.
+    $(SPECS): $(wildcard $(topdir)/common/autoconf/*)
+        ifeq ($(CONF_CHECK), fail)
+	  @echo "Error: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'."
+	  $(call PrintConfCheckFailed)
+	  @exit 2
+        else ifeq ($(CONF_CHECK), auto)
+	  @echo "Note: The configuration is not up to date for '$(lastword $(subst /, , $(dir $@)))'."
+	  @( cd $(topdir) && \
+	      $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -f $(topdir)/make/Init.gmk SPEC=$@ HAS_SPEC=true \
+	      reconfigure )
+        else ifeq ($(CONF_CHECK), ignore)
+          # Do nothing
+        endif
+
+    # Unless reconfigure is explicitely called, let all targets depend on the spec files to be up to date.
+    ifeq ($(findstring reconfigure, $(CALLED_SPEC_TARGETS)), )
+      $(CALLED_SPEC_TARGETS): $(SPECS)
+    endif
+
+    # The recipe will be run once for every target specified, but we only want to execute the
+    # recipe a single time, hence the TARGET_DONE with a dummy command if true.
+    $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS):
+	@$(if $(TARGET_DONE), \
+	  true \
+	, \
+	  $(foreach spec, $(SPECS), \
+	    ( cd $(topdir) && \
+	    $(MAKE) $(MFLAGS) $(MAKE_LOG_FLAGS) -j 1 -f $(topdir)/make/Init.gmk \
+	        SPEC=$(spec) HAS_SPEC=true \
+	        USER_MAKE_VARS="$(USER_MAKE_VARS)" MAKE_LOG_FLAGS=$(MAKE_LOG_FLAGS) \
+	        LOG_LEVEL=$(LOG_LEVEL) LOG_NOFILE=$(LOG_NOFILE) \
+	        INIT_TARGETS="$(INIT_TARGETS)" SEQUENTIAL_TARGETS="$(SEQUENTIAL_TARGETS)" \
+	        PARALLEL_TARGETS="$(PARALLEL_TARGETS)"  \
+	        main ) && \
+	  ) true \
+	  $(eval TARGET_DONE=true) \
+	)
+
+    .PHONY: $(ALL_MAIN_TARGETS) $(ALL_INIT_TARGETS)
+
+  endif # has $(CALLED_SPEC_TARGETS)
+
+else # HAS_SPEC=true
+
+  ##############################################################################
+  # Now we have a spec. This part provides the "main" target that acts as a
+  # trampoline to call the Main.gmk with the value of $(MAKE) found in the spec
+  # file.
+  ##############################################################################
+
+  ifeq ($(LOG_NOFILE), true)
+    # Disable log wrapper if LOG=[level,]nofile was given
+    override BUILD_LOG_WRAPPER :=
+  endif
+
+  ifeq ($(OUTPUT_SYNC_SUPPORTED), true)
+    OUTPUT_SYNC_FLAG := -O$(OUTPUT_SYNC)
+  endif
+
+  $(eval $(call CheckSpecSanity))
+
+  reconfigure:
+        ifneq ($(CONFIGURE_COMMAND_LINE), )
+	  $(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
+        else
+	  $(ECHO) "Re-running configure using default settings"
+        endif
+	( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
+	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
+
+  main-init:
+	$(call RotateLogFiles)
+	$(BUILD_LOG_WRAPPER) $(PRINTF) "Building target(s) '$(strip \
+	    $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \
+	    )' in configuration '$(CONF_NAME)'\n"
+
+
+  # MAKEOVERRIDES is automatically set and propagated by Make to sub-Make calls.
+  # We need to clear it of the init-specific variables. The user-specified
+  # variables are explicitely propagated using $(USER_MAKE_VARS).
+  main: MAKEOVERRIDES :=
+
+  main: $(INIT_TARGETS) main-init
+        ifneq ($(SEQUENTIAL_TARGETS), )
+          # Don't touch build output dir since we might be cleaning. That means
+	  # no log wrapper.
+	  ( cd $(TOPDIR) && \
+	      $(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
+	      $(SEQUENTIAL_TARGETS) \
+	  )
+        endif
+        ifneq ($(PARALLEL_TARGETS), )
+	  $(call StartGlobalTimer)
+	  $(call PrepareSmartJavac)
+	  ( cd $(TOPDIR) && \
+	      $(BUILD_LOG_WRAPPER) $(MAKE) $(MAKE_ARGS) $(OUTPUT_SYNC_FLAG) \
+	      -j $(JOBS) -f make/Main.gmk $(USER_MAKE_VARS) \
+	      $(PARALLEL_TARGETS) \
+	  )
+	  $(call CleanupSmartJavac)
+	  $(call StopGlobalTimer)
+	  $(call ReportBuildTimes)
+        endif
+	$(BUILD_LOG_WRAPPER) $(PRINTF) "Finished building target(s) '$(strip \
+	    $(INIT_TARGETS) $(SEQUENTIAL_TARGETS) $(PARALLEL_TARGETS) \
+	    )' in configuration '$(CONF_NAME)'\n"
+
+  .PHONY: reconfigure main-init main
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/InitSupport.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,328 @@
+#
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# This file contains helper functions for Init.gmk.
+# It is divided in two parts, depending on if a SPEC is present or not
+# (HAS_SPEC is true or not).
+################################################################################
+
+ifndef _INITSUPPORT_GMK
+_INITSUPPORT_GMK := 1
+
+# Setup information about available configurations, if any.
+build_dir=$(topdir)/build
+all_spec_files=$(wildcard $(build_dir)/*/spec.gmk)
+# Extract the configuration names from the path
+all_confs=$(patsubst %/spec.gmk, %, $(patsubst $(build_dir)/%, %, $(all_spec_files)))
+any_spec_file=$(firstword $(all_spec_files))
+
+ifeq ($(HAS_SPEC),)
+  ##############################################################################
+  # Helper functions for the initial part of Init.gmk, before the spec file is
+  # loaded. Most of these functions provide parsing and setting up make options
+  # from the command-line.
+  ##############################################################################
+
+  # Make control variables, handled by Init.gmk
+  INIT_CONTROL_VARIABLES := LOG CONF SPEC JOBS CONF_CHECK
+
+  # All known make control variables
+  MAKE_CONTROL_VARIABLES := $(INIT_CONTROL_VARIABLES) TEST JDK_FILTER
+
+  # Define a simple reverse function.
+  # Should maybe move to MakeBase.gmk, but we can't include that file now.
+  reverse = \
+      $(if $(strip $(1)), $(call reverse, $(wordlist 2, $(words $(1)), $(1)))) \
+          $(firstword $(1))
+
+  # The variable MAKEOVERRIDES contains variable assignments from the command
+  # line, but in reverse order to what the user entered.
+  COMMAND_LINE_VARIABLES := $(subst \#,\ , $(call reverse, $(subst \ ,\#,$(MAKEOVERRIDES))))
+
+  # A list like FOO="val1" BAR="val2" containing all user-supplied make variables
+  # that we should propagate.
+  USER_MAKE_VARS := $(filter-out $(addsuffix =%, $(INIT_CONTROL_VARIABLES)), \
+      $(MAKEOVERRIDES))
+
+  # Check for unknown command-line variables
+  define CheckControlVariables
+    command_line_variables := $$(strip $$(foreach var, \
+        $$(subst \ ,_,$$(MAKEOVERRIDES)), \
+        $$(firstword $$(subst =, , $$(var)))))
+    unknown_command_line_variables := $$(strip $$(filter-out $$(MAKE_CONTROL_VARIABLES), $$(command_line_variables)))
+    ifneq ($$(unknown_command_line_variables), )
+      $$(info Note: Command line contains non-control variables:)
+      $$(foreach var, $$(unknown_command_line_variables), $$(info * $$(var)=$$($$(var))))
+      $$(info Make sure it is not mistyped, and that you intend to override this variable.)
+      $$(info 'make help' will list known control variables.)
+      $$(info )
+    endif
+  endef
+
+  # Check for deprecated ALT_ variables
+  define CheckDeprecatedEnvironment
+    defined_alt_variables := $$(filter ALT_%, $$(.VARIABLES))
+    ifneq ($$(defined_alt_variables), )
+      $$(info Warning: You have the following ALT_ variables set:)
+      $$(foreach var, $$(defined_alt_variables), $$(info * $$(var)=$$($$(var))))
+      $$(info ALT_ variables are deprecated, and may result in a failed build.)
+      $$(info Please clean your environment.)
+      $$(info )
+    endif
+  endef
+
+  # Check for invalid make flags like -j
+  define CheckInvalidMakeFlags
+    # This is a trick to get this rule to execute before any other rules
+    # MAKEFLAGS only indicate -j if read in a recipe (!)
+    $$(topdir)/make/Init.gmk: .FORCE
+	$$(if $$(findstring --jobserver, $$(MAKEFLAGS)), \
+	    $$(info Error: 'make -jN' is not supported, use 'make JOBS=N') \
+	    $$(error Cannot continue) \
+	)
+    .FORCE:
+    .PHONY: .FORCE
+  endef
+
+  # Check that the CONF_CHECK option is valid and set up handling
+  define ParseConfCheckOption
+    ifeq ($$(CONF_CHECK), )
+      # Default behavior is fail
+      CONF_CHECK := fail
+    else ifneq ($$(filter-out auto fail ignore, $$(CONF_CHECK)),)
+      $$(info Error: CONF_CHECK must be one of: auto, fail or ignore.)
+      $$(error Cannot continue)
+    endif
+  endef
+
+  define ParseLogLevel
+    # Catch old-style VERBOSE= command lines.
+    ifneq ($$(origin VERBOSE), undefined)
+      $$(info Error: VERBOSE is deprecated. Use LOG=<warn|info|debug|trace> instead.)
+      $$(error Cannot continue)
+    endif
+
+    # Setup logging according to LOG
+
+    # If the "nofile" argument is given, act on it and strip it away
+    ifneq ($$(findstring nofile, $$(LOG)),)
+      LOG_NOFILE := true
+      # COMMA is defined in spec.gmk, but that is not included yet
+      COMMA := ,
+      # First try to remove ",nofile" if it exists, otherwise just remove "nofile"
+      LOG_STRIPPED := $$(subst nofile,, $$(subst $$(COMMA)nofile,, $$(LOG)))
+      # We might have ended up with a leading comma. Remove it
+      LOG_LEVEL := $$(strip $$(patsubst $$(COMMA)%, %, $$(LOG_STRIPPED)))
+    else
+      LOG_LEVEL := $$(LOG)
+    endif
+
+    ifeq ($$(LOG_LEVEL),)
+      # Set LOG to "warn" as default if not set
+      LOG_LEVEL := warn
+    endif
+
+    ifeq ($$(LOG_LEVEL), warn)
+      MAKE_LOG_FLAGS := -s
+    else ifeq ($$(LOG_LEVEL), info)
+      MAKE_LOG_FLAGS := -s
+    else ifeq ($$(LOG_LEVEL), debug)
+      MAKE_LOG_FLAGS :=
+    else ifeq ($$(LOG_LEVEL), trace)
+      MAKE_LOG_FLAGS := -d
+    else
+      $$(info Error: LOG must be one of: warn, info, debug or trace.)
+      $$(error Cannot continue)
+    endif
+  endef
+
+  define ParseConfAndSpec
+    ifneq ($$(origin SPEC), undefined)
+      # We have been given a SPEC, check that it works out properly
+      ifneq ($$(origin CONF), undefined)
+        # We also have a CONF argument. We can't have both.
+        $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
+        $$(error Cannot continue)
+      endif
+      ifeq ($$(wildcard $$(SPEC)),)
+        $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).)
+        $$(error Cannot continue)
+      endif
+      ifeq ($$(filter /%, $$(SPEC)),)
+        # If given with relative path, make it absolute
+        SPECS := $$(CURDIR)/$$(strip $$(SPEC))
+      else
+        SPECS := $$(SPEC)
+      endif
+
+      # For now, unset this SPEC variable.
+      override SPEC :=
+    else
+      # Use spec.gmk files in the build output directory
+      ifeq ($$(any_spec_file),)
+        $$(info Error: No configurations found for $$(topdir).)
+        $$(info Please run 'bash configure' to create a configuration.)
+        $$(info )
+        $$(error Cannot continue)
+      endif
+
+      ifneq ($$(origin CONF), undefined)
+        # User have given a CONF= argument.
+        ifeq ($$(CONF),)
+          # If given CONF=, match all configurations
+          matching_confs := $$(strip $$(all_confs))
+        else
+          # Otherwise select those that contain the given CONF string
+          matching_confs := $$(strip $$(foreach var, $$(all_confs), $$(if $$(findstring $$(CONF), $$(var)), $$(var))))
+        endif
+        ifeq ($$(matching_confs),)
+          $$(info Error: No configurations found matching CONF=$$(CONF).)
+          $$(info Available configurations in $$(build_dir):)
+          $$(foreach var, $$(all_confs), $$(info * $$(var)))
+          $$(error Cannot continue)
+        else
+          ifeq ($$(words $$(matching_confs)), 1)
+            $$(info Building configuration '$$(matching_confs)' (matching CONF=$$(CONF)))
+          else
+            $$(info Building these configurations (matching CONF=$$(CONF)):)
+            $$(foreach var, $$(matching_confs), $$(info * $$(var)))
+          endif
+        endif
+
+        # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
+        SPECS := $$(addsuffix /spec.gmk, $$(addprefix $$(build_dir)/, $$(matching_confs)))
+      else
+        # No CONF or SPEC given, check the available configurations
+        ifneq ($$(words $$(all_spec_files)), 1)
+          $$(info Error: No CONF given, but more than one configuration found.)
+          $$(info Available configurations in $$(build_dir):)
+          $$(foreach var, $$(all_confs), $$(info * $$(var)))
+          $$(info Please retry building with CONF=<config pattern> (or SPEC=<spec file>).)
+          $$(info )
+          $$(error Cannot continue)
+        endif
+
+        # We found exactly one configuration, use it
+        SPECS := $$(strip $$(all_spec_files))
+      endif
+    endif
+  endef
+
+  define PrintConfCheckFailed
+	@echo ' '
+	@echo "Please rerun configure! Easiest way to do this is by running"
+	@echo "'make reconfigure'."
+	@echo "This behavior may also be changed using CONF_CHECK=<ignore|auto>."
+	@echo ' '
+  endef
+
+else # $(HAS_SPEC)=true
+  ##############################################################################
+  # Helper functions for the 'main' target. These functions assume a single,
+  # proper and existing SPEC is provided, and will load it.
+  ##############################################################################
+
+  include $(SPEC)
+  include $(SRC_ROOT)/make/common/MakeBase.gmk
+
+  # Define basic logging setup
+  BUILD_LOG := $(OUTPUT_ROOT)/build.log
+  BUILD_TRACE_LOG := $(OUTPUT_ROOT)/build-trace-time.log
+
+  BUILD_LOG_WRAPPER := $(BASH) $(SRC_ROOT)/common/bin/logger.sh $(BUILD_LOG)
+
+  # Disable the build log wrapper on sjavac+windows until
+  # we have solved how to prevent the log wrapper to wait
+  # for the background sjavac server process.
+  ifeq ($(ENABLE_SJAVAC)X$(OPENJDK_BUILD_OS),yesXwindows)
+    LOG_NOFILE := true
+  endif
+
+  # Sanity check the spec file, so it matches this source code
+  define CheckSpecSanity
+    ifneq ($$(topdir), $$(TOPDIR))
+      ifneq ($$(topdir), $$(ORIGINAL_TOPDIR))
+        ifneq ($$(topdir), $$(CANONICAL_TOPDIR))
+          $$(info Error: SPEC mismatch! Current working directory)
+          $$(info $$(topdir))
+          $$(info does not match either TOPDIR, ORIGINAL_TOPDIR or CANONICAL_TOPDIR)
+          $$(info $$(TOPDIR))
+          $$(info $$(ORIGINAL_TOPDIR))
+          $$(info $$(CANONICAL_TOPDIR))
+          $$(error Cannot continue)
+        endif
+      endif
+    endif
+  endef
+
+  define RotateLogFiles
+	$(RM) $(BUILD_LOG).old 2> /dev/null
+	$(MV) $(BUILD_LOG) $(BUILD_LOG).old 2> /dev/null || true
+	$(if $(findstring trace, $(LOG_LEVEL)), \
+	  $(RM) $(BUILD_TRACE_LOG).old 2> /dev/null && \
+	  $(MV) $(BUILD_TRACE_LOG) $(BUILD_TRACE_LOG).old 2> /dev/null || true \
+	)
+  endef
+
+  # Remove any javac server logs and port files. This
+  # prevents a new make run to reuse the previous servers.
+  define PrepareSmartJavac
+	$(if $(SJAVAC_SERVER_DIR), \
+	  $(RM) -r $(SJAVAC_SERVER_DIR) 2> /dev/null && \
+	  $(MKDIR) -p $(SJAVAC_SERVER_DIR) \
+	)
+  endef
+
+  define CleanupSmartJavac
+	[ -f $(SJAVAC_SERVER_DIR)/server.port ] && $(ECHO) Stopping sjavac server && \
+	    $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
+  endef
+
+  define StartGlobalTimer
+	$(RM) -r $(BUILDTIMESDIR) 2> /dev/null
+	$(MKDIR) -p $(BUILDTIMESDIR)
+	$(call RecordStartTime,TOTAL)
+  endef
+
+  define StopGlobalTimer
+	$(call RecordEndTime,TOTAL)
+  endef
+
+  # Find all build_time_* files and print their contents in a list sorted
+  # on the name of the sub repository.
+  define ReportBuildTimes
+	$(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) -- \
+	    "----- Build times -------\nStart %s\nEnd   %s\n%s\n%s\n-------------------------\n" \
+	    "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
+	    "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
+	    "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | \
+	    $(XARGS) $(CAT) | $(SORT) -k 2`" \
+	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
+  endef
+
+endif # HAS_SPEC
+
+endif # _INITSUPPORT_GMK
--- a/make/Jprt.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/make/Jprt.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -130,7 +130,4 @@
         endif
 	@$(call TargetExit)
 
-
-###########################################################################
-# Phony targets
-.PHONY: jprt_bundle bundles final-images
+ALL_TARGETS += jprt_bundle bundles final-images
--- a/make/Main.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/make/Main.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -26,14 +26,19 @@
 ################################################################################
 # This is the main makefile containing most actual top level targets. It needs
 # to be called with a SPEC file defined.
+################################################################################
 
 # Declare default target
 default:
 
+ifeq ($(wildcard $(SPEC)),)
+  $(error Main.gmk needs SPEC set to a proper spec.gmk)
+endif
+
 # Now load the spec
 include $(SPEC)
 
-include $(SRC_ROOT)/make/MakeHelpers.gmk
+include $(SRC_ROOT)/make/MainSupport.gmk
 
 # Load the vital tools for all the makefiles.
 include $(SRC_ROOT)/make/common/MakeBase.gmk
@@ -215,7 +220,8 @@
 BOOTCYCLE_TARGET := product-images
 bootcycle-images:
 	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
-	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
+	+$(MAKE) $(MAKE_ARGS) -f $(SRC_ROOT)/make/Main.gmk \
+	    SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
 
 zip-security:
 	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
@@ -589,42 +595,29 @@
     $(CLEAN_PHASE_TARGETS) $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
 
 ################################################################################
-
-# Setup a rule for SPEC file that fails if executed. This check makes sure the
-# configuration is up to date after changes to configure.
-ifeq ($(findstring reconfigure, $(MAKECMDGOALS)), )
-  $(SPEC): $(wildcard $(SRC_ROOT)/common/autoconf/*)
-	@$(ECHO) "ERROR: $(SPEC) is not up to date."
-	@$(ECHO) "Please rerun configure! Easiest way to do this is by running"
-	@$(ECHO) "'make reconfigure'."
-	@$(ECHO) "It may also be ignored by setting IGNORE_OLD_CONFIG=true"
-	@if test "x$(IGNORE_OLD_CONFIG)" != "xtrue"; then exit 1; fi
-endif
-
-# The reconfigure target is automatically run serially from everything else
-# by the Makefile calling this file.
-
-reconfigure:
-        ifneq ($(CONFIGURE_COMMAND_LINE), )
-	  @$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
-        else
-	  @$(ECHO) "Re-running configure using default settings"
-        endif
-	@( cd $(OUTPUT_ROOT) && PATH="$(ORIGINAL_PATH)" \
-	    $(BASH) $(TOPDIR)/configure $(CONFIGURE_COMMAND_LINE) )
-
-ALL_TARGETS += reconfigure
-
-################################################################################
 # Declare *-only targets for each normal target
 $(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
 
-ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS)))
+ALL_TARGETS += $(addsuffix -only, $(filter-out dist-clean clean%, $(ALL_TARGETS)))
+
+################################################################################
+
+# Include JPRT targets
+include $(SRC_ROOT)/make/Jprt.gmk
+
+################################################################################
+
+print-targets:
+	  @$(ECHO) $(sort $(ALL_TARGETS))
+
+print-modules:
+	  @$(ECHO) $(sort $(ALL_MODULES))
+
+# print-* targets intentionally not added to ALL_TARGETS since they are internal only.
+# The corresponding external targets are in Help.gmk
 
 ################################################################################
 
 .PHONY: $(ALL_TARGETS)
 
-include $(SRC_ROOT)/make/Jprt.gmk
-
 FRC: # Force target
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/make/MainSupport.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,186 @@
+#
+# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# This file contains helper functions for Main.gmk.
+################################################################################
+
+ifndef _MAINSUPPORT_GMK
+_MAINSUPPORT_GMK := 1
+
+# Run the tests specified by $1.
+define RunTests
+	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
+	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \
+	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
+	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true
+endef
+
+# Cleans the dir given as $1
+define CleanDir
+	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
+	@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
+	@$(PRINTF) " done\n"
+endef
+
+define CleanTest
+	@$(PRINTF) "Cleaning test $(strip $1) ..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-gensrc
+	@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-java
+	@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
+	@$(PRINTF) " done\n"
+	@$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-native
+	@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-include
+	@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define CleanModule
+  $(call Clean-gensrc, $1)
+  $(call Clean-java, $1)
+  $(call Clean-native, $1)
+  $(call Clean-include, $1)
+endef
+
+
+################################################################################
+
+MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR)
+MAKE_MAKEDIR_LIST := make
+
+# Helper macro for DeclareRecipesForPhase
+# Declare a recipe for calling the module and phase specific makefile.
+# If there are multiple makefiles to call, create a rule for each topdir
+# that contains a makefile with the target $module-$suffix-$repodir,
+# (i.e: java.base-gensrc-jdk)
+# Normally there is only one makefile, and the target will just be
+# $module-$suffix
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+# Param 3: Topdir
+define DeclareRecipeForModuleMakefile
+  ifeq ($$($1_MULTIPLE_MAKEFILES), true)
+    $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
+    $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
+
+    $2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
+  else
+    $2-$$($1_TARGET_SUFFIX):
+  endif
+	$(ECHO) $(LOG_INFO) "Building $$@"
+        ifeq ($$($1_USE_WRAPPER), true)
+	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
+	      -f ModuleWrapper.gmk \
+	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+	          MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
+        else
+	  +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
+	          $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
+	    && $(MAKE) $(MAKE_ARGS) \
+	          -f $$($1_FILE_PREFIX)-$2.gmk \
+	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+	          MODULE=$2)
+        endif
+
+endef
+
+# Helper macro for DeclareRecipesForPhase
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+define DeclareRecipesForPhaseAndModule
+  $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
+      $$(patsubst $$d/%, $$d, $$(filter $$d/%, \
+          $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
+          $$(foreach s, $(MAKE_MAKEDIR_LIST), \
+              $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
+
+  # Only declare recipes if there are makefiles to call
+  ifneq ($$($1_$2_TOPDIRS), )
+    ifeq ($(NO_RECIPES),)
+      $$(foreach d, $$($1_$2_TOPDIRS), \
+          $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
+    endif
+    $1 += $2-$$($1_TARGET_SUFFIX)
+    $1_MODULES += $2
+  endif
+endef
+
+# Declare recipes for a specific module and build phase if there are makefiles
+# present for the specific combination.
+# Param 1: Name of list to add targets to
+# Named params:
+# TARGET_SUFFIX : Suffix of target to create for recipe
+# MAKE_SUBDIR : Subdir for this build phase
+# FILE_PREFIX : File prefix for this build phase
+# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
+# CHECK_MODULES : List of modules to try
+# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in
+#                      phase in multiple repos
+# Exported variables:
+# $1_MODULES : All modules that had rules generated
+# $1_TARGETS : All targets generated
+define DeclareRecipesForPhase
+  $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
+  $(if $(8),$(error Internal makefile error: Too many arguments to \
+      DeclareRecipesForPhase, please update MakeHelper.gmk))
+
+  $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
+      $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
+
+  $(strip $1)_TARGETS := $$($(strip $1))
+endef
+
+################################################################################
+
+endif # _MAINSUPPORT_GMK
--- a/make/MakeHelpers.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,451 +0,0 @@
-#
-# Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-################################################################
-#
-# This file contains helper functions for the top-level Makefile that does
-# not depend on the spec.gmk file having been read. (The purpose of this
-# file is ju to avoid cluttering the top-level Makefile.)
-#
-################################################################
-
-ifndef _MAKEHELPERS_GMK
-_MAKEHELPERS_GMK := 1
-
-##############################
-# Stuff to run at include time
-##############################
-
-# Find out which variables were passed explicitely on the make command line. These
-# will be passed on to sub-makes, overriding spec.gmk settings.
-MAKE_ARGS=$(foreach var,$(subst =command,,$(filter %=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))),$(var)="$($(var))")
-
-list_alt_overrides_with_origins=$(filter ALT_%=environment ALT_%=command,$(foreach var,$(.VARIABLES),$(var)=$(firstword $(origin $(var)))))
-list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
-
-# Store the build times in this directory.
-BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
-
-# Global targets are possible to run either with or without a SPEC. The prototypical
-# global target is "help".
-global_targets=help
-
-##############################
-# Functions
-##############################
-
-define CheckEnvironment
-        # Find all environment or command line variables that begin with ALT.
-	$(if $(list_alt_overrides),
-	  @$(PRINTF) "\nWARNING: You have the following ALT_ variables set:\n"
-	  @$(PRINTF) "$(foreach var,$(list_alt_overrides),$(var)=$$$(var))\n"
-	  @$(PRINTF) "ALT_ variables are deprecated and will be ignored. Please clean your environment.\n\n"
-	)
-endef
-
-### Functions for timers
-
-# Record starting time for build of a sub repository.
-define RecordStartTime
-	$(MKDIR) -p $(BUILDTIMESDIR)
-	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$1
-	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$1_human_readable
-endef
-
-# Record ending time and calculate the difference and store it in a
-# easy to read format. Handles builds that cross midnight. Expects
-# that a build will never take 24 hours or more.
-define RecordEndTime
-	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$1
-	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$1_human_readable
-	$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$1` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$1` $1 | \
-	    $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
-	    M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
-	    > $(BUILDTIMESDIR)/build_time_diff_$1
-endef
-
-# Find all build_time_* files and print their contents in a list sorted
-# on the name of the sub repository.
-define ReportBuildTimes
-	$(BUILD_LOG_WRAPPER) $(PRINTF) -- "----- Build times -------\nStart %s\nEnd   %s\n%s\n%s\n-------------------------\n" \
-	    "`$(CAT) $(BUILDTIMESDIR)/build_time_start_TOTAL_human_readable`" \
-	    "`$(CAT) $(BUILDTIMESDIR)/build_time_end_TOTAL_human_readable`" \
-	    "`$(LS) $(BUILDTIMESDIR)/build_time_diff_* | $(GREP) -v _TOTAL | $(XARGS) $(CAT) | $(SORT) -k 2`" \
-	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_TOTAL`"
-endef
-
-define ResetAllTimers
-  $$(shell $(MKDIR) -p $(BUILDTIMESDIR) && $(RM) $(BUILDTIMESDIR)/build_time_*)
-endef
-
-define StartGlobalTimer
-	$(call RecordStartTime,TOTAL)
-endef
-
-define StopGlobalTimer
-	$(call RecordEndTime,TOTAL)
-endef
-
-### Functions for managing makefile structure (start/end of makefile and individual targets)
-
-# Do not indent this function, this will add whitespace at the start which the caller won't handle
-define GetRealTarget
-$(strip $(if $(findstring main-wrapper, $(MAKECMDGOALS)), $(MAIN_TARGETS), \
-    $(if $(MAKECMDGOALS),$(MAKECMDGOALS),default)))
-endef
-
-# Do not indent this function, this will add whitespace at the start which the caller won't handle
-define LastGoal
-$(strip $(lastword $(call GetRealTarget)))
-endef
-
-# Check if the current target is the final target, as specified by
-# the user on the command line. If so, call AtRootMakeEnd.
-define CheckIfMakeAtEnd
-        # Check if the current target is the last goal
-	$(if $(filter $@,$(call LastGoal)),$(call AtMakeEnd))
-        # If the target is 'foo-only', check if our goal was stated as 'foo'
-	$(if $(filter $@,$(call LastGoal)-only),$(call AtMakeEnd))
-endef
-
-# Hook to be called when starting to execute a top-level target
-define TargetEnter
-	$(PRINTF) "## Starting $(patsubst %-only,%,$@)\n"
-	$(call RecordStartTime,$(patsubst %-only,%,$@))
-endef
-
-# Hook to be called when finish executing a top-level target
-define TargetExit
-	$(call RecordEndTime,$(patsubst %-only,%,$@))
-	$(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
-	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`"
-endef
-
-# Hook to be called as the very first thing when running a normal build
-define AtMakeStart
-	$(if $(findstring --jobserver,$(MAKEFLAGS)),$(error make -j is not supported, use make JOBS=n))
-	$(call CheckEnvironment)
-	$(BUILD_LOG_WRAPPER) $(PRINTF) $(LOG_INFO) "Running make as '$(MAKE) $(MFLAGS) $(MAKE_ARGS)'\n"
-	$(BUILD_LOG_WRAPPER) $(PRINTF) "Building $(PRODUCT_NAME) for target '$(call GetRealTarget)' in configuration '$(CONF_NAME)'\n\n"
-	$(call StartGlobalTimer)
-endef
-
-# Hook to be called as the very last thing for targets that are "top level" targets
-define AtMakeEnd
-	[ -f $(SJAVAC_SERVER_DIR)/server.port ] && echo Stopping sjavac server && $(TOUCH) $(SJAVAC_SERVER_DIR)/server.port.stop; true
-	$(call StopGlobalTimer)
-	$(call ReportBuildTimes)
-	@$(PRINTF) "\nFinished building $(PRODUCT_NAME) for target '$(call GetRealTarget)'\n"
-	$(call CheckEnvironment)
-endef
-
-### Functions for parsing and setting up make options from command-line
-
-define FatalError
-  # If the user specificed a "global" target (e.g. 'help'), do not exit but continue running
-  $$(if $$(filter-out $(global_targets),$$(call GetRealTarget)),$$(error Cannot continue))
-endef
-
-define ParseLogLevel
-  ifeq ($$(origin VERBOSE),undefined)
-    # Setup logging according to LOG (but only if VERBOSE is not given)
-
-    # If the "nofile" argument is given, act on it and strip it away
-    ifneq ($$(findstring nofile,$$(LOG)),)
-      # Reset the build log wrapper, regardless of other values
-      override BUILD_LOG_WRAPPER=
-      # COMMA is defined in spec.gmk, but that is not included yet
-      COMMA=,
-      # First try to remove ",nofile" if it exists
-      LOG_STRIPPED1=$$(subst $$(COMMA)nofile,,$$(LOG))
-      # Otherwise just remove "nofile"
-      LOG_STRIPPED2=$$(subst nofile,,$$(LOG_STRIPPED1))
-      # We might have ended up with a leading comma. Remove it
-      LOG_STRIPPED3=$$(strip $$(patsubst $$(COMMA)%,%,$$(LOG_STRIPPED2)))
-      LOG_LEVEL:=$$(LOG_STRIPPED3)
-    else
-      LOG_LEVEL:=$$(LOG)
-    endif
-
-    ifeq ($$(LOG_LEVEL),)
-      # Set LOG to "warn" as default if not set (and no VERBOSE given)
-      override LOG_LEVEL=warn
-    endif
-    ifeq ($$(LOG_LEVEL),warn)
-      VERBOSE=-s
-    else ifeq ($$(LOG_LEVEL),info)
-      VERBOSE=-s
-    else ifeq ($$(LOG_LEVEL),debug)
-      VERBOSE=
-    else ifeq ($$(LOG_LEVEL),trace)
-      VERBOSE=
-    else
-      $$(info Error: LOG must be one of: warn, info, debug or trace.)
-      $$(eval $$(call FatalError))
-    endif
-  else
-    # Provide resonable interpretations of LOG_LEVEL if VERBOSE is given.
-    ifeq ($(VERBOSE),)
-      LOG_LEVEL:=debug
-    else
-      LOG_LEVEL:=warn
-    endif
-    ifneq ($$(LOG),)
-      # We have both a VERBOSE and a LOG argument. This is OK only if this is a repeated call by ourselves,
-      # but complain if this is the top-level make call.
-      ifeq ($$(MAKELEVEL),0)
-        $$(info Cannot use LOG=$$(LOG) and VERBOSE=$$(VERBOSE) at the same time. Choose one.)
-        $$(eval $$(call FatalError))
-      endif
-    endif
-  endif
-endef
-
-define ParseConfAndSpec
-  ifneq ($$(filter-out $(global_targets),$$(call GetRealTarget)),)
-    # If we only have global targets, no need to bother with SPEC or CONF
-    ifneq ($$(origin SPEC),undefined)
-      # We have been given a SPEC, check that it works out properly
-      ifneq ($$(origin CONF),undefined)
-        # We also have a CONF argument. This is OK only if this is a repeated call by ourselves,
-        # but complain if this is the top-level make call.
-        ifeq ($$(MAKELEVEL),0)
-          $$(info Error: Cannot use CONF=$$(CONF) and SPEC=$$(SPEC) at the same time. Choose one.)
-          $$(eval $$(call FatalError))
-        endif
-      endif
-      ifeq ($$(wildcard $$(SPEC)),)
-        $$(info Error: Cannot locate spec.gmk, given by SPEC=$$(SPEC).)
-        $$(eval $$(call FatalError))
-      endif
-      # ... OK, we're satisfied, we'll use this SPEC later on
-    else
-      # Find all spec.gmk files in the build output directory
-      output_dir=$$(root_dir)/build
-      all_spec_files=$$(wildcard $$(output_dir)/*/spec.gmk)
-      ifeq ($$(all_spec_files),)
-        $$(info Error: No configurations found for $$(root_dir).)
-        $$(info Please run 'bash configure' to create a configuration.)
-        $$(eval $$(call FatalError))
-      endif
-      # Extract the configuration names from the path
-      all_confs=$$(patsubst %/spec.gmk,%,$$(patsubst $$(output_dir)/%,%,$$(all_spec_files)))
-
-      ifneq ($$(origin CONF),undefined)
-        # User have given a CONF= argument.
-        ifeq ($$(CONF),)
-          # If given CONF=, match all configurations
-          matching_confs=$$(strip $$(all_confs))
-        else
-          # Otherwise select those that contain the given CONF string
-          matching_confs=$$(strip $$(foreach var,$$(all_confs),$$(if $$(findstring $$(CONF),$$(var)),$$(var))))
-        endif
-        ifeq ($$(matching_confs),)
-          $$(info Error: No configurations found matching CONF=$$(CONF).)
-          $$(info Available configurations in $$(output_dir):)
-          $$(foreach var,$$(all_confs),$$(info * $$(var)))
-          $$(eval $$(call FatalError))
-        else
-          ifeq ($$(words $$(matching_confs)),1)
-            $$(info Building '$$(matching_confs)' (matching CONF=$$(CONF)))
-          else
-            $$(info Building target '$(call GetRealTarget)' in these configurations (matching CONF=$$(CONF)):)
-            $$(foreach var,$$(matching_confs),$$(info * $$(var)))
-          endif
-        endif
-
-        # Create a SPEC definition. This will contain the path to one or more spec.gmk files.
-        SPEC=$$(addsuffix /spec.gmk,$$(addprefix $$(output_dir)/,$$(matching_confs)))
-      else
-        # No CONF or SPEC given, check the available configurations
-        ifneq ($$(words $$(all_spec_files)),1)
-          $$(info Error: No CONF given, but more than one configuration found.)
-          $$(info Available configurations in $$(output_dir):)
-          $$(foreach var,$$(all_confs),$$(info * $$(var)))
-          $$(info Please retry building with CONF=<config pattern> (or SPEC=<specfile>).)
-          $$(eval $$(call FatalError))
-        endif
-
-        # We found exactly one configuration, use it
-        SPEC=$$(strip $$(all_spec_files))
-      endif
-    endif
-  endif
-endef
-
-### Convenience functions from Main.gmk
-
-# Run the tests specified by $1.
-define RunTests
-	($(CD) $(SRC_ROOT)/test && $(MAKE) $(MAKE_ARGS) -j1 -k MAKEFLAGS= \
-	    JT_HOME=$(JT_HOME) PRODUCT_HOME=$(JDK_IMAGE_DIR) \
-	    TEST_IMAGE_DIR=$(TEST_IMAGE_DIR) \
-	    ALT_OUTPUTDIR=$(OUTPUT_ROOT) CONCURRENCY=$(JOBS) $1) || true
-endef
-
-# Cleans the dir given as $1
-define CleanDir
-	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
-	@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
-	@$(PRINTF) " done\n"
-endef
-
-define CleanTest
-	@$(PRINTF) "Cleaning test $(strip $1) ..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/test/$(strip $(subst -,/,$1))
-	@$(PRINTF) " done\n"
-endef
-
-define Clean-gensrc
-	@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
-	@$(PRINTF) " done\n"
-endef
-
-define Clean-java
-	@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
-	@$(PRINTF) " done\n"
-	@$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
-	@$(PRINTF) " done\n"
-endef
-
-define Clean-native
-	@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
-	@$(PRINTF) " done\n"
-endef
-
-define Clean-include
-	@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
-	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
-	@$(PRINTF) " done\n"
-endef
-
-define CleanModule
-  $(call Clean-gensrc, $1)
-  $(call Clean-java, $1)
-  $(call Clean-native, $1)
-  $(call Clean-include, $1)
-endef
-
-
-################################################################################
-
-MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR)
-MAKE_MAKEDIR_LIST := make
-
-# Helper macro for DeclareRecipesForPhase
-# Declare a recipe for calling the module and phase specific makefile.
-# If there are multiple makefiles to call, create a rule for each topdir
-# that contains a makefile with the target $module-$suffix-$repodir,
-# (i.e: java.base-gensrc-jdk)
-# Normally there is only one makefile, and the target will just be
-# $module-$suffix
-# Param 1: Name of list to add targets to
-# Param 2: Module name
-# Param 3: Topdir
-define DeclareRecipeForModuleMakefile
-  ifeq ($$($1_MULTIPLE_MAKEFILES), true)
-    $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
-    $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
-
-    $2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
-  else
-    $2-$$($1_TARGET_SUFFIX):
-  endif
-	$(ECHO) $(LOG_INFO) "Building $$@"
-        ifeq ($$($1_USE_WRAPPER), true)
-	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
-	      -f ModuleWrapper.gmk \
-	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
-	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
-	          MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
-        else
-	  +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
-	          $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
-	    && $(MAKE) $(MAKE_ARGS) \
-	          -f $$($1_FILE_PREFIX)-$2.gmk \
-	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
-	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
-	          MODULE=$2)
-        endif
-
-endef
-
-# Helper macro for DeclareRecipesForPhase
-# Param 1: Name of list to add targets to
-# Param 2: Module name
-define DeclareRecipesForPhaseAndModule
-  $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
-      $$(patsubst $$d/%, $$d, $$(filter $$d/%, \
-          $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
-          $$(foreach s, $(MAKE_MAKEDIR_LIST), \
-              $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
-
-  # Only declare recipes if there are makefiles to call
-  ifneq ($$($1_$2_TOPDIRS), )
-    $$(foreach d, $$($1_$2_TOPDIRS), \
-        $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
-    $1 += $2-$$($1_TARGET_SUFFIX)
-    $1_MODULES += $2
-  endif
-endef
-
-# Declare recipes for a specific module and build phase if there are makefiles
-# present for the specific combination.
-# Param 1: Name of list to add targets to
-# Named params:
-# TARGET_SUFFIX : Suffix of target to create for recipe
-# MAKE_SUBDIR : Subdir for this build phase
-# FILE_PREFIX : File prefix for this build phase
-# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
-# CHECK_MODULES : List of modules to try
-# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in
-#                      phase in multiple repos
-# Exported variables:
-# $1_MODULES : All modules that had rules generated
-# $1_TARGETS : All targets generated
-define DeclareRecipesForPhase
-  $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
-  $(if $(8),$(error Internal makefile error: Too many arguments to \
-      DeclareRecipesForPhase, please update MakeHelper.gmk))
-
-  $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
-      $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
-
-  $(strip $1)_TARGETS := $$($(strip $1))
-endef
-
-################################################################################
-
-endif # _MAKEHELPERS_GMK
--- a/make/common/MakeBase.gmk	Wed Apr 08 13:12:48 2015 -0700
+++ b/make/common/MakeBase.gmk	Wed Jul 05 20:27:20 2017 +0200
@@ -32,6 +32,53 @@
 ifndef _MAKEBASE_GMK
 _MAKEBASE_GMK := 1
 
+ifeq ($(wildcard $(SPEC)),)
+  $(error MakeBase.gmk needs SPEC set to a proper spec.gmk)
+endif
+
+
+##############################
+# Functions
+##############################
+
+
+### Functions for timers
+
+# Store the build times in this directory.
+BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
+
+# Record starting time for build of a sub repository.
+define RecordStartTime
+	$(MKDIR) -p $(BUILDTIMESDIR)
+	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)
+	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_start_$(strip $1)_human_readable
+endef
+
+# Record ending time and calculate the difference and store it in a
+# easy to read format. Handles builds that cross midnight. Expects
+# that a build will never take 24 hours or more.
+define RecordEndTime
+	$(DATE) '+%Y %m %d %H %M %S' | $(NAWK) '{ print $$1,$$2,$$3,$$4,$$5,$$6,($$4*3600+$$5*60+$$6) }' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)
+	$(DATE) '+%Y-%m-%d %H:%M:%S' > $(BUILDTIMESDIR)/build_time_end_$(strip $1)_human_readable
+	$(ECHO) `$(CAT) $(BUILDTIMESDIR)/build_time_start_$(strip $1)` `$(CAT) $(BUILDTIMESDIR)/build_time_end_$(strip $1)` $1 | \
+	    $(NAWK) '{ F=$$7; T=$$14; if (F > T) { T+=3600*24 }; D=T-F; H=int(D/3600); \
+	    M=int((D-H*3600)/60); S=D-H*3600-M*60; printf("%02d:%02d:%02d %s\n",H,M,S,$$15); }' \
+	    > $(BUILDTIMESDIR)/build_time_diff_$(strip $1)
+endef
+
+# Hook to be called when starting to execute a top-level target
+define TargetEnter
+	$(PRINTF) "## Starting $(patsubst %-only,%,$@)\n"
+	$(call RecordStartTime,$(patsubst %-only,%,$@))
+endef
+
+# Hook to be called when finish executing a top-level target
+define TargetExit
+	$(call RecordEndTime,$(patsubst %-only,%,$@))
+	$(PRINTF) "## Finished $(patsubst %-only,%,$@) (build time %s)\n\n" \
+	    "`$(CAT) $(BUILDTIMESDIR)/build_time_diff_$(patsubst %-only,%,$@) | $(CUT) -f 1 -d ' '`"
+endef
+
 ################################################################################
 # This macro translates $ into \$ to protect the $ from expansion in the shell.
 # To make this macro resilient against already escaped strings, first remove
@@ -341,7 +388,7 @@
 endef
 
 define SetupLogging
-  ifeq ($$(LOG_LEVEL),trace)
+  ifeq ($$(LOG_LEVEL), trace)
     # Shell redefinition trick inspired by http://www.cmcrossroads.com/ask-mr-make/6535-tracing-rule-execution-in-gnu-make
     # For each target executed, will print
     # Building <TARGET> (from <FIRST PREREQUISITE>) (<ALL NEWER PREREQUISITES> newer)
@@ -349,25 +396,25 @@
     # (and causing a crash on Cygwin).
     # Default shell seems to always be /bin/sh. Must override with bash to get this to work on Solaris.
     # Only use time if it's GNU time which supports format and output file.
-    WRAPPER_SHELL:=$$(BASH) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(SHELL)
-    SHELL=$$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
+    WRAPPER_SHELL := $$(BASH) $$(SRC_ROOT)/common/bin/shell-tracer.sh $$(if $$(findstring yes,$$(IS_GNU_TIME)),$$(TIME),-) $$(OUTPUT_ROOT)/build-trace-time.log $$(SHELL)
+    SHELL := $$(warning $$(if $$@,Building $$@,Running shell command) $$(if $$<, (from $$<))$$(if $$?, ($$(wordlist 1, 20, $$?) $$(if $$(wordlist 21, 22, $$?), ... [in total $$(words $$?) files]) newer)))$$(WRAPPER_SHELL)
   endif
   # Never remove warning messages; this is just for completeness
-  LOG_WARN=
-  ifneq ($$(findstring $$(LOG_LEVEL),info debug trace),)
-    LOG_INFO=
+  LOG_WARN :=
+  ifneq ($$(findstring $$(LOG_LEVEL), info debug trace),)
+    LOG_INFO :=
   else
-    LOG_INFO=> /dev/null
+    LOG_INFO := > /dev/null
   endif
-  ifneq ($$(findstring $$(LOG_LEVEL),debug trace),)
-    LOG_DEBUG=
+  ifneq ($$(findstring $$(LOG_LEVEL), debug trace),)
+    LOG_DEBUG :=
   else
-    LOG_DEBUG=> /dev/null
+    LOG_DEBUG := > /dev/null
   endif
-  ifneq ($$(findstring $$(LOG_LEVEL),trace),)
-    LOG_TRACE=
+  ifneq ($$(findstring $$(LOG_LEVEL), trace),)
+    LOG_TRACE :=
   else
-    LOG_TRACE=> /dev/null
+    LOG_TRACE := > /dev/null
   endif
 endef
 
--- a/nashorn/.hgtags	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/.hgtags	Wed Jul 05 20:27:20 2017 +0200
@@ -291,3 +291,4 @@
 b2b332e64b7b2e06e25bccae9c0c0b585a03b4b5 jdk9-b55
 2e640036000dfadcadaf6638b5fd61db9c71a25c jdk9-b56
 3bcfcb13c23402cf435079766eb2f9a3c4f890e8 jdk9-b57
+5096a7cca5f0fda814832ac777966bea893f837e jdk9-b58
--- a/nashorn/make/Makefile	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  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.
-#
-
-# Locate this Makefile
-ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), )
-  makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST))
-else
-  makefile_path := $(lastword $(MAKEFILE_LIST))
-endif
-repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path))
-
-# What is the name of this subsystem (langtools, corba, etc)?
-subsystem_name := $(notdir $(repo_dir))
-
-# Try to locate top-level makefile
-top_level_makefile := $(repo_dir)/../Makefile
-ifneq ($(wildcard $(top_level_makefile)), )
-  $(info Will run $(subsystem_name) target on top-level Makefile)
-  $(info WARNING: This is a non-recommended way of building!)
-  $(info ===================================================)
-else
-  $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?)
-  $(error Build from top-level Makefile instead)
-endif
-
-all:
-	@$(MAKE) -f $(top_level_makefile) $(subsystem_name)
--- a/nashorn/make/build.xml	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/make/build.xml	Wed Jul 05 20:27:20 2017 +0200
@@ -281,12 +281,12 @@
        <fileset dir="${test.src.dir}/META-INF/services/"/>
     </copy>
 
-    <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/resources">
-       <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/resources"/>
+    <copy todir="${build.test.classes.dir}/jdk/nashorn/internal/runtime/test/resources">
+       <fileset dir="${test.src.dir}/jdk/nashorn/internal/runtime/test/resources"/>
     </copy>
 
-    <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/resources">
-       <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/resources"/>
+    <copy todir="${build.test.classes.dir}/jdk/nashorn/api/scripting/test/resources">
+       <fileset dir="${test.src.dir}/jdk/nashorn/api/scripting/test/resources"/>
     </copy>
 
     <!-- tests that check nashorn internals and internal API -->
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java	Wed Jul 05 20:27:20 2017 +0200
@@ -60,6 +60,7 @@
 import jdk.nashorn.internal.objects.annotations.Setter;
 import jdk.nashorn.internal.runtime.Context;
 import jdk.nashorn.internal.runtime.ECMAErrors;
+import jdk.nashorn.internal.runtime.FindProperty;
 import jdk.nashorn.internal.runtime.GlobalConstants;
 import jdk.nashorn.internal.runtime.GlobalFunctions;
 import jdk.nashorn.internal.runtime.JSType;
@@ -2204,6 +2205,17 @@
     }
 
     @Override
+    protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
+        if (lexicalScope != null && start != this && start.isScope()) {
+            final FindProperty find = lexicalScope.findProperty(key, false);
+            if (find != null) {
+                return find;
+            }
+        }
+        return super.findProperty(key, deep, start);
+    }
+
+    @Override
     public GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) {
         final boolean isScope = NashornCallSiteDescriptor.isScope(desc);
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -114,12 +114,11 @@
 
         private void setElem(final int index, final double elem) {
             try {
-                nb.put(index, (float)elem);
+                if (index < nb.limit()) {
+                    nb.put(index, (float) elem);
+                }
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -114,12 +114,11 @@
 
         private void setElem(final int index, final double elem) {
             try {
-                nb.put(index, elem);
+                if (index < nb.limit()) {
+                    nb.put(index, elem);
+                }
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
              }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -115,12 +115,11 @@
 
         private void setElem(final int index, final int elem) {
             try {
-                nb.put(index, (short)elem);
+                if (index < nb.limit()) {
+                    nb.put(index, (short) elem);
+                }
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -104,11 +104,11 @@
 
         private void setElem(final int index, final int elem) {
             try {
-                nb.put(index, elem);
-               } catch (final IndexOutOfBoundsException e) {
-                   if (index < 0) {
-                      throw new ClassCastException();
-                 }
+                if (index < nb.limit()) {
+                    nb.put(index, elem);
+                }
+            } catch (final IndexOutOfBoundsException e) {
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -113,12 +113,11 @@
 
         private void setElem(final int index, final int elem) {
             try {
-                nb.put(index, (byte)elem);
+                if (index < nb.limit()) {
+                    nb.put(index, (byte) elem);
+                }
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -104,12 +104,11 @@
 
         private void setElem(final int index, final int elem) {
             try {
-                nb.put(index, (char)elem);
+                if (index < nb.limit()) {
+                    nb.put(index, (char) elem);
+                }
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -113,12 +113,11 @@
 
         private void setElem(final int index, final int elem) {
             try {
-                nb.put(index, elem);
+                if (index < nb.limit()) {
+                    nb.put(index, elem);
+                }
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java	Wed Jul 05 20:27:20 2017 +0200
@@ -104,12 +104,11 @@
 
         private void setElem(final int index, final int elem) {
             try {
-                nb.put(index, (byte)elem);
+                if (index < nb.limit()) {
+                    nb.put(index, (byte) elem);
+                }
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java	Wed Jul 05 20:27:20 2017 +0200
@@ -133,18 +133,17 @@
 
         private void setElem(final int index, final int elem) {
             try {
-                final byte clamped;
-                if ((elem & 0xffff_ff00) == 0) {
-                    clamped = (byte)elem;
-                } else {
-                    clamped = elem < 0 ? 0 : (byte)0xff;
+                if (index < nb.limit()) {
+                    final byte clamped;
+                    if ((elem & 0xffff_ff00) == 0) {
+                        clamped = (byte) elem;
+                    } else {
+                        clamped = elem < 0 ? 0 : (byte) 0xff;
+                    }
+                    nb.put(index, clamped);
                 }
-                nb.put(index, clamped);
             } catch (final IndexOutOfBoundsException e) {
-                //swallow valid array indexes. it's ok.
-                if (index < 0) {
-                    throw new ClassCastException();
-                }
+                throw new ClassCastException();
             }
         }
 
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java	Wed Jul 05 20:27:20 2017 +0200
@@ -812,7 +812,7 @@
      *
      * @return FindPropertyData or null if not found.
      */
-    FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
+    protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
 
         final PropertyMap selfMap  = getMap();
         final Property    property = selfMap.findProperty(key);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java	Wed Jul 05 20:27:20 2017 +0200
@@ -198,7 +198,7 @@
      * @return FindPropertyData or null if not found.
      */
     @Override
-    FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
+    protected FindProperty findProperty(final String key, final boolean deep, final ScriptObject start) {
         // We call findProperty on 'expression' with 'expression' itself as start parameter.
         // This way in ScriptObject.setObject we can tell the property is from a 'with' expression
         // (as opposed from another non-scope object in the proto chain such as Object.prototype).
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ArrayCompiler.java	Wed Jul 05 20:27:20 2017 +0200
@@ -145,9 +145,6 @@
             case TargetInfo.IS_EMPTY_MEM:
                 addOpcode(OPCode.NULL_CHECK_END_MEMST);
                 break;
-            case TargetInfo.IS_EMPTY_REC:
-                addOpcode(OPCode.NULL_CHECK_END_MEMST_PUSH);
-                break;
             default:
                 break;
             } // switch
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Wed Jul 05 20:27:20 2017 +0200
@@ -183,7 +183,6 @@
                 case OPCode.NULL_CHECK_START:           opNullCheckStart();        continue;
                 case OPCode.NULL_CHECK_END:             opNullCheckEnd();          continue;
                 case OPCode.NULL_CHECK_END_MEMST:       opNullCheckEndMemST();     continue;
-                case OPCode.NULL_CHECK_END_MEMST_PUSH:  opNullCheckEndMemSTPush(); continue;
 
                 case OPCode.JUMP:                       opJump();                  continue;
                 case OPCode.PUSH:                       opPush();                  continue;
@@ -1025,29 +1024,6 @@
         }
     }
 
-    // USE_SUBEXP_CALL
-    private void opNullCheckEndMemSTPush() {
-        final int mem = code[ip++];   /* mem: null check id */
-
-        int isNull;
-        if (Config.USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT) {
-            isNull = nullCheckMemStRec(mem, s);
-        } else {
-            isNull = nullCheckRec(mem, s);
-        }
-
-        if (isNull != 0) {
-            if (Config.DEBUG_MATCH) {
-                Config.log.println("NULL_CHECK_END_MEMST_PUSH: skip  id:" + mem + ", s:" + s);
-            }
-
-            if (isNull == -1) {opFail(); return;}
-            nullCheckFound();
-        } else {
-            pushNullCheckEnd(mem);
-        }
-    }
-
     private void opJump() {
         ip += code[ip] + 1;
     }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/StackMachine.java	Wed Jul 05 20:27:20 2017 +0200
@@ -19,7 +19,6 @@
  */
 package jdk.nashorn.internal.runtime.regexp.joni;
 
-import static jdk.nashorn.internal.runtime.regexp.joni.BitStatus.bsAt;
 import java.lang.ref.WeakReference;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.StackPopLevel;
 import jdk.nashorn.internal.runtime.regexp.joni.constants.StackType;
@@ -369,118 +368,9 @@
         }
     }
 
-    protected final int nullCheckRec(final int id, final int s) {
-        int level = 0;
-        int k = stk;
-        while (true) {
-            k--;
-            final StackEntry e = stack[k];
-
-            if (e.type == NULL_CHECK_START) {
-                if (e.getNullCheckNum() == id) {
-                    if (level == 0) {
-                        return e.getNullCheckPStr() == s ? 1 : 0;
-                    }
-                    level--;
-                }
-            } else if (e.type == NULL_CHECK_END) {
-                level++;
-            }
-        }
-    }
-
     protected final int nullCheckMemSt(final int id, final int s) {
-        int k = stk;
-        int isNull;
-        while (true) {
-            k--;
-            StackEntry e = stack[k];
-
-            if (e.type == NULL_CHECK_START) {
-                if (e.getNullCheckNum() == id) {
-                    if (e.getNullCheckPStr() != s) {
-                        isNull = 0;
-                        break;
-                    }
-                    int endp;
-                    isNull = 1;
-                    while (k < stk) {
-                        if (e.type == MEM_START) {
-                            if (e.getMemEnd() == INVALID_INDEX) {
-                                isNull = 0;
-                                break;
-                            }
-                            if (bsAt(regex.btMemEnd, e.getMemNum())) {
-                                endp = stack[e.getMemEnd()].getMemPStr();
-                            } else {
-                                endp = e.getMemEnd();
-                            }
-                            if (stack[e.getMemStart()].getMemPStr() != endp) {
-                                isNull = 0;
-                                break;
-                            } else if (endp != s) {
-                                isNull = -1; /* empty, but position changed */
-                            }
-                        }
-                        k++;
-                        e = stack[k]; // !!
-                    }
-                    break;
-                }
-            }
-        }
-        return isNull;
-    }
-
-    protected final int nullCheckMemStRec(final int id, final int s) {
-        int level = 0;
-        int k = stk;
-        int isNull;
-        while (true) {
-            k--;
-            StackEntry e = stack[k];
-
-            if (e.type == NULL_CHECK_START) {
-                if (e.getNullCheckNum() == id) {
-                    if (level == 0) {
-                        if (e.getNullCheckPStr() != s) {
-                            isNull = 0;
-                            break;
-                        }
-                        int endp;
-                        isNull = 1;
-                        while (k < stk) {
-                            if (e.type == MEM_START) {
-                                if (e.getMemEnd() == INVALID_INDEX) {
-                                    isNull = 0;
-                                    break;
-                                }
-                                if (bsAt(regex.btMemEnd, e.getMemNum())) {
-                                    endp = stack[e.getMemEnd()].getMemPStr();
-                                } else {
-                                    endp = e.getMemEnd();
-                                }
-                                if (stack[e.getMemStart()].getMemPStr() != endp) {
-                                    isNull = 0;
-                                    break;
-                                } else if (endp != s) {
-                                    isNull = -1; /* empty, but position changed */
-                                }
-                            }
-                            k++;
-                            e = stack[k];
-                        }
-                        break;
-                    }
-                    level--;
-                }
-            } else if (e.type == NULL_CHECK_END) {
-                if (e.getNullCheckNum() == id) {
-                    level++;
-                }
-            }
-        }
-        return isNull;
+        // Return -1 here to cause operation to fail
+        return -nullCheck(id, s);
     }
 
     protected final int getRepeat(final int id) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/constants/TargetInfo.java	Wed Jul 05 20:27:20 2017 +0200
@@ -24,5 +24,4 @@
     final int ISNOT_EMPTY   = 0;
     final int IS_EMPTY      = 1;
     final int IS_EMPTY_MEM  = 2;
-    final int IS_EMPTY_REC  = 3;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8073868.js	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8073868: Regex matching causes java.lang.ArrayIndexOutOfBoundsException: 64
+ *
+ * @test
+ * @run
+ */
+
+function test(input) {
+    var comma = input.indexOf(",");
+    Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[0], input.trimLeft());
+    Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[1], input.substring(0, comma).trimLeft());
+    Assert.assertEquals(/([^\s]+),(.*)+/.exec(input)[2], input.substring(comma + 1));
+    Assert.assertEquals(/(.*)+/.exec(input)[0], input);
+    Assert.assertEquals(/(.*)+/.exec(input)[1], input);
+}
+
+test(" xxxx,         xxx xxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ");
+test(" xxxx, xxx xxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ");
+test("x,         xxxxxxxxxx xxxxxxxxx xxxxxxx, xxxx xxxxx xxxxx ");
+
+Assert.assertEquals(/(?:\1a|())*/.exec("a")[0], "a");
+Assert.assertEquals(/(?:\1a|())*/.exec("a")[1], undefined);
--- a/nashorn/test/script/basic/es6/let-eval.js	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/test/script/basic/es6/let-eval.js	Wed Jul 05 20:27:20 2017 +0200
@@ -96,3 +96,9 @@
 f();
 
 print(typeof a, typeof b, typeof c, typeof x, typeof z);
+
+let v = 1;
+eval("print('v: ' + v); v = 2; print ('v: ' + v);");
+print("this.v: " + this.v);
+print("v: " + v);
+
--- a/nashorn/test/script/basic/es6/let-eval.js.EXPECTED	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/test/script/basic/es6/let-eval.js.EXPECTED	Wed Jul 05 20:27:20 2017 +0200
@@ -14,3 +14,7 @@
 2 1 0
 2 1 0 undefined
 undefined undefined undefined undefined undefined
+v: 1
+v: 2
+this.v: undefined
+v: 2
--- a/nashorn/test/script/sandbox/interfaceimpl.js	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/test/script/sandbox/interfaceimpl.js	Wed Jul 05 20:27:20 2017 +0200
@@ -29,8 +29,8 @@
  * @security
  */
 
-var Window = Java.type("jdk.nashorn.api.scripting.Window");
-var WindowEventHandler = Java.type("jdk.nashorn.api.scripting.WindowEventHandler");
+var Window = Java.type("jdk.nashorn.api.scripting.test.Window");
+var WindowEventHandler = Java.type("jdk.nashorn.api.scripting.test.WindowEventHandler");
 
 var w = new Window();
 
--- a/nashorn/test/script/trusted/JDK-8025629.js	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/test/script/trusted/JDK-8025629.js	Wed Jul 05 20:27:20 2017 +0200
@@ -28,6 +28,6 @@
  * @run
  */
 
-load("classpath:jdk/nashorn/internal/runtime/resources/load_test.js")
+load("classpath:jdk/nashorn/internal/runtime/test/resources/load_test.js")
 
 Assert.assertEquals(loadedFunc("hello"), "HELLO");
--- a/nashorn/test/src/META-INF/services/java.sql.Driver	Wed Apr 08 13:12:48 2015 -0700
+++ b/nashorn/test/src/META-INF/services/java.sql.Driver	Wed Jul 05 20:27:20 2017 +0200
@@ -1,1 +1,1 @@
-jdk.nashorn.api.NashornSQLDriver
+jdk.nashorn.api.test.NashornSQLDriver
--- a/nashorn/test/src/jdk/internal/dynalink/beans/CallerSensitiveTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.internal.dynalink.beans;
-
-import jdk.nashorn.test.models.ClassLoaderAware;
-import org.testng.annotations.Test;
-
-@SuppressWarnings("javadoc")
-public class CallerSensitiveTest {
-    @Test
-    public void testCallerSensitive() {
-        BeansLinker.getLinkerForClass(ClassLoaderAware.class);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/internal/dynalink/beans/test/CallerSensitiveTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.dynalink.beans.test;
+
+import jdk.internal.dynalink.beans.BeansLinker;
+import jdk.nashorn.test.models.ClassLoaderAware;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadoc")
+public class CallerSensitiveTest {
+    @Test
+    public void testCallerSensitive() {
+        BeansLinker.getLinkerForClass(ClassLoaderAware.class);
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/api/NashornSQLDriver.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api;
-
-import java.sql.Connection;
-import java.sql.Driver;
-import java.sql.DriverManager;
-import java.sql.DriverPropertyInfo;
-import java.sql.SQLException;
-import java.sql.SQLFeatureNotSupportedException;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-/**
- * A dummy SQL driver for testing purpose.
- */
-public final class NashornSQLDriver implements Driver {
-    static {
-        try {
-            DriverManager.registerDriver(new NashornSQLDriver(), null);
-        } catch (final SQLException se) {
-            throw new RuntimeException(se);
-        }
-    }
-
-    @Override
-    public boolean acceptsURL(final String url) {
-        return url.startsWith("jdbc:nashorn:");
-    }
-
-    @Override
-    public Connection connect(final String url, final Properties info) {
-        throw new UnsupportedOperationException("I am a dummy!!");
-    }
-
-    @Override
-    public int getMajorVersion() {
-        return -1;
-    }
-
-    @Override
-    public int getMinorVersion() {
-        return -1;
-    }
-
-    @Override
-    public DriverPropertyInfo[] getPropertyInfo(final String url, final Properties info) {
-        return new DriverPropertyInfo[0];
-    }
-
-    @Override
-    public boolean jdbcCompliant() {
-        // no way!
-        return false;
-    }
-
-    @Override
-    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
-        throw new SQLFeatureNotSupportedException();
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ArrayConversionTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,235 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertFalse;
-import static org.testng.AssertJUnit.assertNull;
-import static org.testng.AssertJUnit.assertTrue;
-import java.util.Arrays;
-import java.util.List;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@SuppressWarnings("javadoc")
-public class ArrayConversionTest {
-    private static ScriptEngine e = null;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() {
-        e = new ScriptEngineManager().getEngineByName("nashorn");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-    }
-
-    @Test
-    public void testIntArrays() throws ScriptException {
-        runTest("assertNullIntArray", "null");
-        runTest("assertEmptyIntArray", "[]");
-        runTest("assertSingle42IntArray", "[42]");
-        runTest("assertSingle42IntArray", "['42']");
-        runTest("assertIntArrayConversions", "[false, true, NaN, Infinity, -Infinity, 0.4, 0.6, null, undefined, [], {}, [1], [1, 2]]");
-    }
-
-    @Test
-    public void testIntIntArrays() throws ScriptException {
-        runTest("assertNullIntIntArray", "null");
-        runTest("assertEmptyIntIntArray", "[]");
-        runTest("assertSingleEmptyIntIntArray", "[[]]");
-        runTest("assertSingleNullIntIntArray", "[null]");
-        runTest("assertLargeIntIntArray", "[[false], [1], [2, 3], [4, 5, 6], ['7', {valueOf: function() { return 8 }}]]");
-    }
-
-    @Test
-    public void testObjectObjectArrays() throws ScriptException {
-        runTest("assertLargeObjectObjectArray", "[[false], [1], ['foo', 42.3], [{x: 17}]]");
-    }
-
-    @Test
-    public void testBooleanArrays() throws ScriptException {
-        runTest("assertBooleanArrayConversions", "[false, true, '', 'false', 0, 1, 0.4, 0.6, {}, [], [false], [true], NaN, Infinity, null, undefined]");
-    }
-
-    @Test
-    public void testArrayAmbiguity() throws ScriptException {
-        runTest("x", "'abc'");
-        runTest("x", "['foo', 'bar']");
-    }
-
-    @Test
-    public void testListArrays() throws ScriptException {
-        runTest("assertListArray", "[['foo', 'bar'], ['apple', 'orange']]");
-    }
-
-    @Test
-    public void testVarArgs() throws ScriptException {
-        // Sole NativeArray in vararg position becomes vararg array itself
-        runTest("assertVarArg_42_17", "[42, 17]");
-        // NativeArray in vararg position becomes an argument if there are more arguments
-        runTest("assertVarArg_array_17", "[42], 18");
-        // Only NativeArray is converted to vararg array, other objects (e.g. a function) aren't
-        runTest("assertVarArg_function", "function() { return 'Hello' }");
-    }
-
-    private static void runTest(final String testMethodName, final String argument) throws ScriptException {
-        e.eval("Java.type('" + ArrayConversionTest.class.getName() + "')." + testMethodName + "(" + argument + ")");
-    }
-
-    public static void assertNullIntArray(final int[] array) {
-        assertNull(array);
-    }
-
-    public static void assertNullIntIntArray(final int[][] array) {
-        assertNull(array);
-    }
-
-    public static void assertEmptyIntArray(final int[] array) {
-        assertEquals(0, array.length);
-    }
-
-    public static void assertSingle42IntArray(final int[] array) {
-        assertEquals(1, array.length);
-        assertEquals(42, array[0]);
-    }
-
-
-    public static void assertIntArrayConversions(final int[] array) {
-        assertEquals(13, array.length);
-        assertEquals(0, array[0]); // false
-        assertEquals(1, array[1]); // true
-        assertEquals(0, array[2]); // NaN
-        assertEquals(0, array[3]); // Infinity
-        assertEquals(0, array[4]); // -Infinity
-        assertEquals(0, array[5]); // 0.4
-        assertEquals(0, array[6]); // 0.6 - floor, not round
-        assertEquals(0, array[7]); // null
-        assertEquals(0, array[8]); // undefined
-        assertEquals(0, array[9]); // []
-        assertEquals(0, array[10]); // {}
-        assertEquals(1, array[11]); // [1]
-        assertEquals(0, array[12]); // [1, 2]
-    }
-
-    public static void assertEmptyIntIntArray(final int[][] array) {
-        assertEquals(0, array.length);
-    }
-
-    public static void assertSingleEmptyIntIntArray(final int[][] array) {
-        assertEquals(1, array.length);
-        assertTrue(Arrays.equals(new int[0], array[0]));
-    }
-
-    public static void assertSingleNullIntIntArray(final int[][] array) {
-        assertEquals(1, array.length);
-        assertNull(null, array[0]);
-    }
-
-    public static void assertLargeIntIntArray(final int[][] array) {
-        assertEquals(5, array.length);
-        assertTrue(Arrays.equals(new int[] { 0 }, array[0]));
-        assertTrue(Arrays.equals(new int[] { 1 }, array[1]));
-        assertTrue(Arrays.equals(new int[] { 2, 3 }, array[2]));
-        assertTrue(Arrays.equals(new int[] { 4, 5, 6 }, array[3]));
-        assertTrue(Arrays.equals(new int[] { 7, 8 }, array[4]));
-    }
-
-    public static void assertLargeObjectObjectArray(final Object[][] array) throws ScriptException {
-        assertEquals(4, array.length);
-        assertTrue(Arrays.equals(new Object[] { Boolean.FALSE }, array[0]));
-        assertTrue(Arrays.equals(new Object[] { 1 }, array[1]));
-        assertTrue(Arrays.equals(new Object[] { "foo", 42.3d }, array[2]));
-        assertEquals(1, array[3].length);
-        e.getBindings(ScriptContext.ENGINE_SCOPE).put("obj", array[3][0]);
-        assertEquals(17, e.eval("obj.x"));
-    }
-
-    public static void assertBooleanArrayConversions(final boolean[] array) {
-        assertEquals(16, array.length);
-        assertFalse(array[0]); // false
-        assertTrue(array[1]); // true
-        assertFalse(array[2]); // ''
-        assertTrue(array[3]); // 'false' (yep, every non-empty string converts to true)
-        assertFalse(array[4]); // 0
-        assertTrue(array[5]); // 1
-        assertTrue(array[6]); // 0.4
-        assertTrue(array[7]); // 0.6
-        assertTrue(array[8]); // {}
-        assertTrue(array[9]); // []
-        assertTrue(array[10]); // [false]
-        assertTrue(array[11]); // [true]
-        assertFalse(array[12]); // NaN
-        assertTrue(array[13]); // Infinity
-        assertFalse(array[14]); // null
-        assertFalse(array[15]); // undefined
-    }
-
-    public static void assertListArray(final List<?>[] array) {
-        assertEquals(2, array.length);
-        assertEquals(Arrays.asList("foo", "bar"), array[0]);
-        assertEquals(Arrays.asList("apple", "orange"), array[1]);
-    }
-
-    public static void assertVarArg_42_17(final Object... args) {
-        assertEquals(2, args.length);
-        assertEquals(42, ((Number)args[0]).intValue());
-        assertEquals(17, ((Number)args[1]).intValue());
-    }
-
-    public static void assertVarArg_array_17(final Object... args) throws ScriptException {
-        assertEquals(2, args.length);
-        e.getBindings(ScriptContext.ENGINE_SCOPE).put("arr", args[0]);
-        assertTrue((Boolean)e.eval("arr instanceof Array && arr.length == 1 && arr[0] == 42"));
-        assertEquals(18, ((Number)args[1]).intValue());
-    }
-
-    public static void assertVarArg_function(final Object... args) throws ScriptException {
-        assertEquals(1, args.length);
-        e.getBindings(ScriptContext.ENGINE_SCOPE).put("fn", args[0]);
-        assertEquals("Hello", e.eval("fn()"));
-    }
-
-
-
-    public static void x(final String y) {
-        assertEquals("abc", y);
-    }
-    public static void x(final String[] y) {
-        assertTrue(Arrays.equals(new String[] { "foo", "bar"}, y));
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/BooleanAccessTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import java.util.Arrays;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest
- */
-@SuppressWarnings("javadoc")
-public class BooleanAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = null;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        o = new SharedObject();
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-        o = null;
-    }
-
-    @Test
-    public void accessFieldBoolean() throws ScriptException {
-        e.eval("var p_boolean = o.publicBoolean;");
-        assertEquals(o.publicBoolean, e.get("p_boolean"));
-        assertEquals("boolean", e.eval("typeof p_boolean;"));
-        e.eval("o.publicBoolean = false;");
-        assertEquals(false, o.publicBoolean);
-    }
-
-    @Test
-    public void accessFieldBooleanArray() throws ScriptException {
-        e.eval("var p_boolean_array = o.publicBooleanArray;");
-        assertEquals(o.publicBooleanArray[0], e.eval("o.publicBooleanArray[0]"));
-        assertTrue(Arrays.equals(o.publicBooleanArray, (boolean[])e.get("p_boolean_array")));
-        e.eval("var t_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
-                "t_boolean_arr[0] = true;" +
-                "t_boolean_arr[1] = false;" +
-                "t_boolean_arr[2] = false;" +
-                "o.publicBooleanArray = t_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { true, false, false }, o.publicBooleanArray));
-        e.eval("o.publicBooleanArray[0] = false;");
-        assertEquals(false, o.publicBooleanArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldBoolean() throws ScriptException {
-        e.eval("var ps_boolean = SharedObject.publicStaticBoolean;");
-        assertEquals(SharedObject.publicStaticBoolean, e.get("ps_boolean"));
-        assertEquals("boolean", e.eval("typeof ps_boolean;"));
-        e.eval("SharedObject.publicStaticBoolean = false;");
-        assertEquals(false, SharedObject.publicStaticBoolean);
-    }
-
-    @Test
-    public void accessStaticFieldBooleanArray() throws ScriptException {
-        e.eval("var ps_boolean_array = SharedObject.publicStaticBooleanArray;");
-        assertEquals(SharedObject.publicStaticBooleanArray[0], e.eval("SharedObject.publicStaticBooleanArray[0]"));
-        assertTrue(Arrays.equals(SharedObject.publicStaticBooleanArray, (boolean[])e.get("ps_boolean_array")));
-        e.eval("var ts_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
-                "ts_boolean_arr[0] = true;" +
-                "ts_boolean_arr[1] = false;" +
-                "ts_boolean_arr[2] = true;" +
-                "SharedObject.publicStaticBooleanArray = ts_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { true, false, true }, SharedObject.publicStaticBooleanArray));
-        e.eval("SharedObject.publicStaticBooleanArray[0] = false;");
-        assertEquals(false, SharedObject.publicStaticBooleanArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldBoolean() throws ScriptException {
-        e.eval("var pf_boolean = o.publicFinalBoolean;");
-        assertEquals(o.publicFinalBoolean, e.get("pf_boolean"));
-        assertEquals("boolean", e.eval("typeof pf_boolean;"));
-        e.eval("o.publicFinalBoolean = false;");
-        assertEquals(true, o.publicFinalBoolean);
-    }
-
-    @Test
-    public void accessFinalFieldBooleanArray() throws ScriptException {
-        e.eval("var pf_boolean_array = o.publicFinalBooleanArray;");
-        assertEquals(o.publicFinalBooleanArray[0], e.eval("o.publicFinalBooleanArray[0]"));
-        assertTrue(Arrays.equals(o.publicFinalBooleanArray, (boolean[])e.get("pf_boolean_array")));
-        e.eval("var tf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
-                "tf_boolean_arr[0] = false;" +
-                "tf_boolean_arr[1] = false;" +
-                "tf_boolean_arr[2] = true;" +
-                "o.publicOFinalbjectArray = tf_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { false, false, true, false }, o.publicFinalBooleanArray));
-        e.eval("o.publicFinalBooleanArray[0] = true;");
-        assertEquals(true, o.publicFinalBooleanArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldBoolean() throws ScriptException {
-        e.eval("var psf_boolean = SharedObject.publicStaticFinalBoolean;");
-        assertEquals(SharedObject.publicStaticFinalBoolean, e.get("psf_boolean"));
-        assertEquals("boolean", e.eval("typeof psf_boolean;"));
-        e.eval("SharedObject.publicStaticFinalBoolean = false;");
-        assertEquals(true, SharedObject.publicStaticFinalBoolean);
-    }
-
-    @Test
-    public void accessStaticFinalFieldBooleanArray() throws ScriptException {
-        e.eval("var psf_boolean_array = SharedObject.publicStaticFinalBooleanArray;");
-        assertEquals(SharedObject.publicStaticFinalBooleanArray[0], e.eval("SharedObject.publicStaticFinalBooleanArray[0]"));
-        assertTrue(Arrays.equals(SharedObject.publicStaticFinalBooleanArray, (boolean[])e.get("psf_boolean_array")));
-        e.eval("var tsf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
-                "tsf_boolean_arr[0] = false;" +
-                "tsf_boolean_arr[1] = true;" +
-                "tsf_boolean_arr[2] = false;" +
-                "SharedObject.publicStaticFinalBooleanArray = tsf_boolean_arr;");
-        assertTrue(Arrays.equals(new boolean[] { false, true, false, false }, SharedObject.publicStaticFinalBooleanArray));
-        e.eval("SharedObject.publicStaticFinalBooleanArray[0] = true;");
-        assertEquals(true, SharedObject.publicStaticFinalBooleanArray[0]);
-    }
-
-    @Test
-    public void accessFieldBooleanBoxing() throws ScriptException {
-        e.eval("var p_boolean_box = o.publicBooleanBox;");
-        assertEquals(o.publicBooleanBox, e.get("p_boolean_box"));
-        assertEquals("boolean", e.eval("typeof p_boolean_box;"));
-        e.eval("o.publicBooleanBox = false;");
-        assertEquals(false, (boolean)o.publicBooleanBox);
-    }
-
-    @Test
-    public void accessStaticFieldBooleanBoxing() throws ScriptException {
-        e.eval("var ps_boolean_box = SharedObject.publicStaticBooleanBox;");
-        assertEquals(SharedObject.publicStaticBooleanBox, e.get("ps_boolean_box"));
-        assertEquals("boolean", e.eval("typeof ps_boolean_box;"));
-        e.eval("SharedObject.publicStaticBooleanBox = false;");
-        assertEquals(false, (boolean)SharedObject.publicStaticBooleanBox);
-    }
-
-    @Test
-    public void accessFinalFieldBooleanBoxing() throws ScriptException {
-        e.eval("var pf_boolean_box = o.publicFinalBooleanBox;");
-        assertEquals(o.publicFinalBooleanBox, e.get("pf_boolean_box"));
-        assertEquals("boolean", e.eval("typeof pf_boolean_box;"));
-        e.eval("o.publicFinalBooleanBox = false;");
-        assertEquals(true, (boolean)o.publicFinalBooleanBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldBooleanBoxing() throws ScriptException {
-        e.eval("var psf_boolean_box = SharedObject.publicStaticFinalBooleanBox;");
-        assertEquals(SharedObject.publicStaticFinalBooleanBox, e.get("psf_boolean_box"));
-        assertEquals("boolean", e.eval("typeof psf_boolean_box;"));
-        e.eval("SharedObject.publicStaticFinalBooleanBox = false;");
-        assertEquals(true, (boolean)SharedObject.publicStaticFinalBooleanBox);
-    }
-
-    @Test
-    public void accessVolatileField() throws ScriptException {
-        e.eval("var pv_boolean = o.volatileBoolean;");
-        assertEquals(o.volatileBoolean, e.get("pv_boolean"));
-        assertEquals("boolean", e.eval("typeof pv_boolean;"));
-        e.eval("o.volatileBoolean = false;");
-        assertEquals(false, o.volatileBoolean);
-    }
-
-    @Test
-    public void accessTransientField() throws ScriptException {
-        e.eval("var pt_boolean = o.transientBoolean;");
-        assertEquals(o.transientBoolean, e.get("pt_boolean"));
-        assertEquals("boolean", e.eval("typeof pt_boolean;"));
-        e.eval("o.transientBoolean = false;");
-        assertEquals(false, o.transientBoolean);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ConsStringTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import java.util.HashMap;
-import java.util.Map;
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import jdk.nashorn.api.scripting.JSObject;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-@SuppressWarnings("javadoc")
-public class ConsStringTest {
-    private static ScriptEngine e = null;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() {
-        e = new ScriptEngineManager().getEngineByName("nashorn");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-    }
-
-    @Test
-    public void testConsStringFlattening() throws ScriptException {
-        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
-        final Map<Object, Object> m = new HashMap<>();
-        b.put("m", m);
-        e.eval("var x = 'f'; x += 'oo'; var y = 'b'; y += 'ar'; m.put(x, y)");
-        assertEquals("bar", m.get("foo"));
-    }
-
-    @Test
-    public void testConsStringFromMirror() throws ScriptException {
-        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
-        //final Map<Object, Object> m = new HashMap<>();
-        e.eval("var x = 'f'; x += 'oo'; var obj = {x: x};");
-        assertEquals("foo", ((JSObject)b.get("obj")).getMember("x"));
-    }
-
-    @Test
-    public void testArrayConsString() throws ScriptException {
-        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
-        final ArrayHolder h = new ArrayHolder();
-        b.put("h", h);
-        e.eval("var x = 'f'; x += 'oo'; h.array = [x];");
-        assertEquals(1, h.array.length);
-        assertEquals("foo", h.array[0]);
-    }
-
-
-    public static class ArrayHolder {
-        private Object[] array;
-
-        public void setArray(final Object[] array) {
-            this.array = array;
-        }
-
-        public Object[] getArray() {
-            return array;
-        }
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/MethodAccessTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,466 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-import java.util.Arrays;
-import java.util.Calendar;
-import java.util.Locale;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest
- */
-@SuppressWarnings("javadoc")
-public class MethodAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = null;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        o = new SharedObject();
-        o.setEngine(e);
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-        o = null;
-    }
-
-    @Test
-    public void accessMethodthrowsCheckedException() throws ScriptException {
-        e.eval("try {" +
-                "    var a = java.lang.Long.parseLong('foo');" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "    var isNumberException = e instanceof java.lang.NumberFormatException;" +
-                "} finally {" +
-                "    var isFinalized = true;" +
-                "}");
-        assertEquals("Exception thrown", true, e.get("isThrown"));
-        assertEquals("Finally called", true, e.get("isFinalized"));
-        assertEquals("Type is NumberFormatException", true, e.get("isNumberException"));
-    }
-
-    @Test
-    public void accessMethodthrowsUnCheckedException() throws ScriptException {
-        e.eval("try {" +
-                "    var a = java.lang.String.valueOf(null);" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "    var isNumberException = e instanceof java.lang.NullPointerException;" +
-                "} finally {" +
-                "    var isFinalized = true;" +
-                "}");
-        assertEquals(true, e.get("isThrown"));
-        assertEquals(true, e.get("isFinalized"));
-        assertEquals(true, e.get("isNumberException"));
-    }
-
-    @Test
-    public void accessMethodStartsThread() throws ScriptException {
-        e.eval("o.methodStartsThread();");
-        assertEquals(false, o.isFinished);
-    }
-
-    @Test
-    public void accessStaticMethod() throws ScriptException {
-        assertEquals(10, e.eval("java.lang.Math.abs(-10);"));
-    }
-
-    @Test
-    public void accessSynchronousMethod() throws ScriptException {
-        e.eval("var v = new java.util.Vector();" + "v.add(10);" + "v.add(20);" + "v.add(30);");
-        assertEquals(10, e.eval("v[0]"));
-        assertEquals(20, e.eval("v[1]"));
-        assertEquals(30, e.eval("v[2]"));
-        assertEquals(3, e.eval("v.size()"));
-    }
-
-    @Test
-    public void accessStaticSynchronousMethod() throws ScriptException {
-        e.eval("var locales = java.util.Calendar.getAvailableLocales();");
-        final Locale[] locales = (Locale[])e.get("locales");
-        assertEquals(locales.length, Calendar.getAvailableLocales().length);
-    }
-
-    @Test
-    public void accessNativeMethod() throws ScriptException {
-        assertEquals(4.0, e.eval("java.lang.StrictMath.log10(10000);"));
-    }
-
-    @Test
-    public void accessConstructorOfAbstractClass() throws ScriptException {
-        e.eval("try {" +
-                "    var a = new java.util.AbstractList();" +
-                "    print('fail');" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "}");
-        assertEquals(true, e.get("isThrown"));
-    }
-
-    @Test
-    public void accessMethodVoid() throws ScriptException {
-        o.isAccessed = false;
-        e.eval("o.voidMethod();");
-        assertTrue(o.isAccessed);
-    }
-
-    @Test
-    public void accessMethodBoolean() throws ScriptException {
-        assertEquals(true, e.eval("o.booleanMethod(false);"));
-        assertEquals(false, e.eval("o.booleanMethod(true);"));
-        assertEquals(false, e.eval("o.booleanMethod('false');"));
-        assertEquals(true, e.eval("o.booleanMethod('');"));
-        assertEquals(true, e.eval("o.booleanMethod(0);"));
-    }
-
-    @Test
-    public void accessMethodInt() throws ScriptException {
-        assertEquals(0, e.eval("o.intMethod(0);"));
-        assertEquals(-200, e.eval("o.intMethod(-100);"));
-        assertEquals(0, e.eval("o.intMethod('0');"));
-        assertEquals(-200, e.eval("o.intMethod('-100');"));
-    }
-
-    @Test
-    public void accessMethodLong() throws ScriptException {
-        assertEquals((long)0, e.eval("o.longMethod(0);"));
-        assertEquals((long)400, e.eval("o.longMethod(200);"));
-        assertEquals((long) 0, e.eval("o.longMethod('0');"));
-        assertEquals((long) 400, e.eval("o.longMethod('200');"));
-    }
-
-    @Test
-    public void accessMethodByte() throws ScriptException {
-        assertEquals((byte) 0, e.eval("o.byteMethod(0);"));
-        assertEquals((byte) 10, e.eval("o.byteMethod(5);"));
-        assertEquals((byte) 0, e.eval("o.byteMethod('0');"));
-        assertEquals((byte) 10, e.eval("o.byteMethod('5');"));
-    }
-
-    @Test
-    public void accessMethodShort() throws ScriptException {
-        assertEquals((short)0, e.eval("o.shortMethod(0);"));
-        assertEquals((short)8000, e.eval("o.shortMethod(4000);"));
-        assertEquals((short) 0, e.eval("o.shortMethod('0');"));
-        assertEquals((short) 8000, e.eval("o.shortMethod('4000');"));
-    }
-
-    @Test
-    public void accessMethodChar() throws ScriptException {
-        assertEquals('A', e.eval("o.charMethod('a');"));
-        assertEquals('Z', e.eval("o.charMethod('z');"));
-        assertEquals(o.charMethod((char)0), e.eval("o.charMethod(0);"));
-        assertEquals(o.charMethod((char)3150), e.eval("o.charMethod(3150);"));
-    }
-
-    @Test
-    public void accessMethodFloat() throws ScriptException {
-        assertEquals(0.0f, e.eval("o.floatMethod(0.0);"));
-        assertEquals(4.2f, e.eval("o.floatMethod(2.1);"));
-        assertEquals(0.0f, e.eval("o.floatMethod('0.0');"));
-        assertEquals(4.2f, e.eval("o.floatMethod('2.1');"));
-    }
-
-    @Test
-    public void accessMethodDouble() throws ScriptException {
-        assertEquals(0.0, e.eval("o.doubleMethod(0.0);"));
-        assertEquals(14.0, e.eval("o.doubleMethod(7.0);"));
-        assertEquals(0.0, e.eval("o.doubleMethod('0.0');"));
-        assertEquals(14.0, e.eval("o.doubleMethod('7.0');"));
-    }
-
-    @Test
-    public void accessMethodBooleanBoxing() throws ScriptException {
-        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.FALSE);"));
-        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.TRUE);"));
-        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod('');"));
-        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod('false');"));
-    }
-
-    @Test
-    public void accessMethodIntBoxing() throws ScriptException {
-        assertEquals(0, e.eval("o.intBoxingMethod(0);"));
-        assertEquals(-200, e.eval("o.intBoxingMethod(-100);"));
-        assertTrue((int)e.eval("(new java.lang.Integer(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodLongBoxing() throws ScriptException {
-        assertEquals((long) 0, e.eval("o.longBoxingMethod(0);"));
-        assertEquals((long) 400, e.eval("o.longBoxingMethod(200);"));
-        assertTrue((int)e.eval("(new java.lang.Long(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodByteBoxing() throws ScriptException {
-        assertEquals((byte) 0, e.eval("o.byteBoxingMethod(0);"));
-        assertEquals((byte) 10, e.eval("o.byteBoxingMethod(5);"));
-        assertTrue((int)e.eval("(new java.lang.Byte(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodShortBoxing() throws ScriptException {
-        assertEquals((short) 0, e.eval("o.shortBoxingMethod(0);"));
-        assertEquals((short) 8000, e.eval("o.shortBoxingMethod(4000);"));
-        assertTrue((int)e.eval("(new java.lang.Short(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodCharBoxing() throws ScriptException {
-        assertEquals('A', e.eval("o.charBoxingMethod('a');"));
-        assertEquals('Z', e.eval("o.charBoxingMethod('z');"));
-        assertTrue((int)e.eval("(new java.lang.Character(2)).compareTo(10)") < 0);
-    }
-
-    @Test
-    public void accessMethodFloatBoxing() throws ScriptException {
-        assertEquals(0.0f, e.eval("o.floatBoxingMethod(0.0);"));
-        assertEquals(4.2f, e.eval("o.floatBoxingMethod(2.1);"));
-        assertTrue((int)e.eval("(new java.lang.Float(2.0)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodDoubleBoxing() throws ScriptException {
-        assertEquals(0.0, e.eval("o.doubleBoxingMethod(0.0);"));
-        assertEquals(14.0, e.eval("o.doubleBoxingMethod(7.0);"));
-        assertTrue((int)e.eval("(new java.lang.Double(2)).compareTo(10.0)") < 0);
-    }
-
-    @Test
-    public void accessMethodString() throws ScriptException {
-        assertEquals("", e.eval("o.stringMethod('');"));
-        assertEquals("abcabc", e.eval("o.stringMethod('abc');"));
-    }
-
-    @Test
-    public void accessMethodObject() throws ScriptException {
-        e.put("so", new Person(5));
-        e.eval("var rso = o.objectMethod(so);");
-        assertEquals(new Person(10), e.get("rso"));
-    }
-
-    @Test
-    public void accessMethodBooleanArray() throws ScriptException {
-        assertTrue(Arrays.equals(o.booleanArrayMethod(o.publicBooleanArray), (boolean[])e.eval("o.booleanArrayMethod(o.publicBooleanArray);")));
-    }
-
-    @Test
-    public void accessMethodIntArray() throws ScriptException {
-        assertArrayEquals(o.intArrayMethod(o.publicIntArray), (int[])e.eval("o.intArrayMethod(o.publicIntArray);"));
-    }
-
-    @Test
-    public void accessMethodLongArray() throws ScriptException {
-        assertArrayEquals(o.longArrayMethod(o.publicLongArray), (long[])e.eval("o.longArrayMethod(o.publicLongArray);"));
-    }
-
-    @Test
-    public void accessMethodByteArray() throws ScriptException {
-        assertArrayEquals(o.byteArrayMethod(o.publicByteArray), (byte[])e.eval("o.byteArrayMethod(o.publicByteArray);"));
-    }
-
-    @Test
-    public void accessMethodShortArray() throws ScriptException {
-        assertArrayEquals(o.shortArrayMethod(o.publicShortArray), (short[])e.eval("o.shortArrayMethod(o.publicShortArray);"));
-    }
-
-    @Test
-    public void accessMethodCharArray() throws ScriptException {
-        assertArrayEquals(o.charArrayMethod(o.publicCharArray), (char[])e.eval("o.charArrayMethod(o.publicCharArray);"));
-    }
-
-    @Test
-    public void accessMethodFloatArray() throws ScriptException {
-        assertArrayEquals(o.floatArrayMethod(o.publicFloatArray), (float[])e.eval("o.floatArrayMethod(o.publicFloatArray);"), 1e-10f);
-    }
-
-    @Test
-    public void accessMethodDoubleArray() throws ScriptException {
-        assertArrayEquals(o.doubleArrayMethod(o.publicDoubleArray), (double[])e.eval("o.doubleArrayMethod(o.publicDoubleArray);"), 1e-10);
-    }
-
-    @Test
-    public void accessMethodStringArray() throws ScriptException {
-        assertArrayEquals(o.stringArrayMethod(o.publicStringArray), (String[])e.eval("o.stringArrayMethod(o.publicStringArray);"));
-    }
-
-    @Test
-    public void accessMethodObjectArray() throws ScriptException {
-        assertArrayEquals(o.objectArrayMethod(o.publicObjectArray), (Person[])e.eval("o.objectArrayMethod(o.publicObjectArray);"));
-    }
-
-    @Test
-    public void accessDefaultConstructor() throws ScriptException {
-        e.eval("var dc = new Packages.jdk.nashorn.api.javaaccess.Person()");
-        assertEquals(new Person(), e.get("dc"));
-    }
-
-    @Test
-    public void accessCustomConstructor() throws ScriptException {
-        e.eval("var cc = new Packages.jdk.nashorn.api.javaaccess.Person(17)");
-        assertEquals(new Person(17), e.get("cc"));
-    }
-
-    @Test
-    public void accessMethod2PrimitiveParams() throws ScriptException {
-        assertEquals(o.twoParamMethod(50, 40.0), e.eval("o.twoParamMethod(50,40);"));
-    }
-
-    @Test
-    public void accessMethod3PrimitiveParams() throws ScriptException {
-        assertEquals(o.threeParamMethod((short)10, 20L, 'b'), e.eval("o.threeParamMethod(10,20,'b');"));
-    }
-
-    @Test
-    public void accessMethod2ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(200), new Person(300) }, (Person[])e.eval("o.twoObjectParamMethod(new Person(300),new Person(200));"));
-    }
-
-    @Test
-    public void accessMethod3ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.threeObjectParamMethod(new Person(1),new Person(2),new Person(3));"));
-    }
-
-    @Test
-    public void accessMethod8ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.eightObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6),new Person(7),new Person(8));"));
-    }
-
-    @Test
-    public void accessMethod9ObjectParams() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.nineObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
-    }
-
-    @Test
-    public void accessMethodObjectEllipsis() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
-        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodObjectEllipsis()"));
-        assertArrayEquals(new Person[] { new Person(9) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(9))"));
-    }
-
-    @Test
-    public void accessMethodPrimitiveEllipsis() throws ScriptException {
-        assertArrayEquals(new Person[] { new Person(1), new Person(3), new Person(2) }, (Person[])e.eval("o.methodPrimitiveEllipsis(1,3,2);"));
-        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodPrimitiveEllipsis();"));
-        assertArrayEquals(o.methodPrimitiveEllipsis(9, 8, 7, 6, 5, 4, 3, 2, 1), (Person[])e.eval("o.methodPrimitiveEllipsis(9,8,7,6,5,4,3,2,1);"));
-    }
-
-    @Test
-    public void accessMethodMixedEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { new Person(1), 12, "hello", true }, (Object[])e.eval("o.methodMixedEllipsis(new Person(1),12,'hello',true);"));
-        assertArrayEquals(new Object[] {}, (Object[])e.eval("o.methodMixedEllipsis();"));
-    }
-
-    @Test
-    public void accessMethodObjectWithEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { "hello", 12, 15, 16 }, (Object[])e.eval("o.methodObjectWithEllipsis('hello',12,15,16);"));
-        assertArrayEquals(new Object[] { "hello" }, (Object[])e.eval("o.methodObjectWithEllipsis('hello');"));
-    }
-
-    @Test
-    public void accessMethodPrimitiveWithEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { 14, 12L, 15L, 16L }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(14,12,15,16);"));
-        assertArrayEquals(new Object[] { 12 }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(12);"));
-    }
-
-    @Test
-    public void accessMethodMixedWithEllipsis() throws ScriptException {
-        assertArrayEquals(new Object[] { "Hello", 10, true, -100500, 80d }, (Object[])e.eval("o.methodMixedWithEllipsis('Hello', 10, true, -100500,80.0);"));
-        assertArrayEquals(new Object[] { "Nashorn", 15 }, (Object[])e.eval("o.methodMixedWithEllipsis('Nashorn',15);"));
-    }
-
-    @Test
-    public void accessMethodOverloaded() throws ScriptException {
-        assertEquals(0, e.eval("o.overloadedMethod(0);"));
-        assertEquals(2000, e.eval("o.overloadedMethod(1000);"));
-        assertEquals(2, e.eval("o.overloadedMethod('10');"));
-        assertEquals(7, e.eval("o.overloadedMethod('Nashorn');"));
-        assertEquals(4, e.eval("o.overloadedMethod('true');"));
-        assertEquals(1, e.eval("o.overloadedMethod(true);"));
-        assertEquals(0, e.eval("o.overloadedMethod(false);"));
-        assertEquals(44, e.eval("o.overloadedMethod(new Person(22));"));
-        assertEquals(0, e.eval("o.overloadedMethod(new Person());"));
-    }
-
-    @Test
-    public void accessMethodDoubleVSintOverloaded() throws ScriptException {
-        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.0);"));
-        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(1000.0);"));
-        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.01);"));
-        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(100.02);"));
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0);"));
-        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(1000);"));
-    }
-
-    @Test
-    public void accessJavaMethodIntFromJSFromJavaFromJS() throws ScriptException {
-        e.eval("function secondLevelMethodInt(a) {"
-                + "return o.thirdLevelMethodInt(a);"
-                + "}");
-        assertEquals(50, e.eval("o.firstLevelMethodInt(10);"));
-    }
-
-    @Test
-    public void accessJavaMethodIntegerFromJSFromJavaFromJS() throws ScriptException {
-        e.eval("function secondLevelMethodInteger(a) {"
-                + "return o.thirdLevelMethodInteger(a);"
-                + "}");
-        assertEquals(100, e.eval("o.firstLevelMethodInteger(10);"));
-    }
-
-    @Test
-    public void accessJavaMethodObjectFromJSFromJavaFromJS() throws ScriptException {
-        e.eval("function secondLevelMethodObject(p) {"
-                + "return o.thirdLevelMethodObject(p);"
-                + "}");
-        assertEquals(new Person(100), e.eval("o.firstLevelMethodObject(new Person(10));"));
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberAccessTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,789 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest
- */
-@SuppressWarnings("javadoc")
-public class NumberAccessTest {
-
-    private static ScriptEngine e;
-    private static SharedObject o;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        o = new SharedObject();
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-        o = null;
-    }
-
-    // --------------------------------long
-    // tests------------------------------------
-    @Test
-    public void accessFieldLong() throws ScriptException {
-        e.eval("var p_long = o.publicLong;");
-        assertEquals(o.publicLong, e.get("p_long"));
-        e.eval("o.publicLong = 12;");
-        assertEquals(12, o.publicLong);
-    }
-
-    @Test
-    public void accessFieldLongArray() throws ScriptException {
-        e.eval("var p_long_array = o.publicLongArray;");
-        assertEquals(o.publicLongArray[0], e.eval("o.publicLongArray[0];"));
-        assertArrayEquals(o.publicLongArray, (long[])e.get("p_long_array"));
-        e.eval("var t_long_arr = new (Java.type(\"long[]\"))(3);" +
-                "t_long_arr[0] = -189009;" +
-                "t_long_arr[1] = 456;" +
-                "t_long_arr[2] = 600000001;" +
-                "o.publicLongArray = t_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { -189009, 456, 600000001 }, o.publicLongArray);
-        e.eval("o.publicLongArray[0] = 10;");
-        assertEquals(10, o.publicLongArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldLong() throws ScriptException {
-        e.eval("var ps_long = SharedObject.publicStaticLong;");
-        assertEquals(SharedObject.publicStaticLong, e.get("ps_long"));
-        e.eval("SharedObject.publicStaticLong = 120;");
-        assertEquals(120, SharedObject.publicStaticLong);
-    }
-
-    @Test
-    public void accessStaticFieldLongArray() throws ScriptException {
-        e.eval("var ps_long_array = SharedObject.publicStaticLongArray;");
-        assertEquals(SharedObject.publicStaticLongArray[0], e.eval("SharedObject.publicStaticLongArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticLongArray, (long[])e.get("ps_long_array"));
-        e.eval("var ts_long_arr = new (Java.type(\"long[]\"))(3);" +
-                "ts_long_arr[0] = -189009;" +
-                "ts_long_arr[1] = 456;" +
-                "ts_long_arr[2] = 600000001;" +
-                "SharedObject.publicStaticLongArray = ts_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { -189009, 456, 600000001 }, SharedObject.publicStaticLongArray);
-        e.eval("SharedObject.publicStaticLongArray[0] = 10;");
-        assertEquals(10, SharedObject.publicStaticLongArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldLong() throws ScriptException {
-        e.eval("var pf_long = o.publicFinalLong;");
-        assertEquals(o.publicFinalLong, e.get("pf_long"));
-        e.eval("o.publicFinalLong = 120;");
-        assertEquals(13353333333333333L, o.publicFinalLong);
-    }
-
-    @Test
-    public void accessFinalFieldLongArray() throws ScriptException {
-        e.eval("var pf_long_array = o.publicFinalLongArray;");
-        assertEquals(o.publicFinalLongArray[0], e.eval("o.publicFinalLongArray[0];"));
-        assertArrayEquals(o.publicFinalLongArray, (long[])e.get("pf_long_array"));
-        e.eval("var tf_long_arr = new (Java.type(\"long[]\"))(3);" +
-                "tf_long_arr[0] = -189009;" +
-                "tf_long_arr[1] = 456;" +
-                "tf_long_arr[2] = 600000001;" +
-                "o.publicFinalLongArray = tf_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { 1901733333333L, -2247355555L, 3977377777L }, o.publicFinalLongArray);
-        e.eval("o.publicFinalLongArray[0] = 10;");
-        assertEquals(10, o.publicFinalLongArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldLong() throws ScriptException {
-        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
-        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
-        e.eval("SharedObject.publicStaticFinalLong = 120;");
-        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
-    }
-
-    @Test
-    public void accessStaticFinalFieldLongArray() throws ScriptException {
-        e.eval("var psf_long_array = SharedObject.publicStaticFinalLongArray;");
-        assertEquals(SharedObject.publicStaticFinalLongArray[0], e.eval("SharedObject.publicStaticFinalLongArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalLongArray, (long[])e.get("psf_long_array"));
-        e.eval("var tsf_long_arr = new (Java.type(\"long[]\"))(3);" +
-                "tsf_long_arr[0] = -189009;" +
-                "tsf_long_arr[1] = 456;" +
-                "tsf_long_arr[2] = 600000001;" +
-                "SharedObject.publicStaticFinalLongArray = tsf_long_arr;");
-        // e.eval("o.publicIntArray = [-189009,456,600000001];");
-        assertArrayEquals(new long[] { 19017383333L, -2247358L, 39773787L }, SharedObject.publicStaticFinalLongArray);
-        e.eval("SharedObject.publicStaticFinalLongArray[0] = 10;");
-        assertEquals(10, SharedObject.publicStaticFinalLongArray[0]);
-    }
-
-    // --------------------------------int
-    // tests------------------------------------
-    @Test
-    public void accessFieldInt() throws ScriptException {
-        e.eval("var p_int = o.publicInt;");
-        assertEquals(o.publicInt, e.get("p_int"));
-        e.eval("o.publicInt = 14;");
-        assertEquals(14, o.publicInt);
-    }
-
-    @Test
-    public void accessFieldIntArray() throws ScriptException {
-        e.eval("var p_int_array = o.publicIntArray;");
-        assertEquals(o.publicIntArray[0], e.eval("o.publicIntArray[0];"));
-        assertArrayEquals(o.publicIntArray, (int[])e.get("p_int_array"));
-        e.eval("var t_int_arr = new (Java.type(\"int[]\"))(3);" +
-                "t_int_arr[0] = 4;" +
-                "t_int_arr[1] = 5;" +
-                "t_int_arr[2] = 6;" +
-                "o.publicIntArray = t_int_arr;");
-        assertArrayEquals(new int[] { 4, 5, 6 }, o.publicIntArray);
-        e.eval("o.publicIntArray[0] = 100;");
-        assertEquals(100, o.publicIntArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldInt() throws ScriptException {
-        e.eval("var ps_int = SharedObject.publicStaticInt;");
-        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
-        e.eval("SharedObject.publicStaticInt = 140;");
-        assertEquals(140, SharedObject.publicStaticInt);
-    }
-
-    @Test
-    public void accessStaticFieldIntArray() throws ScriptException {
-        e.eval("var ps_int_array = SharedObject.publicStaticIntArray;");
-        assertEquals(SharedObject.publicStaticIntArray[0], e.eval("SharedObject.publicStaticIntArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticIntArray, (int[])e.get("ps_int_array"));
-        e.eval("var ts_int_arr = new (Java.type(\"int[]\"))(3);" +
-                "ts_int_arr[0] = 4;" +
-                "ts_int_arr[1] = 5;" +
-                "ts_int_arr[2] = 6;" +
-                "SharedObject.publicStaticIntArray = ts_int_arr;");
-        assertArrayEquals(new int[] { 4, 5, 6 }, SharedObject.publicStaticIntArray);
-        e.eval("SharedObject.publicStaticIntArray[0] = 100;");
-        assertEquals(100, SharedObject.publicStaticIntArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldInt() throws ScriptException {
-        e.eval("var pf_int = o.publicFinalInt;");
-        assertEquals(o.publicFinalInt, e.get("pf_int"));
-
-        e.eval("o.publicFinalInt = 10;");
-        assertEquals(20712023, o.publicFinalInt);
-    }
-
-    @Test
-    public void accessFinalFieldIntArray() throws ScriptException {
-        e.eval("var pf_int_array = o.publicFinalIntArray;");
-        assertEquals(o.publicFinalIntArray[0], e.eval("o.publicFinalIntArray[0];"));
-        assertArrayEquals(o.publicFinalIntArray, (int[])e.get("pf_int_array"));
-        e.eval("var tf_int_arr = new (Java.type(\"int[]\"))(3);" +
-                "tf_int_arr[0] = 4;" +
-                "tf_int_arr[1] = 5;" +
-                "tf_int_arr[2] = 6;" +
-                "o.publicFinalIntArray = tf_int_arr;");
-        assertArrayEquals(new int[] { 50, 80, 130, 210, 340 }, o.publicFinalIntArray);
-        e.eval("o.publicFinalIntArray[0] = 100;");
-        assertEquals(100, o.publicFinalIntArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldInt() throws ScriptException {
-        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
-        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
-        e.eval("SharedObject.publicStaticFinalInt = 140;");
-        assertEquals(207182023, SharedObject.publicStaticFinalInt);
-    }
-
-    @Test
-    public void accessStaticFinalFieldIntArray() throws ScriptException {
-        e.eval("var psf_int_array = SharedObject.publicStaticFinalIntArray;");
-        assertEquals(SharedObject.publicStaticFinalIntArray[0], e.eval("SharedObject.publicStaticFinalIntArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalIntArray, (int[])e.get("psf_int_array"));
-        e.eval("var tsf_int_arr = new (Java.type(\"int[]\"))(3);" +
-                "tsf_int_arr[0] = 4;" +
-                "tsf_int_arr[1] = 5;" +
-                "tsf_int_arr[2] = 6;" +
-                "SharedObject.publicStaticFinalIntArray = tsf_int_arr;");
-        assertArrayEquals(new int[] { 1308, 210, 340 }, SharedObject.publicStaticFinalIntArray);
-        e.eval("SharedObject.publicStaticFinalIntArray[0] = 100;");
-        assertEquals(100, SharedObject.publicStaticFinalIntArray[0]);
-    }
-
-    // --------------------------------byte
-    // tests------------------------------------
-    @Test
-    public void accessFieldByte() throws ScriptException {
-        e.eval("var p_byte = o.publicByte;");
-        assertEquals((double)o.publicByte, ((Number)e.get("p_byte")).doubleValue());
-        e.eval("o.publicByte = 16;");
-        assertEquals(16, o.publicByte);
-    }
-
-    @Test
-    public void accessFieldByteArray() throws ScriptException {
-        e.eval("var p_byte_array = o.publicByteArray;");
-        assertEquals(o.publicByteArray[0], e.eval("o.publicByteArray[0];"));
-        assertArrayEquals(o.publicByteArray, (byte[])e.get("p_byte_array"));
-        e.eval("var t_byte_arr = new (Java.type(\"byte[]\"))(3);" +
-                "t_byte_arr[0] = -18;" +
-                "t_byte_arr[1] = 56;" +
-                "t_byte_arr[2] = 60;" +
-                "o.publicByteArray = t_byte_arr;");
-        assertArrayEquals(new byte[] { -18, 56, 60 }, o.publicByteArray);
-        e.eval("o.publicByteArray[0] = 100;");
-        assertEquals(100, o.publicByteArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldByte() throws ScriptException {
-        e.eval("var ps_byte = SharedObject.publicStaticByte;");
-        assertEquals((double)SharedObject.publicStaticByte, ((Number)e.get("ps_byte")).doubleValue());
-        e.eval("SharedObject.publicStaticByte = 16;");
-        assertEquals(16, SharedObject.publicStaticByte);
-    }
-
-    @Test
-    public void accessStaticFieldByteArray() throws ScriptException {
-        e.eval("var ps_byte_array = SharedObject.publicStaticByteArray;");
-        assertEquals(SharedObject.publicStaticByteArray[0], e.eval("SharedObject.publicStaticByteArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticByteArray, (byte[])e.get("ps_byte_array"));
-        e.eval("var ts_byte_arr = new (Java.type(\"byte[]\"))(3);" +
-                "ts_byte_arr[0] = -18;" +
-                "ts_byte_arr[1] = 56;" +
-                "ts_byte_arr[2] = 60;" +
-                "SharedObject.publicStaticByteArray = ts_byte_arr;");
-        assertArrayEquals(new byte[] { -18, 56, 60 }, SharedObject.publicStaticByteArray);
-        e.eval("SharedObject.publicStaticByteArray[0] = -90;");
-        assertEquals(-90, SharedObject.publicStaticByteArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldByte() throws ScriptException {
-        e.eval("var pf_byte = o.publicFinalByte;");
-        assertEquals((double)o.publicFinalByte, ((Number)e.get("pf_byte")).doubleValue());
-        e.eval("o.publicFinalByte = 16;");
-        assertEquals(-7, o.publicFinalByte);
-    }
-
-    @Test
-    public void accessFinalFieldByteArray() throws ScriptException {
-        e.eval("var pf_byte_array = o.publicFinalByteArray;");
-        assertEquals(o.publicFinalByteArray[0], e.eval("o.publicFinalByteArray[0];"));
-        assertArrayEquals(o.publicFinalByteArray, (byte[])e.get("pf_byte_array"));
-        e.eval("var tf_byte_arr = new (Java.type(\"byte[]\"))(3);" +
-                "tf_byte_arr[0] = -18;" +
-                "tf_byte_arr[1] = 56;" +
-                "tf_byte_arr[2] = 60;" +
-                "o.publicFinalByteArray = tf_byte_arr;");
-        assertArrayEquals(new byte[] { 1, 3, 6, 17, -128 }, o.publicFinalByteArray);
-        e.eval("o.publicFinalByteArray[0] = -90;");
-        assertEquals(-90, o.publicFinalByteArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldByte() throws ScriptException {
-        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
-        assertEquals((double)SharedObject.publicStaticFinalByte, ((Number)e.get("psf_byte")).doubleValue());
-        e.eval("SharedObject.publicStaticFinalByte = 16;");
-        assertEquals(-70, SharedObject.publicStaticFinalByte);
-    }
-
-    @Test
-    public void accessStaticFinalFieldByteArray() throws ScriptException {
-        e.eval("var psf_byte_array = SharedObject.publicStaticFinalByteArray;");
-        assertEquals(SharedObject.publicStaticFinalByteArray[0], e.eval("SharedObject.publicStaticFinalByteArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalByteArray, (byte[])e.get("psf_byte_array"));
-        e.eval("var tsf_byte_arr = new (Java.type(\"byte[]\"))(3);" +
-                "tsf_byte_arr[0] = -18;" +
-                "tsf_byte_arr[1] = 56;" +
-                "tsf_byte_arr[2] = 60;" +
-                "SharedObject.publicStaticFinalByteArray = tsf_byte_arr;");
-        assertArrayEquals(new byte[] { 17, -128, 81 }, SharedObject.publicStaticFinalByteArray);
-        e.eval("SharedObject.publicStaticFinalByteArray[0] = -90;");
-        assertEquals(-90, SharedObject.publicStaticFinalByteArray[0]);
-    }
-
-    // --------------------------------short
-    // tests------------------------------------
-    @Test
-    public void accessFieldShort() throws ScriptException {
-        e.eval("var p_short = o.publicShort;");
-        assertEquals((double)o.publicShort, ((Number)e.get("p_short")).doubleValue());
-        e.eval("o.publicShort = 18;");
-        assertEquals(18, o.publicShort);
-    }
-
-    @Test
-    public void accessFieldShortArray() throws ScriptException {
-        e.eval("var p_short_array = o.publicShortArray;");
-        assertEquals(o.publicShortArray[0], e.eval("o.publicShortArray[0];"));
-        assertArrayEquals(o.publicShortArray, (short[])e.get("p_short_array"));
-        e.eval("var t_short_arr = new (Java.type(\"short[]\"))(3);" +
-                "t_short_arr[0] = 90;" +
-                "t_short_arr[1] = 5;" +
-                "t_short_arr[2] = -6000;" +
-                "o.publicShortArray = t_short_arr;");
-        assertArrayEquals(new short[] { 90, 5, -6000 }, o.publicShortArray);
-        e.eval("o.publicShortArray[0] = -1000;");
-        assertEquals(-1000, o.publicShortArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldShort() throws ScriptException {
-        e.eval("var ps_short = SharedObject.publicStaticShort;");
-        assertEquals((double)SharedObject.publicStaticShort, ((Number)e.get("ps_short")).doubleValue());
-        e.eval("SharedObject.publicStaticShort = 180;");
-        assertEquals(180, SharedObject.publicStaticShort);
-    }
-
-    @Test
-    public void accessStaticFieldShortArray() throws ScriptException {
-        e.eval("var ps_short_array = SharedObject.publicStaticShortArray;");
-        assertEquals(SharedObject.publicStaticShortArray[0], e.eval("SharedObject.publicStaticShortArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticShortArray, (short[])e.get("ps_short_array"));
-        e.eval("var ts_short_arr = new (Java.type(\"short[]\"))(3);" +
-                "ts_short_arr[0] = 90;" +
-                "ts_short_arr[1] = 5;" +
-                "ts_short_arr[2] = -6000;" +
-                "SharedObject.publicStaticShortArray = ts_short_arr;");
-        assertArrayEquals(new short[] { 90, 5, -6000 }, SharedObject.publicStaticShortArray);
-        e.eval("SharedObject.publicStaticShortArray[0] = -1000;");
-        assertEquals(-1000, SharedObject.publicStaticShortArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldShort() throws ScriptException {
-        e.eval("var pf_short = o.publicFinalShort;");
-        assertEquals((double)o.publicFinalShort, ((Number)e.get("pf_short")).doubleValue());
-        e.eval("o.publicFinalShort = 180;");
-        assertEquals(31220, o.publicFinalShort);
-    }
-
-    @Test
-    public void accessFinalFieldShortArray() throws ScriptException {
-        e.eval("var pf_short_array = o.publicFinalShortArray;");
-        assertEquals(o.publicFinalShortArray[0], e.eval("o.publicFinalShortArray[0];"));
-        assertArrayEquals(o.publicFinalShortArray, (short[])e.get("pf_short_array"));
-        e.eval("var tf_short_arr = new (Java.type(\"short[]\"))(3);" +
-                "tf_short_arr[0] = 90;" +
-                "tf_short_arr[1] = 5;" +
-                "tf_short_arr[2] = -6000;" +
-                "o.publicFinalShortArray = tf_short_arr;");
-        assertArrayEquals(new short[] { 12240, 9200, -17289, 1200, 12 }, o.publicFinalShortArray);
-        e.eval("o.publicFinalShortArray[0] = -1000;");
-        assertEquals(-1000, o.publicFinalShortArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldShort() throws ScriptException {
-        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
-        assertEquals((double)SharedObject.publicStaticFinalShort, ((Number)e.get("psf_short")).doubleValue());
-        e.eval("SharedObject.publicStaticFinalShort = 180;");
-        assertEquals(8888, SharedObject.publicStaticFinalShort);
-    }
-
-    @Test
-    public void accessStaticFinalFieldShortArray() throws ScriptException {
-        e.eval("var psf_short_array = SharedObject.publicStaticFinalShortArray;");
-        assertEquals(SharedObject.publicStaticFinalShortArray[0], e.eval("SharedObject.publicStaticFinalShortArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalShortArray, (short[])e.get("psf_short_array"));
-        e.eval("var tsf_short_arr = new (Java.type(\"short[]\"))(3);" +
-                "tsf_short_arr[0] = 90;" +
-                "tsf_short_arr[1] = 5;" +
-                "tsf_short_arr[2] = -6000;" +
-                "SharedObject.publicStaticFinalShortArray = tsf_short_arr;");
-        assertArrayEquals(new short[] { 8240, 9280, -1289, 120, 812 }, SharedObject.publicStaticFinalShortArray);
-        e.eval("SharedObject.publicStaticFinalShortArray[0] = -1000;");
-        assertEquals(-1000, SharedObject.publicStaticFinalShortArray[0]);
-    }
-
-    // --------------------------------char
-    // tests------------------------------------
-    @Test
-    public void accessFieldChar() throws ScriptException {
-        e.eval("var p_char = o.publicChar;");
-        assertEquals(o.publicChar, e.get("p_char"));
-        e.eval("o.publicChar = 'S';");
-        assertEquals('S', o.publicChar);
-        e.eval("o.publicChar = 10;");
-        assertEquals(10, o.publicChar);
-        e.eval("try {"
-                + "    o.publicChar = 'Big string';" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "}");
-        assertEquals("Exception thrown", true, e.get("isThrown"));
-        assertEquals(10, o.publicChar);
-    }
-
-    @Test
-    public void accessFieldCharArray() throws ScriptException {
-        e.eval("var p_char_array = o.publicCharArray;");
-        assertEquals(o.publicCharArray[0], e.eval("o.publicCharArray[0];"));
-        assertArrayEquals(o.publicCharArray, (char[])e.get("p_char_array"));
-        e.eval("var t_char_arr = new (Java.type(\"char[]\"))(3);" +
-                "t_char_arr[0] = 'F';" +
-                "t_char_arr[1] = 'o';" +
-                "t_char_arr[2] = 'o';" +
-                "o.publicCharArray = t_char_arr;");
-        assertArrayEquals("Foo".toCharArray(), o.publicCharArray);
-        e.eval("o.publicCharArray[0] = 'Z';");
-        assertEquals('Z', o.publicCharArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldChar() throws ScriptException {
-        e.eval("var ps_char = SharedObject.publicStaticChar;");
-        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
-        e.eval("SharedObject.publicStaticChar = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticChar);
-    }
-
-    @Test
-    public void accessStaticFieldCharArray() throws ScriptException {
-        e.eval("var ps_char_array = SharedObject.publicStaticCharArray;");
-        assertEquals(SharedObject.publicStaticCharArray[0], e.eval("SharedObject.publicStaticCharArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticCharArray, (char[])e.get("ps_char_array"));
-        e.eval("var ts_char_arr = new (Java.type(\"char[]\"))(3);" +
-                "ts_char_arr[0] = 'G';" +
-                "ts_char_arr[1] = 'o';" +
-                "ts_char_arr[2] = 'o';" +
-                "SharedObject.publicStaticCharArray = ts_char_arr;");
-        assertArrayEquals("Goo".toCharArray(), SharedObject.publicStaticCharArray);
-        e.eval("SharedObject.publicStaticCharArray[0] = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticCharArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldChar() throws ScriptException {
-        e.eval("var pf_char = o.publicFinalChar;");
-        assertEquals(o.publicFinalChar, e.get("pf_char"));
-        e.eval("o.publicFinalChar = 'S';");
-        assertEquals('E', o.publicFinalChar);
-    }
-
-    @Test
-    public void accessFinalCharArray() throws ScriptException {
-        e.eval("var pf_char_array = o.publicFinalCharArray;");
-        assertEquals(o.publicFinalCharArray[0], e.eval("o.publicFinalCharArray[0];"));
-        assertArrayEquals(o.publicFinalCharArray, (char[])e.get("pf_char_array"));
-        e.eval("var tf_char_arr = new (Java.type(\"char[]\"))(3);" +
-                "tf_char_arr[0] = 'F';" +
-                "tf_char_arr[1] = 'o';" +
-                "tf_char_arr[2] = 'o';" +
-                "o.publicFinalCharArray = tf_char_arr;");
-        assertArrayEquals("Nashorn hello".toCharArray(), o.publicFinalCharArray);
-        e.eval("o.publicFinalCharArray[0] = 'Z';");
-        assertEquals('Z', o.publicFinalCharArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldChar() throws ScriptException {
-        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
-        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
-        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
-        assertEquals('K', SharedObject.publicStaticFinalChar);
-    }
-
-    @Test
-    public void accessStaticFinalFieldCharArray() throws ScriptException {
-        e.eval("var psf_char_array = SharedObject.publicStaticFinalCharArray;");
-        assertEquals(SharedObject.publicStaticFinalCharArray[0], e.eval("SharedObject.publicStaticFinalCharArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalCharArray, (char[])e.get("psf_char_array"));
-        e.eval("var tsf_char_arr = new (Java.type(\"char[]\"))(3);" +
-                "tsf_char_arr[0] = 'Z';" +
-                "tsf_char_arr[1] = 'o';" +
-                "tsf_char_arr[2] = 'o';" +
-                "SharedObject.publicStaticFinalCharArray = tsf_char_arr;");
-        assertArrayEquals("StaticString".toCharArray(), SharedObject.publicStaticFinalCharArray);
-        e.eval("SharedObject.publicStaticFinalCharArray[0] = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticFinalCharArray[0]);
-    }
-
-    // --------------------------------float
-    // tests------------------------------------
-    @Test
-    public void accessFieldFloat() throws ScriptException {
-        e.eval("var p_float = o.publicFloat;");
-        assertEquals((double)o.publicFloat, ((Number)e.get("p_float")).doubleValue());
-        o.publicFloat = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(o.publicFloat)"));
-        o.publicFloat = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloat"));
-        o.publicFloat = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloat"));
-        e.eval("o.publicFloat = 20;");
-        assertEquals(20, o.publicFloat, 1e-10);
-        e.eval("o.publicFloat = 0.0/0.0;");
-        assertTrue(Float.isNaN(o.publicFloat));
-        e.eval("o.publicFloat = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloat));
-        e.eval("o.publicFloat = -1.0/0.0;");
-        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloat, 1e-10);
-    }
-
-    @Test
-    public void accessFieldFloatArray() throws ScriptException {
-        e.eval("var p_float_array = o.publicFloatArray;");
-        assertEquals(o.publicFloatArray[0], e.eval("o.publicFloatArray[0];"));
-        assertArrayEquals(o.publicFloatArray, (float[])e.get("p_float_array"), 1e-10f);
-        e.eval("var t_float_arr = new (Java.type(\"float[]\"))(3);" +
-                "t_float_arr[0] = 9.0;" +
-                "t_float_arr[1] = 5.12345;" +
-                "t_float_arr[2] = -60.03;" +
-                "o.publicFloatArray = t_float_arr;");
-        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
-        e.eval("o.publicFloatArray[0] = -513.2;");
-        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFieldFloat() throws ScriptException {
-        e.eval("var ps_float = SharedObject.publicStaticFloat;");
-        assertEquals((double)SharedObject.publicStaticFloat, ((Number)e.get("ps_float")).doubleValue());
-        SharedObject.publicStaticFloat = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
-        SharedObject.publicStaticFloat = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
-        SharedObject.publicStaticFloat = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
-        e.eval("SharedObject.publicStaticFloat = 20.0;");
-        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
-        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
-        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-    }
-
-    @Test
-    public void accessStaticFieldFloatArray() throws ScriptException {
-        e.eval("var ps_float_array = SharedObject.publicStaticFloatArray;");
-        assertEquals(SharedObject.publicStaticFloatArray[0], e.eval("SharedObject.publicStaticFloatArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFloatArray, (float[])e.get("ps_float_array"), 1e-10f);
-        e.eval("var ts_float_arr = new (Java.type(\"float[]\"))(3);" +
-                "ts_float_arr[0] = 9.0;" +
-                "ts_float_arr[1] = 5.12345;" +
-                "ts_float_arr[2] = -60.03;" +
-                "SharedObject.publicStaticFloatArray = ts_float_arr;");
-        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
-        e.eval("SharedObject.publicStaticFloatArray[0] = -513.2;");
-        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
-    }
-
-    @Test
-    public void accessFinalFloat() throws ScriptException {
-        e.eval("var pf_float = o.publicFinalFloat;");
-        assertEquals((double)o.publicFinalFloat, ((Number)e.get("pf_float")).doubleValue());
-        e.eval("o.publicFinalFloat = 20.0;");
-        assertEquals(7.72e8f, o.publicFinalFloat, 1e-10);
-    }
-
-    @Test
-    public void accessFinalFloatArray() throws ScriptException {
-        e.eval("var pf_float_array = o.publicFinalFloatArray;");
-        assertEquals(o.publicFinalFloatArray[0], e.eval("o.publicFinalFloatArray[0];"));
-        assertArrayEquals(o.publicFinalFloatArray, (float[])e.get("pf_float_array"), 1e-10f);
-        e.eval("var tf_float_arr = new (Java.type(\"float[]\"))(3);" +
-                "tf_float_arr[0] = 9.0;" +
-                "tf_float_arr[1] = 5.12345;" +
-                "tf_float_arr[2] = -60.03;" +
-                "o.publicFinalFloatArray = tf_float_arr;");
-        assertArrayEquals(new float[] { -131.012f, 189.32f, -31.32e8f, 3.72f }, o.publicFinalFloatArray, 1e-10f);
-        e.eval("o.publicFinalFloatArray[0] = -513.2;");
-        assertEquals(-513.2f, o.publicFinalFloatArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFinalFieldFloat() throws ScriptException {
-        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
-        assertEquals((double)SharedObject.publicStaticFinalFloat, ((Number)e.get("psf_float")).doubleValue());
-        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
-        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
-    }
-
-    @Test
-    public void accessStaticFinalFieldFloatArray() throws ScriptException {
-        e.eval("var psf_float_array = SharedObject.publicStaticFinalFloatArray;");
-        assertEquals(SharedObject.publicStaticFinalFloatArray[0], e.eval("SharedObject.publicStaticFinalFloatArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalFloatArray, (float[])e.get("psf_float_array"), 1e-10f);
-        e.eval("var tsf_float_arr = new (Java.type(\"float[]\"))(3);" +
-                "tsf_float_arr[0] = 9.0;" +
-                "tsf_float_arr[1] = 5.12345;" +
-                "tsf_float_arr[2] = -60.03;" +
-                "SharedObject.publicStaticFinalFloatArray = tsf_float_arr;");
-        assertArrayEquals(new float[] { -8131.012f, 9.32f, -138.32e8f, 0.72f }, SharedObject.publicStaticFinalFloatArray, 1e-10f);
-        e.eval("SharedObject.publicStaticFinalFloatArray[0] = -513.2;");
-        assertEquals(-513.2f, SharedObject.publicStaticFinalFloatArray[0], 1e-10f);
-    }
-
-    // --------------------------------double
-    // tests------------------------------------
-    @Test
-    public void accessFieldDouble() throws ScriptException {
-        e.eval("var p_double = o.publicDouble;");
-        assertEquals(o.publicDouble, e.get("p_double"));
-        o.publicDouble = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(o.publicDouble)"));
-        o.publicDouble = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDouble"));
-        o.publicDouble = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDouble"));
-        e.eval("o.publicDouble = 30;");
-        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDouble));
-        e.eval("o.publicDouble = 0.0/0.0;");
-        assertTrue(Double.isNaN(o.publicDouble));
-        e.eval("o.publicDouble = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
-        e.eval("o.publicDouble = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
-    }
-
-    @Test
-    public void accessFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var p_double_array = o.publicDoubleArray;");
-        assertEquals(o.publicDoubleArray[0], e.eval("o.publicDoubleArray[0];"));
-        assertArrayEquals(o.publicDoubleArray, (double[])e.get("p_double_array"), 1e-10);
-        e.eval("var t_double_arr = new (Java.type(\"double[]\"))(3);" +
-                "t_double_arr[0] = 9e10;" +
-                "t_double_arr[1] = 0.677777;" +
-                "t_double_arr[2] = -0.0000001;" +
-                "o.publicDoubleArray = t_double_arr;");
-        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, o.publicDoubleArray, 1e-10f);
-        e.eval("o.publicDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, o.publicDoubleArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFieldDouble() throws ScriptException {
-        e.eval("var ps_double = SharedObject.publicStaticDouble;");
-        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
-        SharedObject.publicStaticDouble = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
-        SharedObject.publicStaticDouble = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
-        SharedObject.publicStaticDouble = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
-        e.eval("SharedObject.publicStaticDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
-        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-    }
-
-    @Test
-    public void accessStaticFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var ps_double_array = SharedObject.publicStaticDoubleArray;");
-        assertEquals(SharedObject.publicStaticDoubleArray[0], e.eval("SharedObject.publicStaticDoubleArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticDoubleArray, (double[])e.get("ps_double_array"), 1e-10);
-        e.eval("var ts_double_arr = new (Java.type(\"double[]\"))(3);" +
-                "ts_double_arr[0] = 9e10;" +
-                "ts_double_arr[1] = 0.677777;" +
-                "ts_double_arr[2] = -0.0000001;" +
-                "SharedObject.publicStaticDoubleArray = ts_double_arr;");
-        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, SharedObject.publicStaticDoubleArray, 1e-10f);
-        e.eval("SharedObject.publicStaticDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, SharedObject.publicStaticDoubleArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessFinalFieldDouble() throws ScriptException {
-        e.eval("var pf_double = o.publicFinalDouble;");
-        assertEquals(o.publicFinalDouble, e.get("pf_double"));
-        e.eval("o.publicFinalDouble = 30.0;");
-        assertEquals(Double.doubleToLongBits(1.3412e20), Double.doubleToLongBits(o.publicFinalDouble));
-    }
-
-    @Test
-    public void accessFinalFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var pf_double_array = o.publicFinalDoubleArray;");
-        assertEquals(o.publicFinalDoubleArray[0], e.eval("o.publicFinalDoubleArray[0];"));
-        assertArrayEquals(o.publicFinalDoubleArray, (double[])e.get("pf_double_array"), 1e-10);
-        e.eval("var tf_double_arr = new (Java.type(\"double[]\"))(3);" +
-                "tf_double_arr[0] = 9e10;" +
-                "tf_double_arr[1] = 0.677777;" +
-                "tf_double_arr[2] = -0.0000001;" +
-                "o.publicFinalDoubleArray = tf_double_arr;");
-        assertArrayEquals(new double[] { 0.725e80, 0.12e10, 8e-3, 1.00077 }, o.publicFinalDoubleArray, 1e-10f);
-        e.eval("o.publicFinalDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, o.publicFinalDoubleArray[0], 1e-10f);
-    }
-
-    @Test
-    public void accessStaticFinalFieldDouble() throws ScriptException {
-        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
-        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
-        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
-    }
-
-    @Test
-    public void accessStaticFinalFieldDoubleArrayRead() throws ScriptException {
-        e.eval("var psf_double_array = SharedObject.publicStaticFinalDoubleArray;");
-        assertEquals(SharedObject.publicStaticFinalDoubleArray[0], e.eval("SharedObject.publicStaticFinalDoubleArray[0];"));
-        assertArrayEquals(SharedObject.publicStaticFinalDoubleArray, (double[])e.get("psf_double_array"), 1e-10);
-        e.eval("var tsf_double_arr = new (Java.type(\"double[]\"))(3);" +
-                "tsf_double_arr[0] = 9e10;" +
-                "tsf_double_arr[1] = 0.677777;" +
-                "tsf_double_arr[2] = -0.0000001;" +
-                "SharedObject.publicStaticFinalDoubleArray = tsf_double_arr;");
-        assertArrayEquals(new double[] { 8.725e80, 0.82e10, 18e-3, 1.08077 }, SharedObject.publicStaticFinalDoubleArray, 1e-10f);
-        e.eval("SharedObject.publicStaticFinalDoubleArray[0] = -5.2e10;");
-        assertEquals(-5.2e10, SharedObject.publicStaticFinalDoubleArray[0], 1e-10f);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/NumberBoxingTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,365 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.AssertJUnit.assertTrue;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest
- */
-@SuppressWarnings("javadoc")
-public class NumberBoxingTest {
-
-    private static ScriptEngine e;
-    private static SharedObject o;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        o = new SharedObject();
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-        o = null;
-    }
-
-    // --------------------------------long
-    // tests------------------------------------
-    @Test
-    public void accessFieldLongBoxing() throws ScriptException {
-        e.eval("var p_long = o.publicLongBox;");
-        assertEquals(o.publicLongBox, e.get("p_long"));
-        e.eval("o.publicLongBox = 12;");
-        assertEquals(Long.valueOf(12), o.publicLongBox);
-    }
-
-    @Test
-    public void accessStaticFieldLongBoxing() throws ScriptException {
-        e.eval("var ps_long = SharedObject.publicStaticLongBox;");
-        assertEquals(SharedObject.publicStaticLongBox, e.get("ps_long"));
-        e.eval("SharedObject.publicStaticLongBox = 120;");
-        assertEquals(120L, SharedObject.publicStaticLongBox.longValue());
-    }
-
-    @Test
-    public void accessFinalFieldLongBoxing() throws ScriptException {
-        e.eval("var pf_long = o.publicFinalLongBox;");
-        assertEquals(o.publicFinalLongBox, e.get("pf_long"));
-        e.eval("o.publicFinalLongBox = 120;");
-        assertEquals(Long.valueOf(9377333334L), o.publicFinalLongBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldLongBoxing() throws ScriptException {
-        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
-        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
-        e.eval("SharedObject.publicStaticFinalLong = 120;");
-        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
-    }
-
-    // --------------------------------int
-    // tests------------------------------------
-    @Test
-    public void accessFieldIntBoxing() throws ScriptException {
-        e.eval("var p_int = o.publicIntBox;");
-        assertEquals(o.publicIntBox, e.get("p_int"));
-        e.eval("o.publicIntBox = 14;");
-        assertEquals(Integer.valueOf(14), o.publicIntBox);
-    }
-
-    @Test
-    public void accessStaticFieldIntBoxing() throws ScriptException {
-        e.eval("var ps_int = SharedObject.publicStaticInt;");
-        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
-        e.eval("SharedObject.publicStaticInt = 140;");
-        assertEquals(140, SharedObject.publicStaticInt);
-    }
-
-    @Test
-    public void accessFinalFieldIntBoxing() throws ScriptException {
-        e.eval("var pf_int = o.publicFinalIntBox;");
-        assertEquals(o.publicFinalIntBox, e.get("pf_int"));
-        e.eval("o.publicFinalIntBox = 10;");
-        assertEquals(Integer.valueOf(207512301), o.publicFinalIntBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldIntBoxing() throws ScriptException {
-        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
-        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
-        e.eval("SharedObject.publicStaticFinalInt = 140;");
-        assertEquals(207182023, SharedObject.publicStaticFinalInt);
-    }
-
-    // --------------------------------byte
-    // tests------------------------------------
-    @Test
-    public void accessFieldByteBoxing() throws ScriptException {
-        e.eval("var p_byte = o.publicByteBox;");
-        assertEqualsDouble(o.publicByteBox, "p_byte");
-        e.eval("o.publicByteBox = 16;");
-        assertEquals(Byte.valueOf((byte)16), o.publicByteBox);
-    }
-
-    @Test
-    public void accessStaticFieldByteBoxing() throws ScriptException {
-        e.eval("var ps_byte = SharedObject.publicStaticByte;");
-        assertEqualsDouble(SharedObject.publicStaticByte, "ps_byte");
-        e.eval("SharedObject.publicStaticByte = 16;");
-        assertEquals(16, SharedObject.publicStaticByte);
-    }
-
-    @Test
-    public void accessFinalFieldByteBoxing() throws ScriptException {
-        e.eval("var pf_byte = o.publicFinalByteBox;");
-        assertEqualsDouble(o.publicFinalByteBox, "pf_byte");
-        e.eval("o.publicFinalByteBox = 16;");
-        assertEquals(Byte.valueOf((byte)19), o.publicFinalByteBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldByteBoxing() throws ScriptException {
-        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
-        assertEqualsDouble(SharedObject.publicStaticFinalByte, "psf_byte");
-        e.eval("SharedObject.publicStaticFinalByte = 16;");
-        assertEquals(-70, SharedObject.publicStaticFinalByte);
-    }
-
-    // --------------------------------short
-    // tests------------------------------------
-    @Test
-    public void accessFieldShortBoxing() throws ScriptException {
-        e.eval("var p_short = o.publicShortBox;");
-        assertEqualsDouble(o.publicShortBox, "p_short");
-        e.eval("o.publicShortBox = 18;");
-        assertEquals(Short.valueOf((short)18), o.publicShortBox);
-    }
-
-    private static void assertEqualsDouble(final Number n, final String name) {
-        assertEquals(n.doubleValue(), ((Number)e.get(name)).doubleValue());
-    }
-
-    @Test
-    public void accessStaticFieldShortBoxing() throws ScriptException {
-        e.eval("var ps_short = SharedObject.publicStaticShort;");
-        assertEqualsDouble(SharedObject.publicStaticShort, "ps_short");
-        e.eval("SharedObject.publicStaticShort = 180;");
-        assertEquals(180, SharedObject.publicStaticShort);
-    }
-
-    @Test
-    public void accessFinalFieldShortBoxing() throws ScriptException {
-        e.eval("var pf_short = o.publicFinalShortBox;");
-        assertEqualsDouble(o.publicFinalShortBox, "pf_short");
-        e.eval("o.publicFinalShortBox = 180;");
-        assertEquals(Short.valueOf((short)-26777), o.publicFinalShortBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldShortBoxing() throws ScriptException {
-        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
-        assertEqualsDouble(SharedObject.publicStaticFinalShort, "psf_short");
-        e.eval("SharedObject.publicStaticFinalShort = 180;");
-        assertEquals(8888, SharedObject.publicStaticFinalShort);
-    }
-
-    // --------------------------------char
-    // tests------------------------------------
-    @Test
-    public void accessFieldCharBoxing() throws ScriptException {
-        e.eval("var p_char = o.publicCharBox;");
-        assertEquals(o.publicCharBox, e.get("p_char"));
-        e.eval("o.publicCharBox = 'S';");
-        assertEquals(Character.valueOf('S'), o.publicCharBox);
-        e.eval("try {" +
-                "    o.publicCharBox = 'Big string';" +
-                "} catch(e) {" +
-                "    var isThrown = true;" +
-                "}");
-        assertEquals("Exception thrown", true, e.get("isThrown"));
-        assertEquals(Character.valueOf('S'), o.publicCharBox);
-    }
-
-    @Test
-    public void accessStaticFieldCharBoxing() throws ScriptException {
-        e.eval("var ps_char = SharedObject.publicStaticChar;");
-        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
-        e.eval("SharedObject.publicStaticChar = 'Z';");
-        assertEquals('Z', SharedObject.publicStaticChar);
-    }
-
-    @Test
-    public void accessFinalFieldCharBoxing() throws ScriptException {
-        e.eval("var pf_char = o.publicFinalCharBox;");
-        assertEquals(o.publicFinalCharBox, e.get("pf_char"));
-        e.eval("o.publicFinalCharBox = 'S';");
-        assertEquals(Character.valueOf('F'), o.publicFinalCharBox);
-    }
-
-    @Test
-    public void accessStaticFinalFieldCharBoxing() throws ScriptException {
-        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
-        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
-        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
-        assertEquals('K', SharedObject.publicStaticFinalChar);
-    }
-
-    // --------------------------------float
-    // tests------------------------------------
-    @Test
-    public void accessFieldFloatBoxing() throws ScriptException {
-        e.eval("var p_float = o.publicFloatBox;");
-        assertEqualsDouble(o.publicFloatBox, "p_float");
-        o.publicFloatBox = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(o.publicFloatBox)"));
-        o.publicFloatBox = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloatBox"));
-        o.publicFloatBox = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloatBox"));
-        e.eval("o.publicFloatBox = 20;");
-        assertEquals(20, o.publicFloatBox, 1e-10);
-        e.eval("o.publicFloatBox = 0.0/0.0;");
-        assertTrue(Float.isNaN(o.publicFloatBox));
-        e.eval("o.publicFloatBox = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloatBox));
-        e.eval("o.publicFloatBox = -1.0/0.0;");
-        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloatBox, 1e-10);
-    }
-
-    @Test
-    public void accessStaticFieldFloatBoxing() throws ScriptException {
-        e.eval("var ps_float = SharedObject.publicStaticFloat;");
-        assertEqualsDouble(SharedObject.publicStaticFloat, "ps_float");
-        SharedObject.publicStaticFloat = 0.0f / 0.0f;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
-        SharedObject.publicStaticFloat = 1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
-        SharedObject.publicStaticFloat = -1.0f / 0.0f;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
-        e.eval("SharedObject.publicStaticFloat = 20.0;");
-        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
-        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
-        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
-        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
-    }
-
-    @Test
-    public void accessFinalFloatBoxing() throws ScriptException {
-        e.eval("var pf_float = o.publicFinalFloatBox;");
-        assertEqualsDouble(o.publicFinalFloatBox, "pf_float");
-        e.eval("o.publicFinalFloatBox = 20.0;");
-        assertEquals(1.372e4f, o.publicFinalFloatBox, 1e-10);
-    }
-
-    @Test
-    public void accessStaticFinalFieldFloatBoxing() throws ScriptException {
-        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
-        assertEqualsDouble(SharedObject.publicStaticFinalFloat, "psf_float");
-        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
-        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
-    }
-
-    // --------------------------------double
-    // tests------------------------------------
-    @Test
-    public void accessFieldDoubleBoxing() throws ScriptException {
-        e.eval("var p_double = o.publicDoubleBox;");
-        assertEquals(o.publicDoubleBox, e.get("p_double"));
-        o.publicDoubleBox = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(o.publicDoubleBox)"));
-        o.publicDoubleBox = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDoubleBox"));
-        o.publicDoubleBox = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDoubleBox"));
-        e.eval("o.publicDoubleBox = 30;");
-        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDoubleBox));
-        e.eval("o.publicDoubleBox = 0.0/0.0;");
-        assertTrue(Double.isNaN(o.publicDoubleBox));
-        e.eval("o.publicDoubleBox = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
-        e.eval("o.publicDoubleBox = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
-    }
-
-    @Test
-    public void accessStaticFieldDoubleBoxing() throws ScriptException {
-        e.eval("var ps_double = SharedObject.publicStaticDouble;");
-        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
-        SharedObject.publicStaticDouble = 0.0 / 0.0;
-        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
-        SharedObject.publicStaticDouble = 1.0 / 0.0;
-        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
-        SharedObject.publicStaticDouble = -1.0 / 0.0;
-        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
-        e.eval("SharedObject.publicStaticDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
-        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
-        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
-    }
-
-    @Test
-    public void accessFinalFieldDoubleBoxing() throws ScriptException {
-        e.eval("var pf_double = o.publicFinalDoubleBox;");
-        assertEquals(o.publicFinalDoubleBox, e.get("pf_double"));
-        e.eval("o.publicFinalDoubleBox = 30.0;");
-        assertEquals(Double.doubleToLongBits(1.412e-12), Double.doubleToLongBits(o.publicFinalDoubleBox));
-    }
-
-    @Test
-    public void accessStaticFinalFieldDoubleBoxing() throws ScriptException {
-        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
-        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
-        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
-        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/ObjectAccessTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,165 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest
- */
-@SuppressWarnings("javadoc")
-public class ObjectAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = null;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        o = new SharedObject();
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-        o = null;
-    }
-
-    @Test
-    public void accessFieldObject() throws ScriptException {
-        e.eval("var p_object = o.publicObject;");
-        assertEquals(o.publicObject, e.get("p_object"));
-        assertEquals("object", e.eval("typeof p_object;"));
-        e.eval("o.publicObject = new Person(14);");
-        assertEquals(new Person(14), o.publicObject);
-    }
-
-    @Test
-    public void accessFieldObjectArray() throws ScriptException {
-        e.eval("var p_object_array = o.publicObjectArray;");
-        assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]"));
-        assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array"));
-        e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
-                "t_object_arr[0] = new Person(100);" +
-                "t_object_arr[1] = new Person(120);" +
-                "t_object_arr[2] = new Person(140);" +
-                "o.publicObjectArray = t_object_arr;");
-        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, o.publicObjectArray);
-        e.eval("o.publicObjectArray[0] = new Person(10);");
-        assertEquals(new Person(10), o.publicObjectArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldObject() throws ScriptException {
-        e.eval("var ps_object = SharedObject.publicStaticObject;");
-        assertEquals(SharedObject.publicStaticObject, e.get("ps_object"));
-        assertEquals("object", e.eval("typeof ps_object;"));
-        e.eval("SharedObject.publicStaticObject = new Person(16);");
-        assertEquals(new Person(16), SharedObject.publicStaticObject);
-    }
-
-    @Test
-    public void accessStaticFieldObjectArray() throws ScriptException {
-        e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;");
-        assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array"));
-        e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
-                "ts_object_arr[0] = new Person(100);" +
-                "ts_object_arr[1] = new Person(120);" +
-                "ts_object_arr[2] = new Person(140);" +
-                "SharedObject.publicStaticObjectArray = ts_object_arr;");
-        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, SharedObject.publicStaticObjectArray);
-        e.eval("SharedObject.publicStaticObjectArray[0] = new Person(10);");
-        assertEquals(new Person(10), SharedObject.publicStaticObjectArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldObject() throws ScriptException {
-        e.eval("var pf_object = o.publicFinalObject;");
-        assertEquals(o.publicFinalObject, e.get("pf_object"));
-        assertEquals("object", e.eval("typeof pf_object;"));
-        e.eval("o.publicFinalObject = new Person(-999);");
-        assertEquals(new Person(1024), o.publicFinalObject);
-    }
-
-    @Test
-    public void accessFinalFieldObjectArray() throws ScriptException {
-        e.eval("var pf_object_array = o.publicFinalObjectArray;");
-        assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]"));
-        assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array"));
-        e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
-                "tf_object_arr[0] = new Person(100);" +
-                "tf_object_arr[1] = new Person(120);" +
-                "tf_object_arr[2] = new Person(140);" +
-                "o.publicOFinalbjectArray = tf_object_arr;");
-        assertArrayEquals(new Person[] { new Person(-900), new Person(1000), new Person(180) }, o.publicFinalObjectArray);
-        e.eval("o.publicFinalObjectArray[0] = new Person(10);");
-        assertEquals(new Person(10), o.publicFinalObjectArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldObject() throws ScriptException {
-        e.eval("var psf_object = SharedObject.publicStaticFinalObject;");
-        assertEquals(SharedObject.publicStaticFinalObject, e.get("psf_object"));
-        assertEquals("object", e.eval("typeof psf_object;"));
-        e.eval("SharedObject.publicStaticFinalObject = new Person(6);");
-        assertEquals(new Person(2048), SharedObject.publicStaticFinalObject);
-    }
-
-    @Test
-    public void accessStaticFinalFieldObjectArray() throws ScriptException {
-        e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;");
-        assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array"));
-        e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
-                "tsf_object_arr[0] = new Person(100);" +
-                "tsf_object_arr[1] = new Person(120);" +
-                "tsf_object_arr[2] = new Person(140);" +
-                "SharedObject.publicStaticFinalObjectArray = tsf_object_arr;");
-        assertArrayEquals(new Person[] { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) }, SharedObject.publicStaticFinalObjectArray);
-        e.eval("SharedObject.publicStaticFinalObjectArray[0] = new Person(90);");
-        assertEquals(new Person(90), SharedObject.publicStaticFinalObjectArray[0]);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/Person.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-@SuppressWarnings("javadoc")
-public class Person {
-
-    public int id = 0;
-
-    public Person() {
-    }
-
-    public Person(final int code) {
-        this.id = code;
-    }
-
-    @Override
-    public boolean equals(final Object obj) {
-        if (obj != null && obj instanceof Person) {
-            final Person o = (Person)obj;
-            return this.id == o.id;
-        }
-        return false;
-    }
-
-    @Override
-    public int hashCode() {
-        return id;
-    }
-
-    @Override
-    public String toString() {
-        return "Person(" + id + ")";
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/SharedObject.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,467 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import javax.script.Invocable;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-
-@SuppressWarnings("javadoc")
-public class SharedObject {
-
-    // Public fields
-    public String                 publicString                  = "PublicString";
-    public String[]               publicStringArray             = { "ArrayString[0]", "ArrayString[1]", "ArrayString[2]", "ArrayString[3]" };
-    public Person                 publicObject                  = new Person(256);
-    public Person[]               publicObjectArray             = { new Person(4), new Person(-422), new Person(14) };
-    public boolean                publicBoolean                 = true;
-    public boolean[]              publicBooleanArray            = { true, false, false, true };
-    public Boolean                publicBooleanBox              = true;
-    public long                   publicLong                    = 933333333333333333L;
-    public long[]                 publicLongArray               = { 99012333333333L, -124355555L, 89777777777L };
-    public Long                   publicLongBox                 = 9333333333L;
-    public int                    publicInt                     = 2076543123;
-    public int[]                  publicIntArray                = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 };
-    public Integer                publicIntBox                  = 20765123;
-    public byte                   publicByte                    = -128;
-    public byte[]                 publicByteArray               = { 1, 2, 4, 8, 16, 32, 64, 127, -128 };
-    public Byte                   publicByteBox                 = 127;
-    public short                  publicShort                   = 32000;
-    public short[]                publicShortArray              = { 3240, 8900, -16789, 1, 12 };
-    public Short                  publicShortBox                = Short.MIN_VALUE;
-    public float                  publicFloat                   = 0.7f;
-    public float[]                publicFloatArray              = { -32.01f, 89.3f, -1.3e8f, 3.1f };
-    public Float                  publicFloatBox                = 1.377e4f;
-    public double                 publicDouble                  = 1.34e20;
-    public double[]               publicDoubleArray             = { 0.75e80, 8e-43, 1.000077, 0.123e10 };
-    public Double                 publicDoubleBox               = 1.4e-19;
-    public char                   publicChar                    = 'A';
-    public char[]                 publicCharArray               = "Hello Nashorn".toCharArray();
-    public Character              publicCharBox                 = 'B';
-    // Public static fields
-    public static String          publicStaticString            = "PublicStaticString";
-    public static String[]        publicStaticStringArray       = { "StaticArrayString[0]", "StaticArrayString[1]", "StaticArrayString[2]", "StaticArrayString[3]" };
-    public static Person          publicStaticObject            = new Person(512);
-    public static Person[]        publicStaticObjectArray       = { new Person(40), new Person(-22), new Person(18) };
-    public static boolean         publicStaticBoolean           = true;
-    public static boolean[]       publicStaticBooleanArray      = { false, false, false, true };
-    public static Boolean         publicStaticBooleanBox        = true;
-    public static long            publicStaticLong              = 13333333333333333L;
-    public static long[]          publicStaticLongArray         = { 19012333333333L, -224355555L, 39777777777L };
-    public static Long            publicStaticLongBox           = 9333333334L;
-    public static int             publicStaticInt               = 207654323;
-    public static int[]           publicStaticIntArray          = { 5, 8, 13, 21, 34 };
-    public static Integer         publicStaticIntBox            = 2075123;
-    public static byte            publicStaticByte              = -12;
-    public static byte[]          publicStaticByteArray         = { 16, 32, 64, 127, -128 };
-    public static Byte            publicStaticByteBox           = 17;
-    public static short           publicStaticShort             = 320;
-    public static short[]         publicStaticShortArray        = { 1240, 900, -1789, 100, 12 };
-    public static Short           publicStaticShortBox          = -16777;
-    public static float           publicStaticFloat             = 7.7e8f;
-    public static float[]         publicStaticFloatArray        = { -131.01f, 189.3f, -31.3e8f, 3.7f };
-    public static Float           publicStaticFloatBox          = 1.37e4f;
-    public static double          publicStaticDouble            = 1.341e20;
-    public static double[]        publicStaticDoubleArray       = { 0.75e80, 0.123e10, 8e-43, 1.000077 };
-    public static Double          publicStaticDoubleBox         = 1.41e-12;
-    public static char            publicStaticChar              = 'C';
-    public static char[]          publicStaticCharArray         = "Nashorn".toCharArray();
-    public static Character       publicStaticCharBox           = 'D';
-    // Public final fields
-    public final String           publicFinalString             = "PublicFinalString";
-    public final String[]         publicFinalStringArray        = { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" };
-    public final Person           publicFinalObject             = new Person(1024);
-    public final Person[]         publicFinalObjectArray        = { new Person(-900), new Person(1000), new Person(180) };
-    public final boolean          publicFinalBoolean            = true;
-    public final boolean[]        publicFinalBooleanArray       = { false, false, true, false };
-    public final Boolean          publicFinalBooleanBox         = true;
-    public final long             publicFinalLong               = 13353333333333333L;
-    public final long[]           publicFinalLongArray          = { 1901733333333L, -2247355555L, 3977377777L };
-    public final Long             publicFinalLongBox            = 9377333334L;
-    public final int              publicFinalInt                = 20712023;
-    public final int[]            publicFinalIntArray           = { 50, 80, 130, 210, 340 };
-    public final Integer          publicFinalIntBox             = 207512301;
-    public final byte             publicFinalByte               = -7;
-    public final byte[]           publicFinalByteArray          = { 1, 3, 6, 17, -128 };
-    public final Byte             publicFinalByteBox            = 19;
-    public final short            publicFinalShort              = 31220;
-    public final short[]          publicFinalShortArray         = { 12240, 9200, -17289, 1200, 12 };
-    public final Short            publicFinalShortBox           = -26777;
-    public final float            publicFinalFloat              = 7.72e8f;
-    public final float[]          publicFinalFloatArray         = { -131.012f, 189.32f, -31.32e8f, 3.72f };
-    public final Float            publicFinalFloatBox           = 1.372e4f;
-    public final double           publicFinalDouble             = 1.3412e20;
-    public final double[]         publicFinalDoubleArray        = { 0.725e80, 0.12e10, 8e-3, 1.00077 };
-    public final Double           publicFinalDoubleBox          = 1.412e-12;
-    public final char             publicFinalChar               = 'E';
-    public final char[]           publicFinalCharArray          = "Nashorn hello".toCharArray();
-    public final Character        publicFinalCharBox            = 'F';
-    // Public static final fields
-    public static final String    publicStaticFinalString       = "PublicStaticFinalString";
-    public static final String[]  publicStaticFinalStringArray  = { "StaticFinalArrayString[0]", "StaticFinalArrayString[1]", "StaticFinalArrayString[2]", "StaticFinalArrayString[3]" };
-    public static final Person    publicStaticFinalObject       = new Person(2048);
-    public static final Person[]  publicStaticFinalObjectArray  = { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) };
-    public static final boolean   publicStaticFinalBoolean      = true;
-    public static final boolean[] publicStaticFinalBooleanArray = { false, true, false, false };
-    public static final Boolean   publicStaticFinalBooleanBox   = true;
-    public static final long      publicStaticFinalLong         = 8333333333333L;
-    public static final long[]    publicStaticFinalLongArray    = { 19017383333L, -2247358L, 39773787L };
-    public static final Long      publicStaticFinalLongBox      = 9377388334L;
-    public static final int       publicStaticFinalInt          = 207182023;
-    public static final int[]     publicStaticFinalIntArray     = { 1308, 210, 340 };
-    public static final Integer   publicStaticFinalIntBox       = 2078301;
-    public static final byte      publicStaticFinalByte         = -70;
-    public static final byte[]    publicStaticFinalByteArray    = { 17, -128, 81 };
-    public static final Byte      publicStaticFinalByteBox      = 91;
-    public static final short     publicStaticFinalShort        = 8888;
-    public static final short[]   publicStaticFinalShortArray   = { 8240, 9280, -1289, 120, 812 };
-    public static final Short     publicStaticFinalShortBox     = -26;
-    public static final float     publicStaticFinalFloat        = 0.72e8f;
-    public static final float[]   publicStaticFinalFloatArray   = { -8131.012f, 9.32f, -138.32e8f, 0.72f };
-    public static final Float     publicStaticFinalFloatBox     = 1.2e4f;
-    public static final double    publicStaticFinalDouble       = 1.8e12;
-    public static final double[]  publicStaticFinalDoubleArray  = { 8.725e80, 0.82e10, 18e-3, 1.08077 };
-    public static final Double    publicStaticFinalDoubleBox    = 1.5612e-13;
-    public static final char      publicStaticFinalChar         = 'K';
-    public static final char[]    publicStaticFinalCharArray    = "StaticString".toCharArray();
-    public static final Character publicStaticFinalCharBox      = 'L';
-
-    // Special vars
-    public volatile boolean       volatileBoolean               = true;
-    public transient boolean      transientBoolean              = true;
-
-    // For methods testing
-    public boolean                isAccessed                    = false;
-    public volatile boolean       isFinished                    = false;
-
-    private ScriptEngine engine;
-
-    public ScriptEngine getEngine() {
-        return engine;
-    }
-
-    public void setEngine(final ScriptEngine engine) {
-        this.engine = engine;
-    }
-
-    public void voidMethod() {
-        isAccessed = true;
-    }
-
-    public boolean booleanMethod(final boolean arg) {
-        return !arg;
-    }
-
-    public Boolean booleanBoxingMethod(final Boolean arg) {
-        return !arg.booleanValue();
-    }
-
-    public boolean[] booleanArrayMethod(final boolean arg[]) {
-        final boolean[] res = new boolean[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = !arg[i];
-        }
-        return res;
-    }
-
-    public int intMethod(final int arg) {
-        return arg + arg;
-    }
-
-    public Integer intBoxingMethod(final Integer arg) {
-        return arg + arg;
-    }
-
-    public int[] intArrayMethod(final int arg[]) {
-        final int[] res = new int[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public long longMethod(final long arg) {
-        return arg + arg;
-    }
-
-    public Long longBoxingMethod(final Long arg) {
-        return arg + arg;
-    }
-
-    public long[] longArrayMethod(final long[] arg) {
-        final long[] res = new long[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public byte byteMethod(final byte arg) {
-        return (byte)(arg + arg);
-    }
-
-    public Byte byteBoxingMethod(final Byte arg) {
-        return (byte)(arg + arg);
-    }
-
-    public byte[] byteArrayMethod(final byte[] arg) {
-        final byte[] res = new byte[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = (byte)(arg[i] * 2);
-        }
-        return res;
-    }
-
-    public char charMethod(final char arg) {
-        return Character.toUpperCase(arg);
-    }
-
-    public Character charBoxingMethod(final Character arg) {
-        return Character.toUpperCase(arg);
-    }
-
-    public char[] charArrayMethod(final char[] arg) {
-        final char[] res = new char[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = Character.toUpperCase(arg[i]);
-        }
-        return res;
-    }
-
-    public short shortMethod(final short arg) {
-        return (short)(arg + arg);
-    }
-
-    public Short shortBoxingMethod(final Short arg) {
-        return (short)(arg + arg);
-    }
-
-    public short[] shortArrayMethod(final short[] arg) {
-        final short[] res = new short[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = (short)(arg[i] * 2);
-        }
-        return res;
-    }
-
-    public float floatMethod(final float arg) {
-        return arg + arg;
-    }
-
-    public Float floatBoxingMethod(final Float arg) {
-        return arg + arg;
-    }
-
-    public float[] floatArrayMethod(final float[] arg) {
-        final float[] res = new float[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public double doubleMethod(final double arg) {
-        return arg + arg;
-    }
-
-    public Double doubleBoxingMethod(final Double arg) {
-        return arg + arg;
-    }
-
-    public double[] doubleArrayMethod(final double[] arg) {
-        final double[] res = new double[arg.length];
-        for (int i = 0; i < arg.length; i++) {
-            res[i] = arg[i] * 2;
-        }
-        return res;
-    }
-
-    public String stringMethod(final String str) {
-        return str + str;
-    }
-
-    public String[] stringArrayMethod(final String[] arr) {
-        final int l = arr.length;
-        final String[] res = new String[l];
-        for (int i = 0; i < l; i++) {
-            res[i] = arr[l - i - 1];
-        }
-        return res;
-    }
-
-    public Person[] objectArrayMethod(final Person[] arr) {
-        final Person[] res = new Person[arr.length];
-        for (int i = 0; i < arr.length; i++) {
-            res[i] = new Person(i + 100);
-        }
-        return res;
-    }
-
-    public Person objectMethod(final Person t) {
-        t.id *= 2;
-        return t;
-    }
-
-    public int twoParamMethod(final long l, final double d) {
-        return (int)(l + d);
-    }
-
-    public int threeParamMethod(final short s, final long l, final char c) {
-        return (int)(s + l + c);
-    }
-
-    public Person[] twoObjectParamMethod(final Person arg1, final Person arg2) {
-        return new Person[] { arg2, arg1 };
-    }
-
-    public Person[] threeObjectParamMethod(final Person arg1, final Person arg2, final Person arg3) {
-        return new Person[] { arg3, arg2, arg1 };
-    }
-
-    public Person[] eightObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8) {
-        return new Person[] { arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
-    }
-
-    public Person[] nineObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8, final Person arg9) {
-        return new Person[] { arg9, arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
-    }
-
-    public Person[] methodObjectEllipsis(final Person... args) {
-        final int l = args.length;
-        final Person[] res = new Person[l];
-        for (int i = 0; i < l; i++) {
-            res[i] = args[l - i - 1];
-        }
-        return res;
-    }
-
-    public Person[] methodPrimitiveEllipsis(final int... args) {
-        final int l = args.length;
-        final Person[] res = new Person[l];
-        for (int i = 0; i < l; i++) {
-            res[i] = new Person(args[i]);
-        }
-        return res;
-    }
-
-    public Object[] methodMixedEllipsis(final Object... args) {
-        return args;
-    }
-
-    public Object[] methodObjectWithEllipsis(final String arg, final int... args) {
-        final Object[] res = new Object[args.length + 1];
-        res[0] = arg;
-        for (int i = 0; i < args.length; i++) {
-            res[i + 1] = args[i];
-        }
-        return res;
-    }
-
-    public Object[] methodPrimitiveWithEllipsis(final int arg, final long... args) {
-        final Object[] res = new Object[args.length + 1];
-        res[0] = arg;
-        for (int i = 0; i < args.length; i++) {
-            res[i + 1] = args[i];
-        }
-        return res;
-    }
-
-    public Object[] methodMixedWithEllipsis(final String arg1, final int arg2, final Object... args) {
-        final Object[] res = new Object[args.length + 2];
-        res[0] = arg1;
-        res[1] = arg2;
-        System.arraycopy(args, 0, res, 2, args.length);
-        return res;
-    }
-
-    public void methodStartsThread() {
-        isFinished = false;
-
-        final Thread t = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    Thread.sleep(1000);
-                    isFinished = true;
-                } catch (final InterruptedException e) {
-                    e.printStackTrace();
-                }
-            }
-        });
-
-        t.start();
-    }
-
-    public String overloadedMethodDoubleVSint(final int arg) {
-        return "int";
-    }
-
-    public String overloadedMethodDoubleVSint(final double arg) {
-        return "double";
-    }
-
-    public int overloadedMethod(final int arg) {
-        return arg*2;
-    }
-
-    public int overloadedMethod(final String arg) {
-        return arg.length();
-    }
-
-    public int overloadedMethod(final boolean arg) {
-        return (arg) ? 1 : 0;
-    }
-
-    public int overloadedMethod(final Person arg) {
-        return arg.id*2;
-    }
-
-    public int firstLevelMethodInt(final int arg) throws ScriptException, NoSuchMethodException {
-        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInt", arg);
-    }
-
-    public int thirdLevelMethodInt(final int arg) {
-        return arg*5;
-    }
-
-    public int firstLevelMethodInteger(final Integer arg) throws ScriptException, NoSuchMethodException {
-        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInteger", arg);
-    }
-
-    public int thirdLevelMethodInteger(final Integer arg) {
-        return arg*10;
-    }
-
-    public Person firstLevelMethodObject(final Person p) throws ScriptException, NoSuchMethodException {
-        return (Person) ((Invocable)engine).invokeFunction("secondLevelMethodObject", p);
-    }
-
-    public Person thirdLevelMethodObject(final Person p) {
-        p.id *= 10;
-        return p;
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/api/javaaccess/StringAccessTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.javaaccess;
-
-import static org.testng.AssertJUnit.assertEquals;
-import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.TestNG;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest
- * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest
- */
-@SuppressWarnings("javadoc")
-public class StringAccessTest {
-
-    private static ScriptEngine e = null;
-    private static SharedObject o = null;
-
-    public static void main(final String[] args) {
-        TestNG.main(args);
-    }
-
-    @BeforeClass
-    public static void setUpClass() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        e = m.getEngineByName("nashorn");
-        o = new SharedObject();
-        e.put("o", o);
-        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
-    }
-
-    @AfterClass
-    public static void tearDownClass() {
-        e = null;
-        o = null;
-    }
-
-    @Test
-    public void accessFieldString() throws ScriptException {
-        e.eval("var p_string = o.publicString;");
-        assertEquals(o.publicString, e.get("p_string"));
-        assertEquals("string", e.eval("typeof p_string;"));
-        e.eval("o.publicString = 'changedString';");
-        assertEquals("changedString", o.publicString);
-    }
-
-    @Test
-    public void accessFieldStringArray() throws ScriptException {
-        e.eval("var p_string_array = o.publicStringArray;");
-        assertEquals(o.publicStringArray[0], e.eval("o.publicStringArray[0]"));
-        assertArrayEquals(o.publicStringArray, (String[])e.get("p_string_array"));
-        e.eval("var t_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
-                "t_string_arr[0] = 'abc';" +
-                "t_string_arr[1] = '123';" +
-                "t_string_arr[2] = 'xyzzzz';" +
-                "o.publicStringArray = t_string_arr;");
-        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, o.publicStringArray);
-        e.eval("o.publicStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", o.publicStringArray[0]);
-    }
-
-    @Test
-    public void accessStaticFieldString() throws ScriptException {
-        e.eval("var ps_string = SharedObject.publicStaticString;");
-        assertEquals(SharedObject.publicStaticString, e.get("ps_string"));
-        assertEquals("string", e.eval("typeof ps_string;"));
-        e.eval("SharedObject.publicStaticString = 'changedString';");
-        assertEquals("changedString", SharedObject.publicStaticString);
-    }
-
-    @Test
-    public void accessStaticFieldStringArray() throws ScriptException {
-        e.eval("var ps_string_array = SharedObject.publicStaticStringArray;");
-        assertEquals(SharedObject.publicStaticStringArray[0], e.eval("SharedObject.publicStaticStringArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticStringArray, (String[])e.get("ps_string_array"));
-        e.eval("var ts_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
-                "ts_string_arr[0] = 'abc';" +
-                "ts_string_arr[1] = '123';" +
-                "ts_string_arr[2] = 'xyzzzz';" +
-                "SharedObject.publicStaticStringArray = ts_string_arr;");
-        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, SharedObject.publicStaticStringArray);
-        e.eval("SharedObject.publicStaticStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", SharedObject.publicStaticStringArray[0]);
-    }
-
-    @Test
-    public void accessFinalFieldString() throws ScriptException {
-        e.eval("var pf_string = o.publicFinalString;");
-        assertEquals(o.publicFinalString, e.get("pf_string"));
-        assertEquals("string", e.eval("typeof pf_string;"));
-        e.eval("o.publicFinalString = 'changedString';");
-        assertEquals("PublicFinalString", o.publicFinalString);
-    }
-
-    @Test
-    public void accessFinalFieldStringArray() throws ScriptException {
-        e.eval("var pf_string_array = o.publicFinalStringArray;");
-        assertEquals(o.publicFinalStringArray[0], e.eval("o.publicFinalStringArray[0]"));
-        assertArrayEquals(o.publicFinalStringArray, (String[])e.get("pf_string_array"));
-        e.eval("var tf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
-                "tf_string_arr[0] = 'abc';" +
-                "tf_string_arr[1] = '123';" +
-                "tf_string_arr[2] = 'xyzzzz';" +
-                "o.publicFinalStringArray = tf_string_arr;");
-        assertArrayEquals(new String[] { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" }, o.publicFinalStringArray);
-        e.eval("o.publicFinalStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", o.publicFinalStringArray[0]);
-    }
-
-    @Test
-    public void accessStaticFinalFieldString() throws ScriptException {
-        e.eval("var psf_string = SharedObject.publicStaticFinalString;");
-        assertEquals(SharedObject.publicStaticFinalString, e.get("psf_string"));
-        assertEquals("string", e.eval("typeof psf_string;"));
-        e.eval("SharedObject.publicStaticFinalString = 'changedString';");
-        assertEquals("PublicStaticFinalString", SharedObject.publicStaticFinalString);
-    }
-
-    @Test
-    public void accessStaticFinalFieldStringArray() throws ScriptException {
-        e.eval("var psf_string_array = SharedObject.publicStaticFinalStringArray;");
-        assertEquals(SharedObject.publicStaticFinalStringArray[0], e.eval("SharedObject.publicStaticFinalStringArray[0]"));
-        assertArrayEquals(SharedObject.publicStaticFinalStringArray, (String[])e.get("psf_string_array"));
-        e.eval("var tsf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
-                "tsf_string_arr[0] = 'abc';" +
-                "tsf_string_arr[1] = '123';" +
-                "tsf_string_arr[2] = 'xyzzzz';" +
-                "SharedObject.publicStaticFinalStringArray = tsf_string_arr;");
-        assertArrayEquals(new String[] { "StaticFinalArrayString[0]",
-                    "StaticFinalArrayString[1]",
-                    "StaticFinalArrayString[2]",
-                    "StaticFinalArrayString[3]" },
-                SharedObject.publicStaticFinalStringArray);
-        e.eval("SharedObject.publicStaticFinalStringArray[0] = 'nashorn';");
-        assertEquals("nashorn", SharedObject.publicStaticFinalStringArray[0]);
-    }
-
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ArrayConversionTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,235 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+import static org.testng.AssertJUnit.assertNull;
+import static org.testng.AssertJUnit.assertTrue;
+import java.util.Arrays;
+import java.util.List;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadoc")
+public class ArrayConversionTest {
+    private static ScriptEngine e = null;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+        e = new ScriptEngineManager().getEngineByName("nashorn");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+    }
+
+    @Test
+    public void testIntArrays() throws ScriptException {
+        runTest("assertNullIntArray", "null");
+        runTest("assertEmptyIntArray", "[]");
+        runTest("assertSingle42IntArray", "[42]");
+        runTest("assertSingle42IntArray", "['42']");
+        runTest("assertIntArrayConversions", "[false, true, NaN, Infinity, -Infinity, 0.4, 0.6, null, undefined, [], {}, [1], [1, 2]]");
+    }
+
+    @Test
+    public void testIntIntArrays() throws ScriptException {
+        runTest("assertNullIntIntArray", "null");
+        runTest("assertEmptyIntIntArray", "[]");
+        runTest("assertSingleEmptyIntIntArray", "[[]]");
+        runTest("assertSingleNullIntIntArray", "[null]");
+        runTest("assertLargeIntIntArray", "[[false], [1], [2, 3], [4, 5, 6], ['7', {valueOf: function() { return 8 }}]]");
+    }
+
+    @Test
+    public void testObjectObjectArrays() throws ScriptException {
+        runTest("assertLargeObjectObjectArray", "[[false], [1], ['foo', 42.3], [{x: 17}]]");
+    }
+
+    @Test
+    public void testBooleanArrays() throws ScriptException {
+        runTest("assertBooleanArrayConversions", "[false, true, '', 'false', 0, 1, 0.4, 0.6, {}, [], [false], [true], NaN, Infinity, null, undefined]");
+    }
+
+    @Test
+    public void testArrayAmbiguity() throws ScriptException {
+        runTest("x", "'abc'");
+        runTest("x", "['foo', 'bar']");
+    }
+
+    @Test
+    public void testListArrays() throws ScriptException {
+        runTest("assertListArray", "[['foo', 'bar'], ['apple', 'orange']]");
+    }
+
+    @Test
+    public void testVarArgs() throws ScriptException {
+        // Sole NativeArray in vararg position becomes vararg array itself
+        runTest("assertVarArg_42_17", "[42, 17]");
+        // NativeArray in vararg position becomes an argument if there are more arguments
+        runTest("assertVarArg_array_17", "[42], 18");
+        // Only NativeArray is converted to vararg array, other objects (e.g. a function) aren't
+        runTest("assertVarArg_function", "function() { return 'Hello' }");
+    }
+
+    private static void runTest(final String testMethodName, final String argument) throws ScriptException {
+        e.eval("Java.type('" + ArrayConversionTest.class.getName() + "')." + testMethodName + "(" + argument + ")");
+    }
+
+    public static void assertNullIntArray(final int[] array) {
+        assertNull(array);
+    }
+
+    public static void assertNullIntIntArray(final int[][] array) {
+        assertNull(array);
+    }
+
+    public static void assertEmptyIntArray(final int[] array) {
+        assertEquals(0, array.length);
+    }
+
+    public static void assertSingle42IntArray(final int[] array) {
+        assertEquals(1, array.length);
+        assertEquals(42, array[0]);
+    }
+
+
+    public static void assertIntArrayConversions(final int[] array) {
+        assertEquals(13, array.length);
+        assertEquals(0, array[0]); // false
+        assertEquals(1, array[1]); // true
+        assertEquals(0, array[2]); // NaN
+        assertEquals(0, array[3]); // Infinity
+        assertEquals(0, array[4]); // -Infinity
+        assertEquals(0, array[5]); // 0.4
+        assertEquals(0, array[6]); // 0.6 - floor, not round
+        assertEquals(0, array[7]); // null
+        assertEquals(0, array[8]); // undefined
+        assertEquals(0, array[9]); // []
+        assertEquals(0, array[10]); // {}
+        assertEquals(1, array[11]); // [1]
+        assertEquals(0, array[12]); // [1, 2]
+    }
+
+    public static void assertEmptyIntIntArray(final int[][] array) {
+        assertEquals(0, array.length);
+    }
+
+    public static void assertSingleEmptyIntIntArray(final int[][] array) {
+        assertEquals(1, array.length);
+        assertTrue(Arrays.equals(new int[0], array[0]));
+    }
+
+    public static void assertSingleNullIntIntArray(final int[][] array) {
+        assertEquals(1, array.length);
+        assertNull(null, array[0]);
+    }
+
+    public static void assertLargeIntIntArray(final int[][] array) {
+        assertEquals(5, array.length);
+        assertTrue(Arrays.equals(new int[] { 0 }, array[0]));
+        assertTrue(Arrays.equals(new int[] { 1 }, array[1]));
+        assertTrue(Arrays.equals(new int[] { 2, 3 }, array[2]));
+        assertTrue(Arrays.equals(new int[] { 4, 5, 6 }, array[3]));
+        assertTrue(Arrays.equals(new int[] { 7, 8 }, array[4]));
+    }
+
+    public static void assertLargeObjectObjectArray(final Object[][] array) throws ScriptException {
+        assertEquals(4, array.length);
+        assertTrue(Arrays.equals(new Object[] { Boolean.FALSE }, array[0]));
+        assertTrue(Arrays.equals(new Object[] { 1 }, array[1]));
+        assertTrue(Arrays.equals(new Object[] { "foo", 42.3d }, array[2]));
+        assertEquals(1, array[3].length);
+        e.getBindings(ScriptContext.ENGINE_SCOPE).put("obj", array[3][0]);
+        assertEquals(17, e.eval("obj.x"));
+    }
+
+    public static void assertBooleanArrayConversions(final boolean[] array) {
+        assertEquals(16, array.length);
+        assertFalse(array[0]); // false
+        assertTrue(array[1]); // true
+        assertFalse(array[2]); // ''
+        assertTrue(array[3]); // 'false' (yep, every non-empty string converts to true)
+        assertFalse(array[4]); // 0
+        assertTrue(array[5]); // 1
+        assertTrue(array[6]); // 0.4
+        assertTrue(array[7]); // 0.6
+        assertTrue(array[8]); // {}
+        assertTrue(array[9]); // []
+        assertTrue(array[10]); // [false]
+        assertTrue(array[11]); // [true]
+        assertFalse(array[12]); // NaN
+        assertTrue(array[13]); // Infinity
+        assertFalse(array[14]); // null
+        assertFalse(array[15]); // undefined
+    }
+
+    public static void assertListArray(final List<?>[] array) {
+        assertEquals(2, array.length);
+        assertEquals(Arrays.asList("foo", "bar"), array[0]);
+        assertEquals(Arrays.asList("apple", "orange"), array[1]);
+    }
+
+    public static void assertVarArg_42_17(final Object... args) {
+        assertEquals(2, args.length);
+        assertEquals(42, ((Number)args[0]).intValue());
+        assertEquals(17, ((Number)args[1]).intValue());
+    }
+
+    public static void assertVarArg_array_17(final Object... args) throws ScriptException {
+        assertEquals(2, args.length);
+        e.getBindings(ScriptContext.ENGINE_SCOPE).put("arr", args[0]);
+        assertTrue((Boolean)e.eval("arr instanceof Array && arr.length == 1 && arr[0] == 42"));
+        assertEquals(18, ((Number)args[1]).intValue());
+    }
+
+    public static void assertVarArg_function(final Object... args) throws ScriptException {
+        assertEquals(1, args.length);
+        e.getBindings(ScriptContext.ENGINE_SCOPE).put("fn", args[0]);
+        assertEquals("Hello", e.eval("fn()"));
+    }
+
+
+
+    public static void x(final String y) {
+        assertEquals("abc", y);
+    }
+    public static void x(final String[] y) {
+        assertTrue(Arrays.equals(new String[] { "foo", "bar"}, y));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/BooleanAccessTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import java.util.Arrays;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.BooleanAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.BooleanAccessTest
+ */
+@SuppressWarnings("javadoc")
+public class BooleanAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = null;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        o = new SharedObject();
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+        o = null;
+    }
+
+    @Test
+    public void accessFieldBoolean() throws ScriptException {
+        e.eval("var p_boolean = o.publicBoolean;");
+        assertEquals(o.publicBoolean, e.get("p_boolean"));
+        assertEquals("boolean", e.eval("typeof p_boolean;"));
+        e.eval("o.publicBoolean = false;");
+        assertEquals(false, o.publicBoolean);
+    }
+
+    @Test
+    public void accessFieldBooleanArray() throws ScriptException {
+        e.eval("var p_boolean_array = o.publicBooleanArray;");
+        assertEquals(o.publicBooleanArray[0], e.eval("o.publicBooleanArray[0]"));
+        assertTrue(Arrays.equals(o.publicBooleanArray, (boolean[])e.get("p_boolean_array")));
+        e.eval("var t_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
+                "t_boolean_arr[0] = true;" +
+                "t_boolean_arr[1] = false;" +
+                "t_boolean_arr[2] = false;" +
+                "o.publicBooleanArray = t_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { true, false, false }, o.publicBooleanArray));
+        e.eval("o.publicBooleanArray[0] = false;");
+        assertEquals(false, o.publicBooleanArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldBoolean() throws ScriptException {
+        e.eval("var ps_boolean = SharedObject.publicStaticBoolean;");
+        assertEquals(SharedObject.publicStaticBoolean, e.get("ps_boolean"));
+        assertEquals("boolean", e.eval("typeof ps_boolean;"));
+        e.eval("SharedObject.publicStaticBoolean = false;");
+        assertEquals(false, SharedObject.publicStaticBoolean);
+    }
+
+    @Test
+    public void accessStaticFieldBooleanArray() throws ScriptException {
+        e.eval("var ps_boolean_array = SharedObject.publicStaticBooleanArray;");
+        assertEquals(SharedObject.publicStaticBooleanArray[0], e.eval("SharedObject.publicStaticBooleanArray[0]"));
+        assertTrue(Arrays.equals(SharedObject.publicStaticBooleanArray, (boolean[])e.get("ps_boolean_array")));
+        e.eval("var ts_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
+                "ts_boolean_arr[0] = true;" +
+                "ts_boolean_arr[1] = false;" +
+                "ts_boolean_arr[2] = true;" +
+                "SharedObject.publicStaticBooleanArray = ts_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { true, false, true }, SharedObject.publicStaticBooleanArray));
+        e.eval("SharedObject.publicStaticBooleanArray[0] = false;");
+        assertEquals(false, SharedObject.publicStaticBooleanArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldBoolean() throws ScriptException {
+        e.eval("var pf_boolean = o.publicFinalBoolean;");
+        assertEquals(o.publicFinalBoolean, e.get("pf_boolean"));
+        assertEquals("boolean", e.eval("typeof pf_boolean;"));
+        e.eval("o.publicFinalBoolean = false;");
+        assertEquals(true, o.publicFinalBoolean);
+    }
+
+    @Test
+    public void accessFinalFieldBooleanArray() throws ScriptException {
+        e.eval("var pf_boolean_array = o.publicFinalBooleanArray;");
+        assertEquals(o.publicFinalBooleanArray[0], e.eval("o.publicFinalBooleanArray[0]"));
+        assertTrue(Arrays.equals(o.publicFinalBooleanArray, (boolean[])e.get("pf_boolean_array")));
+        e.eval("var tf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
+                "tf_boolean_arr[0] = false;" +
+                "tf_boolean_arr[1] = false;" +
+                "tf_boolean_arr[2] = true;" +
+                "o.publicOFinalbjectArray = tf_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { false, false, true, false }, o.publicFinalBooleanArray));
+        e.eval("o.publicFinalBooleanArray[0] = true;");
+        assertEquals(true, o.publicFinalBooleanArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldBoolean() throws ScriptException {
+        e.eval("var psf_boolean = SharedObject.publicStaticFinalBoolean;");
+        assertEquals(SharedObject.publicStaticFinalBoolean, e.get("psf_boolean"));
+        assertEquals("boolean", e.eval("typeof psf_boolean;"));
+        e.eval("SharedObject.publicStaticFinalBoolean = false;");
+        assertEquals(true, SharedObject.publicStaticFinalBoolean);
+    }
+
+    @Test
+    public void accessStaticFinalFieldBooleanArray() throws ScriptException {
+        e.eval("var psf_boolean_array = SharedObject.publicStaticFinalBooleanArray;");
+        assertEquals(SharedObject.publicStaticFinalBooleanArray[0], e.eval("SharedObject.publicStaticFinalBooleanArray[0]"));
+        assertTrue(Arrays.equals(SharedObject.publicStaticFinalBooleanArray, (boolean[])e.get("psf_boolean_array")));
+        e.eval("var tsf_boolean_arr = new (Java.type(\"boolean[]\"))(3);" +
+                "tsf_boolean_arr[0] = false;" +
+                "tsf_boolean_arr[1] = true;" +
+                "tsf_boolean_arr[2] = false;" +
+                "SharedObject.publicStaticFinalBooleanArray = tsf_boolean_arr;");
+        assertTrue(Arrays.equals(new boolean[] { false, true, false, false }, SharedObject.publicStaticFinalBooleanArray));
+        e.eval("SharedObject.publicStaticFinalBooleanArray[0] = true;");
+        assertEquals(true, SharedObject.publicStaticFinalBooleanArray[0]);
+    }
+
+    @Test
+    public void accessFieldBooleanBoxing() throws ScriptException {
+        e.eval("var p_boolean_box = o.publicBooleanBox;");
+        assertEquals(o.publicBooleanBox, e.get("p_boolean_box"));
+        assertEquals("boolean", e.eval("typeof p_boolean_box;"));
+        e.eval("o.publicBooleanBox = false;");
+        assertEquals(false, (boolean)o.publicBooleanBox);
+    }
+
+    @Test
+    public void accessStaticFieldBooleanBoxing() throws ScriptException {
+        e.eval("var ps_boolean_box = SharedObject.publicStaticBooleanBox;");
+        assertEquals(SharedObject.publicStaticBooleanBox, e.get("ps_boolean_box"));
+        assertEquals("boolean", e.eval("typeof ps_boolean_box;"));
+        e.eval("SharedObject.publicStaticBooleanBox = false;");
+        assertEquals(false, (boolean)SharedObject.publicStaticBooleanBox);
+    }
+
+    @Test
+    public void accessFinalFieldBooleanBoxing() throws ScriptException {
+        e.eval("var pf_boolean_box = o.publicFinalBooleanBox;");
+        assertEquals(o.publicFinalBooleanBox, e.get("pf_boolean_box"));
+        assertEquals("boolean", e.eval("typeof pf_boolean_box;"));
+        e.eval("o.publicFinalBooleanBox = false;");
+        assertEquals(true, (boolean)o.publicFinalBooleanBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldBooleanBoxing() throws ScriptException {
+        e.eval("var psf_boolean_box = SharedObject.publicStaticFinalBooleanBox;");
+        assertEquals(SharedObject.publicStaticFinalBooleanBox, e.get("psf_boolean_box"));
+        assertEquals("boolean", e.eval("typeof psf_boolean_box;"));
+        e.eval("SharedObject.publicStaticFinalBooleanBox = false;");
+        assertEquals(true, (boolean)SharedObject.publicStaticFinalBooleanBox);
+    }
+
+    @Test
+    public void accessVolatileField() throws ScriptException {
+        e.eval("var pv_boolean = o.volatileBoolean;");
+        assertEquals(o.volatileBoolean, e.get("pv_boolean"));
+        assertEquals("boolean", e.eval("typeof pv_boolean;"));
+        e.eval("o.volatileBoolean = false;");
+        assertEquals(false, o.volatileBoolean);
+    }
+
+    @Test
+    public void accessTransientField() throws ScriptException {
+        e.eval("var pt_boolean = o.transientBoolean;");
+        assertEquals(o.transientBoolean, e.get("pt_boolean"));
+        assertEquals("boolean", e.eval("typeof pt_boolean;"));
+        e.eval("o.transientBoolean = false;");
+        assertEquals(false, o.transientBoolean);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ConsStringTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import java.util.HashMap;
+import java.util.Map;
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.JSObject;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadoc")
+public class ConsStringTest {
+    private static ScriptEngine e = null;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() {
+        e = new ScriptEngineManager().getEngineByName("nashorn");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+    }
+
+    @Test
+    public void testConsStringFlattening() throws ScriptException {
+        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
+        final Map<Object, Object> m = new HashMap<>();
+        b.put("m", m);
+        e.eval("var x = 'f'; x += 'oo'; var y = 'b'; y += 'ar'; m.put(x, y)");
+        assertEquals("bar", m.get("foo"));
+    }
+
+    @Test
+    public void testConsStringFromMirror() throws ScriptException {
+        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
+        //final Map<Object, Object> m = new HashMap<>();
+        e.eval("var x = 'f'; x += 'oo'; var obj = {x: x};");
+        assertEquals("foo", ((JSObject)b.get("obj")).getMember("x"));
+    }
+
+    @Test
+    public void testArrayConsString() throws ScriptException {
+        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
+        final ArrayHolder h = new ArrayHolder();
+        b.put("h", h);
+        e.eval("var x = 'f'; x += 'oo'; h.array = [x];");
+        assertEquals(1, h.array.length);
+        assertEquals("foo", h.array[0]);
+    }
+
+
+    public static class ArrayHolder {
+        private Object[] array;
+
+        public void setArray(final Object[] array) {
+            this.array = array;
+        }
+
+        public Object[] getArray() {
+            return array;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/MethodAccessTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,466 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Locale;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.MethodAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.MethodAccessTest
+ */
+@SuppressWarnings("javadoc")
+public class MethodAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = null;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        o = new SharedObject();
+        o.setEngine(e);
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+        o = null;
+    }
+
+    @Test
+    public void accessMethodthrowsCheckedException() throws ScriptException {
+        e.eval("try {" +
+                "    var a = java.lang.Long.parseLong('foo');" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "    var isNumberException = e instanceof java.lang.NumberFormatException;" +
+                "} finally {" +
+                "    var isFinalized = true;" +
+                "}");
+        assertEquals("Exception thrown", true, e.get("isThrown"));
+        assertEquals("Finally called", true, e.get("isFinalized"));
+        assertEquals("Type is NumberFormatException", true, e.get("isNumberException"));
+    }
+
+    @Test
+    public void accessMethodthrowsUnCheckedException() throws ScriptException {
+        e.eval("try {" +
+                "    var a = java.lang.String.valueOf(null);" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "    var isNumberException = e instanceof java.lang.NullPointerException;" +
+                "} finally {" +
+                "    var isFinalized = true;" +
+                "}");
+        assertEquals(true, e.get("isThrown"));
+        assertEquals(true, e.get("isFinalized"));
+        assertEquals(true, e.get("isNumberException"));
+    }
+
+    @Test
+    public void accessMethodStartsThread() throws ScriptException {
+        e.eval("o.methodStartsThread();");
+        assertEquals(false, o.isFinished);
+    }
+
+    @Test
+    public void accessStaticMethod() throws ScriptException {
+        assertEquals(10, e.eval("java.lang.Math.abs(-10);"));
+    }
+
+    @Test
+    public void accessSynchronousMethod() throws ScriptException {
+        e.eval("var v = new java.util.Vector();" + "v.add(10);" + "v.add(20);" + "v.add(30);");
+        assertEquals(10, e.eval("v[0]"));
+        assertEquals(20, e.eval("v[1]"));
+        assertEquals(30, e.eval("v[2]"));
+        assertEquals(3, e.eval("v.size()"));
+    }
+
+    @Test
+    public void accessStaticSynchronousMethod() throws ScriptException {
+        e.eval("var locales = java.util.Calendar.getAvailableLocales();");
+        final Locale[] locales = (Locale[])e.get("locales");
+        assertEquals(locales.length, Calendar.getAvailableLocales().length);
+    }
+
+    @Test
+    public void accessNativeMethod() throws ScriptException {
+        assertEquals(4.0, e.eval("java.lang.StrictMath.log10(10000);"));
+    }
+
+    @Test
+    public void accessConstructorOfAbstractClass() throws ScriptException {
+        e.eval("try {" +
+                "    var a = new java.util.AbstractList();" +
+                "    print('fail');" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "}");
+        assertEquals(true, e.get("isThrown"));
+    }
+
+    @Test
+    public void accessMethodVoid() throws ScriptException {
+        o.isAccessed = false;
+        e.eval("o.voidMethod();");
+        assertTrue(o.isAccessed);
+    }
+
+    @Test
+    public void accessMethodBoolean() throws ScriptException {
+        assertEquals(true, e.eval("o.booleanMethod(false);"));
+        assertEquals(false, e.eval("o.booleanMethod(true);"));
+        assertEquals(false, e.eval("o.booleanMethod('false');"));
+        assertEquals(true, e.eval("o.booleanMethod('');"));
+        assertEquals(true, e.eval("o.booleanMethod(0);"));
+    }
+
+    @Test
+    public void accessMethodInt() throws ScriptException {
+        assertEquals(0, e.eval("o.intMethod(0);"));
+        assertEquals(-200, e.eval("o.intMethod(-100);"));
+        assertEquals(0, e.eval("o.intMethod('0');"));
+        assertEquals(-200, e.eval("o.intMethod('-100');"));
+    }
+
+    @Test
+    public void accessMethodLong() throws ScriptException {
+        assertEquals((long)0, e.eval("o.longMethod(0);"));
+        assertEquals((long)400, e.eval("o.longMethod(200);"));
+        assertEquals((long) 0, e.eval("o.longMethod('0');"));
+        assertEquals((long) 400, e.eval("o.longMethod('200');"));
+    }
+
+    @Test
+    public void accessMethodByte() throws ScriptException {
+        assertEquals((byte) 0, e.eval("o.byteMethod(0);"));
+        assertEquals((byte) 10, e.eval("o.byteMethod(5);"));
+        assertEquals((byte) 0, e.eval("o.byteMethod('0');"));
+        assertEquals((byte) 10, e.eval("o.byteMethod('5');"));
+    }
+
+    @Test
+    public void accessMethodShort() throws ScriptException {
+        assertEquals((short)0, e.eval("o.shortMethod(0);"));
+        assertEquals((short)8000, e.eval("o.shortMethod(4000);"));
+        assertEquals((short) 0, e.eval("o.shortMethod('0');"));
+        assertEquals((short) 8000, e.eval("o.shortMethod('4000');"));
+    }
+
+    @Test
+    public void accessMethodChar() throws ScriptException {
+        assertEquals('A', e.eval("o.charMethod('a');"));
+        assertEquals('Z', e.eval("o.charMethod('z');"));
+        assertEquals(o.charMethod((char)0), e.eval("o.charMethod(0);"));
+        assertEquals(o.charMethod((char)3150), e.eval("o.charMethod(3150);"));
+    }
+
+    @Test
+    public void accessMethodFloat() throws ScriptException {
+        assertEquals(0.0f, e.eval("o.floatMethod(0.0);"));
+        assertEquals(4.2f, e.eval("o.floatMethod(2.1);"));
+        assertEquals(0.0f, e.eval("o.floatMethod('0.0');"));
+        assertEquals(4.2f, e.eval("o.floatMethod('2.1');"));
+    }
+
+    @Test
+    public void accessMethodDouble() throws ScriptException {
+        assertEquals(0.0, e.eval("o.doubleMethod(0.0);"));
+        assertEquals(14.0, e.eval("o.doubleMethod(7.0);"));
+        assertEquals(0.0, e.eval("o.doubleMethod('0.0');"));
+        assertEquals(14.0, e.eval("o.doubleMethod('7.0');"));
+    }
+
+    @Test
+    public void accessMethodBooleanBoxing() throws ScriptException {
+        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.FALSE);"));
+        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod(java.lang.Boolean.TRUE);"));
+        assertEquals(Boolean.TRUE, e.eval("o.booleanBoxingMethod('');"));
+        assertEquals(Boolean.FALSE, e.eval("o.booleanBoxingMethod('false');"));
+    }
+
+    @Test
+    public void accessMethodIntBoxing() throws ScriptException {
+        assertEquals(0, e.eval("o.intBoxingMethod(0);"));
+        assertEquals(-200, e.eval("o.intBoxingMethod(-100);"));
+        assertTrue((int)e.eval("(new java.lang.Integer(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodLongBoxing() throws ScriptException {
+        assertEquals((long) 0, e.eval("o.longBoxingMethod(0);"));
+        assertEquals((long) 400, e.eval("o.longBoxingMethod(200);"));
+        assertTrue((int)e.eval("(new java.lang.Long(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodByteBoxing() throws ScriptException {
+        assertEquals((byte) 0, e.eval("o.byteBoxingMethod(0);"));
+        assertEquals((byte) 10, e.eval("o.byteBoxingMethod(5);"));
+        assertTrue((int)e.eval("(new java.lang.Byte(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodShortBoxing() throws ScriptException {
+        assertEquals((short) 0, e.eval("o.shortBoxingMethod(0);"));
+        assertEquals((short) 8000, e.eval("o.shortBoxingMethod(4000);"));
+        assertTrue((int)e.eval("(new java.lang.Short(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodCharBoxing() throws ScriptException {
+        assertEquals('A', e.eval("o.charBoxingMethod('a');"));
+        assertEquals('Z', e.eval("o.charBoxingMethod('z');"));
+        assertTrue((int)e.eval("(new java.lang.Character(2)).compareTo(10)") < 0);
+    }
+
+    @Test
+    public void accessMethodFloatBoxing() throws ScriptException {
+        assertEquals(0.0f, e.eval("o.floatBoxingMethod(0.0);"));
+        assertEquals(4.2f, e.eval("o.floatBoxingMethod(2.1);"));
+        assertTrue((int)e.eval("(new java.lang.Float(2.0)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodDoubleBoxing() throws ScriptException {
+        assertEquals(0.0, e.eval("o.doubleBoxingMethod(0.0);"));
+        assertEquals(14.0, e.eval("o.doubleBoxingMethod(7.0);"));
+        assertTrue((int)e.eval("(new java.lang.Double(2)).compareTo(10.0)") < 0);
+    }
+
+    @Test
+    public void accessMethodString() throws ScriptException {
+        assertEquals("", e.eval("o.stringMethod('');"));
+        assertEquals("abcabc", e.eval("o.stringMethod('abc');"));
+    }
+
+    @Test
+    public void accessMethodObject() throws ScriptException {
+        e.put("so", new Person(5));
+        e.eval("var rso = o.objectMethod(so);");
+        assertEquals(new Person(10), e.get("rso"));
+    }
+
+    @Test
+    public void accessMethodBooleanArray() throws ScriptException {
+        assertTrue(Arrays.equals(o.booleanArrayMethod(o.publicBooleanArray), (boolean[])e.eval("o.booleanArrayMethod(o.publicBooleanArray);")));
+    }
+
+    @Test
+    public void accessMethodIntArray() throws ScriptException {
+        assertArrayEquals(o.intArrayMethod(o.publicIntArray), (int[])e.eval("o.intArrayMethod(o.publicIntArray);"));
+    }
+
+    @Test
+    public void accessMethodLongArray() throws ScriptException {
+        assertArrayEquals(o.longArrayMethod(o.publicLongArray), (long[])e.eval("o.longArrayMethod(o.publicLongArray);"));
+    }
+
+    @Test
+    public void accessMethodByteArray() throws ScriptException {
+        assertArrayEquals(o.byteArrayMethod(o.publicByteArray), (byte[])e.eval("o.byteArrayMethod(o.publicByteArray);"));
+    }
+
+    @Test
+    public void accessMethodShortArray() throws ScriptException {
+        assertArrayEquals(o.shortArrayMethod(o.publicShortArray), (short[])e.eval("o.shortArrayMethod(o.publicShortArray);"));
+    }
+
+    @Test
+    public void accessMethodCharArray() throws ScriptException {
+        assertArrayEquals(o.charArrayMethod(o.publicCharArray), (char[])e.eval("o.charArrayMethod(o.publicCharArray);"));
+    }
+
+    @Test
+    public void accessMethodFloatArray() throws ScriptException {
+        assertArrayEquals(o.floatArrayMethod(o.publicFloatArray), (float[])e.eval("o.floatArrayMethod(o.publicFloatArray);"), 1e-10f);
+    }
+
+    @Test
+    public void accessMethodDoubleArray() throws ScriptException {
+        assertArrayEquals(o.doubleArrayMethod(o.publicDoubleArray), (double[])e.eval("o.doubleArrayMethod(o.publicDoubleArray);"), 1e-10);
+    }
+
+    @Test
+    public void accessMethodStringArray() throws ScriptException {
+        assertArrayEquals(o.stringArrayMethod(o.publicStringArray), (String[])e.eval("o.stringArrayMethod(o.publicStringArray);"));
+    }
+
+    @Test
+    public void accessMethodObjectArray() throws ScriptException {
+        assertArrayEquals(o.objectArrayMethod(o.publicObjectArray), (Person[])e.eval("o.objectArrayMethod(o.publicObjectArray);"));
+    }
+
+    @Test
+    public void accessDefaultConstructor() throws ScriptException {
+        e.eval("var dc = new Packages.jdk.nashorn.api.javaaccess.Person()");
+        assertEquals(new Person(), e.get("dc"));
+    }
+
+    @Test
+    public void accessCustomConstructor() throws ScriptException {
+        e.eval("var cc = new Packages.jdk.nashorn.api.javaaccess.Person(17)");
+        assertEquals(new Person(17), e.get("cc"));
+    }
+
+    @Test
+    public void accessMethod2PrimitiveParams() throws ScriptException {
+        assertEquals(o.twoParamMethod(50, 40.0), e.eval("o.twoParamMethod(50,40);"));
+    }
+
+    @Test
+    public void accessMethod3PrimitiveParams() throws ScriptException {
+        assertEquals(o.threeParamMethod((short)10, 20L, 'b'), e.eval("o.threeParamMethod(10,20,'b');"));
+    }
+
+    @Test
+    public void accessMethod2ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(200), new Person(300) }, (Person[])e.eval("o.twoObjectParamMethod(new Person(300),new Person(200));"));
+    }
+
+    @Test
+    public void accessMethod3ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.threeObjectParamMethod(new Person(1),new Person(2),new Person(3));"));
+    }
+
+    @Test
+    public void accessMethod8ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.eightObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6),new Person(7),new Person(8));"));
+    }
+
+    @Test
+    public void accessMethod9ObjectParams() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.nineObjectParamMethod(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
+    }
+
+    @Test
+    public void accessMethodObjectEllipsis() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(9), new Person(8), new Person(7), new Person(6), new Person(5), new Person(4), new Person(3), new Person(2), new Person(1) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(1),new Person(2),new Person(3)," + "new Person(4),new Person(5),new Person(6)," + "new Person(7),new Person(8),new Person(9));"));
+        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodObjectEllipsis()"));
+        assertArrayEquals(new Person[] { new Person(9) }, (Person[])e.eval("o.methodObjectEllipsis(new Person(9))"));
+    }
+
+    @Test
+    public void accessMethodPrimitiveEllipsis() throws ScriptException {
+        assertArrayEquals(new Person[] { new Person(1), new Person(3), new Person(2) }, (Person[])e.eval("o.methodPrimitiveEllipsis(1,3,2);"));
+        assertArrayEquals(new Person[] {}, (Person[])e.eval("o.methodPrimitiveEllipsis();"));
+        assertArrayEquals(o.methodPrimitiveEllipsis(9, 8, 7, 6, 5, 4, 3, 2, 1), (Person[])e.eval("o.methodPrimitiveEllipsis(9,8,7,6,5,4,3,2,1);"));
+    }
+
+    @Test
+    public void accessMethodMixedEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { new Person(1), 12, "hello", true }, (Object[])e.eval("o.methodMixedEllipsis(new Person(1),12,'hello',true);"));
+        assertArrayEquals(new Object[] {}, (Object[])e.eval("o.methodMixedEllipsis();"));
+    }
+
+    @Test
+    public void accessMethodObjectWithEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { "hello", 12, 15, 16 }, (Object[])e.eval("o.methodObjectWithEllipsis('hello',12,15,16);"));
+        assertArrayEquals(new Object[] { "hello" }, (Object[])e.eval("o.methodObjectWithEllipsis('hello');"));
+    }
+
+    @Test
+    public void accessMethodPrimitiveWithEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { 14, 12L, 15L, 16L }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(14,12,15,16);"));
+        assertArrayEquals(new Object[] { 12 }, (Object[])e.eval("o.methodPrimitiveWithEllipsis(12);"));
+    }
+
+    @Test
+    public void accessMethodMixedWithEllipsis() throws ScriptException {
+        assertArrayEquals(new Object[] { "Hello", 10, true, -100500, 80d }, (Object[])e.eval("o.methodMixedWithEllipsis('Hello', 10, true, -100500,80.0);"));
+        assertArrayEquals(new Object[] { "Nashorn", 15 }, (Object[])e.eval("o.methodMixedWithEllipsis('Nashorn',15);"));
+    }
+
+    @Test
+    public void accessMethodOverloaded() throws ScriptException {
+        assertEquals(0, e.eval("o.overloadedMethod(0);"));
+        assertEquals(2000, e.eval("o.overloadedMethod(1000);"));
+        assertEquals(2, e.eval("o.overloadedMethod('10');"));
+        assertEquals(7, e.eval("o.overloadedMethod('Nashorn');"));
+        assertEquals(4, e.eval("o.overloadedMethod('true');"));
+        assertEquals(1, e.eval("o.overloadedMethod(true);"));
+        assertEquals(0, e.eval("o.overloadedMethod(false);"));
+        assertEquals(44, e.eval("o.overloadedMethod(new Person(22));"));
+        assertEquals(0, e.eval("o.overloadedMethod(new Person());"));
+    }
+
+    @Test
+    public void accessMethodDoubleVSintOverloaded() throws ScriptException {
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.0);"));
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(1000.0);"));
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(0.01);"));
+        assertEquals("double", e.eval("o.overloadedMethodDoubleVSint(100.02);"));
+        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(0);"));
+        assertEquals("int", e.eval("o.overloadedMethodDoubleVSint(1000);"));
+    }
+
+    @Test
+    public void accessJavaMethodIntFromJSFromJavaFromJS() throws ScriptException {
+        e.eval("function secondLevelMethodInt(a) {"
+                + "return o.thirdLevelMethodInt(a);"
+                + "}");
+        assertEquals(50, e.eval("o.firstLevelMethodInt(10);"));
+    }
+
+    @Test
+    public void accessJavaMethodIntegerFromJSFromJavaFromJS() throws ScriptException {
+        e.eval("function secondLevelMethodInteger(a) {"
+                + "return o.thirdLevelMethodInteger(a);"
+                + "}");
+        assertEquals(100, e.eval("o.firstLevelMethodInteger(10);"));
+    }
+
+    @Test
+    public void accessJavaMethodObjectFromJSFromJavaFromJS() throws ScriptException {
+        e.eval("function secondLevelMethodObject(p) {"
+                + "return o.thirdLevelMethodObject(p);"
+                + "}");
+        assertEquals(new Person(100), e.eval("o.firstLevelMethodObject(new Person(10));"));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberAccessTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,789 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.NumberAccessTest
+ */
+@SuppressWarnings("javadoc")
+public class NumberAccessTest {
+
+    private static ScriptEngine e;
+    private static SharedObject o;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        o = new SharedObject();
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+        o = null;
+    }
+
+    // --------------------------------long
+    // tests------------------------------------
+    @Test
+    public void accessFieldLong() throws ScriptException {
+        e.eval("var p_long = o.publicLong;");
+        assertEquals(o.publicLong, e.get("p_long"));
+        e.eval("o.publicLong = 12;");
+        assertEquals(12, o.publicLong);
+    }
+
+    @Test
+    public void accessFieldLongArray() throws ScriptException {
+        e.eval("var p_long_array = o.publicLongArray;");
+        assertEquals(o.publicLongArray[0], e.eval("o.publicLongArray[0];"));
+        assertArrayEquals(o.publicLongArray, (long[])e.get("p_long_array"));
+        e.eval("var t_long_arr = new (Java.type(\"long[]\"))(3);" +
+                "t_long_arr[0] = -189009;" +
+                "t_long_arr[1] = 456;" +
+                "t_long_arr[2] = 600000001;" +
+                "o.publicLongArray = t_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { -189009, 456, 600000001 }, o.publicLongArray);
+        e.eval("o.publicLongArray[0] = 10;");
+        assertEquals(10, o.publicLongArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldLong() throws ScriptException {
+        e.eval("var ps_long = SharedObject.publicStaticLong;");
+        assertEquals(SharedObject.publicStaticLong, e.get("ps_long"));
+        e.eval("SharedObject.publicStaticLong = 120;");
+        assertEquals(120, SharedObject.publicStaticLong);
+    }
+
+    @Test
+    public void accessStaticFieldLongArray() throws ScriptException {
+        e.eval("var ps_long_array = SharedObject.publicStaticLongArray;");
+        assertEquals(SharedObject.publicStaticLongArray[0], e.eval("SharedObject.publicStaticLongArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticLongArray, (long[])e.get("ps_long_array"));
+        e.eval("var ts_long_arr = new (Java.type(\"long[]\"))(3);" +
+                "ts_long_arr[0] = -189009;" +
+                "ts_long_arr[1] = 456;" +
+                "ts_long_arr[2] = 600000001;" +
+                "SharedObject.publicStaticLongArray = ts_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { -189009, 456, 600000001 }, SharedObject.publicStaticLongArray);
+        e.eval("SharedObject.publicStaticLongArray[0] = 10;");
+        assertEquals(10, SharedObject.publicStaticLongArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldLong() throws ScriptException {
+        e.eval("var pf_long = o.publicFinalLong;");
+        assertEquals(o.publicFinalLong, e.get("pf_long"));
+        e.eval("o.publicFinalLong = 120;");
+        assertEquals(13353333333333333L, o.publicFinalLong);
+    }
+
+    @Test
+    public void accessFinalFieldLongArray() throws ScriptException {
+        e.eval("var pf_long_array = o.publicFinalLongArray;");
+        assertEquals(o.publicFinalLongArray[0], e.eval("o.publicFinalLongArray[0];"));
+        assertArrayEquals(o.publicFinalLongArray, (long[])e.get("pf_long_array"));
+        e.eval("var tf_long_arr = new (Java.type(\"long[]\"))(3);" +
+                "tf_long_arr[0] = -189009;" +
+                "tf_long_arr[1] = 456;" +
+                "tf_long_arr[2] = 600000001;" +
+                "o.publicFinalLongArray = tf_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { 1901733333333L, -2247355555L, 3977377777L }, o.publicFinalLongArray);
+        e.eval("o.publicFinalLongArray[0] = 10;");
+        assertEquals(10, o.publicFinalLongArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldLong() throws ScriptException {
+        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
+        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
+        e.eval("SharedObject.publicStaticFinalLong = 120;");
+        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
+    }
+
+    @Test
+    public void accessStaticFinalFieldLongArray() throws ScriptException {
+        e.eval("var psf_long_array = SharedObject.publicStaticFinalLongArray;");
+        assertEquals(SharedObject.publicStaticFinalLongArray[0], e.eval("SharedObject.publicStaticFinalLongArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalLongArray, (long[])e.get("psf_long_array"));
+        e.eval("var tsf_long_arr = new (Java.type(\"long[]\"))(3);" +
+                "tsf_long_arr[0] = -189009;" +
+                "tsf_long_arr[1] = 456;" +
+                "tsf_long_arr[2] = 600000001;" +
+                "SharedObject.publicStaticFinalLongArray = tsf_long_arr;");
+        // e.eval("o.publicIntArray = [-189009,456,600000001];");
+        assertArrayEquals(new long[] { 19017383333L, -2247358L, 39773787L }, SharedObject.publicStaticFinalLongArray);
+        e.eval("SharedObject.publicStaticFinalLongArray[0] = 10;");
+        assertEquals(10, SharedObject.publicStaticFinalLongArray[0]);
+    }
+
+    // --------------------------------int
+    // tests------------------------------------
+    @Test
+    public void accessFieldInt() throws ScriptException {
+        e.eval("var p_int = o.publicInt;");
+        assertEquals(o.publicInt, e.get("p_int"));
+        e.eval("o.publicInt = 14;");
+        assertEquals(14, o.publicInt);
+    }
+
+    @Test
+    public void accessFieldIntArray() throws ScriptException {
+        e.eval("var p_int_array = o.publicIntArray;");
+        assertEquals(o.publicIntArray[0], e.eval("o.publicIntArray[0];"));
+        assertArrayEquals(o.publicIntArray, (int[])e.get("p_int_array"));
+        e.eval("var t_int_arr = new (Java.type(\"int[]\"))(3);" +
+                "t_int_arr[0] = 4;" +
+                "t_int_arr[1] = 5;" +
+                "t_int_arr[2] = 6;" +
+                "o.publicIntArray = t_int_arr;");
+        assertArrayEquals(new int[] { 4, 5, 6 }, o.publicIntArray);
+        e.eval("o.publicIntArray[0] = 100;");
+        assertEquals(100, o.publicIntArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldInt() throws ScriptException {
+        e.eval("var ps_int = SharedObject.publicStaticInt;");
+        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
+        e.eval("SharedObject.publicStaticInt = 140;");
+        assertEquals(140, SharedObject.publicStaticInt);
+    }
+
+    @Test
+    public void accessStaticFieldIntArray() throws ScriptException {
+        e.eval("var ps_int_array = SharedObject.publicStaticIntArray;");
+        assertEquals(SharedObject.publicStaticIntArray[0], e.eval("SharedObject.publicStaticIntArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticIntArray, (int[])e.get("ps_int_array"));
+        e.eval("var ts_int_arr = new (Java.type(\"int[]\"))(3);" +
+                "ts_int_arr[0] = 4;" +
+                "ts_int_arr[1] = 5;" +
+                "ts_int_arr[2] = 6;" +
+                "SharedObject.publicStaticIntArray = ts_int_arr;");
+        assertArrayEquals(new int[] { 4, 5, 6 }, SharedObject.publicStaticIntArray);
+        e.eval("SharedObject.publicStaticIntArray[0] = 100;");
+        assertEquals(100, SharedObject.publicStaticIntArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldInt() throws ScriptException {
+        e.eval("var pf_int = o.publicFinalInt;");
+        assertEquals(o.publicFinalInt, e.get("pf_int"));
+
+        e.eval("o.publicFinalInt = 10;");
+        assertEquals(20712023, o.publicFinalInt);
+    }
+
+    @Test
+    public void accessFinalFieldIntArray() throws ScriptException {
+        e.eval("var pf_int_array = o.publicFinalIntArray;");
+        assertEquals(o.publicFinalIntArray[0], e.eval("o.publicFinalIntArray[0];"));
+        assertArrayEquals(o.publicFinalIntArray, (int[])e.get("pf_int_array"));
+        e.eval("var tf_int_arr = new (Java.type(\"int[]\"))(3);" +
+                "tf_int_arr[0] = 4;" +
+                "tf_int_arr[1] = 5;" +
+                "tf_int_arr[2] = 6;" +
+                "o.publicFinalIntArray = tf_int_arr;");
+        assertArrayEquals(new int[] { 50, 80, 130, 210, 340 }, o.publicFinalIntArray);
+        e.eval("o.publicFinalIntArray[0] = 100;");
+        assertEquals(100, o.publicFinalIntArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldInt() throws ScriptException {
+        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
+        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
+        e.eval("SharedObject.publicStaticFinalInt = 140;");
+        assertEquals(207182023, SharedObject.publicStaticFinalInt);
+    }
+
+    @Test
+    public void accessStaticFinalFieldIntArray() throws ScriptException {
+        e.eval("var psf_int_array = SharedObject.publicStaticFinalIntArray;");
+        assertEquals(SharedObject.publicStaticFinalIntArray[0], e.eval("SharedObject.publicStaticFinalIntArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalIntArray, (int[])e.get("psf_int_array"));
+        e.eval("var tsf_int_arr = new (Java.type(\"int[]\"))(3);" +
+                "tsf_int_arr[0] = 4;" +
+                "tsf_int_arr[1] = 5;" +
+                "tsf_int_arr[2] = 6;" +
+                "SharedObject.publicStaticFinalIntArray = tsf_int_arr;");
+        assertArrayEquals(new int[] { 1308, 210, 340 }, SharedObject.publicStaticFinalIntArray);
+        e.eval("SharedObject.publicStaticFinalIntArray[0] = 100;");
+        assertEquals(100, SharedObject.publicStaticFinalIntArray[0]);
+    }
+
+    // --------------------------------byte
+    // tests------------------------------------
+    @Test
+    public void accessFieldByte() throws ScriptException {
+        e.eval("var p_byte = o.publicByte;");
+        assertEquals((double)o.publicByte, ((Number)e.get("p_byte")).doubleValue());
+        e.eval("o.publicByte = 16;");
+        assertEquals(16, o.publicByte);
+    }
+
+    @Test
+    public void accessFieldByteArray() throws ScriptException {
+        e.eval("var p_byte_array = o.publicByteArray;");
+        assertEquals(o.publicByteArray[0], e.eval("o.publicByteArray[0];"));
+        assertArrayEquals(o.publicByteArray, (byte[])e.get("p_byte_array"));
+        e.eval("var t_byte_arr = new (Java.type(\"byte[]\"))(3);" +
+                "t_byte_arr[0] = -18;" +
+                "t_byte_arr[1] = 56;" +
+                "t_byte_arr[2] = 60;" +
+                "o.publicByteArray = t_byte_arr;");
+        assertArrayEquals(new byte[] { -18, 56, 60 }, o.publicByteArray);
+        e.eval("o.publicByteArray[0] = 100;");
+        assertEquals(100, o.publicByteArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldByte() throws ScriptException {
+        e.eval("var ps_byte = SharedObject.publicStaticByte;");
+        assertEquals((double)SharedObject.publicStaticByte, ((Number)e.get("ps_byte")).doubleValue());
+        e.eval("SharedObject.publicStaticByte = 16;");
+        assertEquals(16, SharedObject.publicStaticByte);
+    }
+
+    @Test
+    public void accessStaticFieldByteArray() throws ScriptException {
+        e.eval("var ps_byte_array = SharedObject.publicStaticByteArray;");
+        assertEquals(SharedObject.publicStaticByteArray[0], e.eval("SharedObject.publicStaticByteArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticByteArray, (byte[])e.get("ps_byte_array"));
+        e.eval("var ts_byte_arr = new (Java.type(\"byte[]\"))(3);" +
+                "ts_byte_arr[0] = -18;" +
+                "ts_byte_arr[1] = 56;" +
+                "ts_byte_arr[2] = 60;" +
+                "SharedObject.publicStaticByteArray = ts_byte_arr;");
+        assertArrayEquals(new byte[] { -18, 56, 60 }, SharedObject.publicStaticByteArray);
+        e.eval("SharedObject.publicStaticByteArray[0] = -90;");
+        assertEquals(-90, SharedObject.publicStaticByteArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldByte() throws ScriptException {
+        e.eval("var pf_byte = o.publicFinalByte;");
+        assertEquals((double)o.publicFinalByte, ((Number)e.get("pf_byte")).doubleValue());
+        e.eval("o.publicFinalByte = 16;");
+        assertEquals(-7, o.publicFinalByte);
+    }
+
+    @Test
+    public void accessFinalFieldByteArray() throws ScriptException {
+        e.eval("var pf_byte_array = o.publicFinalByteArray;");
+        assertEquals(o.publicFinalByteArray[0], e.eval("o.publicFinalByteArray[0];"));
+        assertArrayEquals(o.publicFinalByteArray, (byte[])e.get("pf_byte_array"));
+        e.eval("var tf_byte_arr = new (Java.type(\"byte[]\"))(3);" +
+                "tf_byte_arr[0] = -18;" +
+                "tf_byte_arr[1] = 56;" +
+                "tf_byte_arr[2] = 60;" +
+                "o.publicFinalByteArray = tf_byte_arr;");
+        assertArrayEquals(new byte[] { 1, 3, 6, 17, -128 }, o.publicFinalByteArray);
+        e.eval("o.publicFinalByteArray[0] = -90;");
+        assertEquals(-90, o.publicFinalByteArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldByte() throws ScriptException {
+        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
+        assertEquals((double)SharedObject.publicStaticFinalByte, ((Number)e.get("psf_byte")).doubleValue());
+        e.eval("SharedObject.publicStaticFinalByte = 16;");
+        assertEquals(-70, SharedObject.publicStaticFinalByte);
+    }
+
+    @Test
+    public void accessStaticFinalFieldByteArray() throws ScriptException {
+        e.eval("var psf_byte_array = SharedObject.publicStaticFinalByteArray;");
+        assertEquals(SharedObject.publicStaticFinalByteArray[0], e.eval("SharedObject.publicStaticFinalByteArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalByteArray, (byte[])e.get("psf_byte_array"));
+        e.eval("var tsf_byte_arr = new (Java.type(\"byte[]\"))(3);" +
+                "tsf_byte_arr[0] = -18;" +
+                "tsf_byte_arr[1] = 56;" +
+                "tsf_byte_arr[2] = 60;" +
+                "SharedObject.publicStaticFinalByteArray = tsf_byte_arr;");
+        assertArrayEquals(new byte[] { 17, -128, 81 }, SharedObject.publicStaticFinalByteArray);
+        e.eval("SharedObject.publicStaticFinalByteArray[0] = -90;");
+        assertEquals(-90, SharedObject.publicStaticFinalByteArray[0]);
+    }
+
+    // --------------------------------short
+    // tests------------------------------------
+    @Test
+    public void accessFieldShort() throws ScriptException {
+        e.eval("var p_short = o.publicShort;");
+        assertEquals((double)o.publicShort, ((Number)e.get("p_short")).doubleValue());
+        e.eval("o.publicShort = 18;");
+        assertEquals(18, o.publicShort);
+    }
+
+    @Test
+    public void accessFieldShortArray() throws ScriptException {
+        e.eval("var p_short_array = o.publicShortArray;");
+        assertEquals(o.publicShortArray[0], e.eval("o.publicShortArray[0];"));
+        assertArrayEquals(o.publicShortArray, (short[])e.get("p_short_array"));
+        e.eval("var t_short_arr = new (Java.type(\"short[]\"))(3);" +
+                "t_short_arr[0] = 90;" +
+                "t_short_arr[1] = 5;" +
+                "t_short_arr[2] = -6000;" +
+                "o.publicShortArray = t_short_arr;");
+        assertArrayEquals(new short[] { 90, 5, -6000 }, o.publicShortArray);
+        e.eval("o.publicShortArray[0] = -1000;");
+        assertEquals(-1000, o.publicShortArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldShort() throws ScriptException {
+        e.eval("var ps_short = SharedObject.publicStaticShort;");
+        assertEquals((double)SharedObject.publicStaticShort, ((Number)e.get("ps_short")).doubleValue());
+        e.eval("SharedObject.publicStaticShort = 180;");
+        assertEquals(180, SharedObject.publicStaticShort);
+    }
+
+    @Test
+    public void accessStaticFieldShortArray() throws ScriptException {
+        e.eval("var ps_short_array = SharedObject.publicStaticShortArray;");
+        assertEquals(SharedObject.publicStaticShortArray[0], e.eval("SharedObject.publicStaticShortArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticShortArray, (short[])e.get("ps_short_array"));
+        e.eval("var ts_short_arr = new (Java.type(\"short[]\"))(3);" +
+                "ts_short_arr[0] = 90;" +
+                "ts_short_arr[1] = 5;" +
+                "ts_short_arr[2] = -6000;" +
+                "SharedObject.publicStaticShortArray = ts_short_arr;");
+        assertArrayEquals(new short[] { 90, 5, -6000 }, SharedObject.publicStaticShortArray);
+        e.eval("SharedObject.publicStaticShortArray[0] = -1000;");
+        assertEquals(-1000, SharedObject.publicStaticShortArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldShort() throws ScriptException {
+        e.eval("var pf_short = o.publicFinalShort;");
+        assertEquals((double)o.publicFinalShort, ((Number)e.get("pf_short")).doubleValue());
+        e.eval("o.publicFinalShort = 180;");
+        assertEquals(31220, o.publicFinalShort);
+    }
+
+    @Test
+    public void accessFinalFieldShortArray() throws ScriptException {
+        e.eval("var pf_short_array = o.publicFinalShortArray;");
+        assertEquals(o.publicFinalShortArray[0], e.eval("o.publicFinalShortArray[0];"));
+        assertArrayEquals(o.publicFinalShortArray, (short[])e.get("pf_short_array"));
+        e.eval("var tf_short_arr = new (Java.type(\"short[]\"))(3);" +
+                "tf_short_arr[0] = 90;" +
+                "tf_short_arr[1] = 5;" +
+                "tf_short_arr[2] = -6000;" +
+                "o.publicFinalShortArray = tf_short_arr;");
+        assertArrayEquals(new short[] { 12240, 9200, -17289, 1200, 12 }, o.publicFinalShortArray);
+        e.eval("o.publicFinalShortArray[0] = -1000;");
+        assertEquals(-1000, o.publicFinalShortArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldShort() throws ScriptException {
+        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
+        assertEquals((double)SharedObject.publicStaticFinalShort, ((Number)e.get("psf_short")).doubleValue());
+        e.eval("SharedObject.publicStaticFinalShort = 180;");
+        assertEquals(8888, SharedObject.publicStaticFinalShort);
+    }
+
+    @Test
+    public void accessStaticFinalFieldShortArray() throws ScriptException {
+        e.eval("var psf_short_array = SharedObject.publicStaticFinalShortArray;");
+        assertEquals(SharedObject.publicStaticFinalShortArray[0], e.eval("SharedObject.publicStaticFinalShortArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalShortArray, (short[])e.get("psf_short_array"));
+        e.eval("var tsf_short_arr = new (Java.type(\"short[]\"))(3);" +
+                "tsf_short_arr[0] = 90;" +
+                "tsf_short_arr[1] = 5;" +
+                "tsf_short_arr[2] = -6000;" +
+                "SharedObject.publicStaticFinalShortArray = tsf_short_arr;");
+        assertArrayEquals(new short[] { 8240, 9280, -1289, 120, 812 }, SharedObject.publicStaticFinalShortArray);
+        e.eval("SharedObject.publicStaticFinalShortArray[0] = -1000;");
+        assertEquals(-1000, SharedObject.publicStaticFinalShortArray[0]);
+    }
+
+    // --------------------------------char
+    // tests------------------------------------
+    @Test
+    public void accessFieldChar() throws ScriptException {
+        e.eval("var p_char = o.publicChar;");
+        assertEquals(o.publicChar, e.get("p_char"));
+        e.eval("o.publicChar = 'S';");
+        assertEquals('S', o.publicChar);
+        e.eval("o.publicChar = 10;");
+        assertEquals(10, o.publicChar);
+        e.eval("try {"
+                + "    o.publicChar = 'Big string';" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "}");
+        assertEquals("Exception thrown", true, e.get("isThrown"));
+        assertEquals(10, o.publicChar);
+    }
+
+    @Test
+    public void accessFieldCharArray() throws ScriptException {
+        e.eval("var p_char_array = o.publicCharArray;");
+        assertEquals(o.publicCharArray[0], e.eval("o.publicCharArray[0];"));
+        assertArrayEquals(o.publicCharArray, (char[])e.get("p_char_array"));
+        e.eval("var t_char_arr = new (Java.type(\"char[]\"))(3);" +
+                "t_char_arr[0] = 'F';" +
+                "t_char_arr[1] = 'o';" +
+                "t_char_arr[2] = 'o';" +
+                "o.publicCharArray = t_char_arr;");
+        assertArrayEquals("Foo".toCharArray(), o.publicCharArray);
+        e.eval("o.publicCharArray[0] = 'Z';");
+        assertEquals('Z', o.publicCharArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldChar() throws ScriptException {
+        e.eval("var ps_char = SharedObject.publicStaticChar;");
+        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
+        e.eval("SharedObject.publicStaticChar = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticChar);
+    }
+
+    @Test
+    public void accessStaticFieldCharArray() throws ScriptException {
+        e.eval("var ps_char_array = SharedObject.publicStaticCharArray;");
+        assertEquals(SharedObject.publicStaticCharArray[0], e.eval("SharedObject.publicStaticCharArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticCharArray, (char[])e.get("ps_char_array"));
+        e.eval("var ts_char_arr = new (Java.type(\"char[]\"))(3);" +
+                "ts_char_arr[0] = 'G';" +
+                "ts_char_arr[1] = 'o';" +
+                "ts_char_arr[2] = 'o';" +
+                "SharedObject.publicStaticCharArray = ts_char_arr;");
+        assertArrayEquals("Goo".toCharArray(), SharedObject.publicStaticCharArray);
+        e.eval("SharedObject.publicStaticCharArray[0] = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticCharArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldChar() throws ScriptException {
+        e.eval("var pf_char = o.publicFinalChar;");
+        assertEquals(o.publicFinalChar, e.get("pf_char"));
+        e.eval("o.publicFinalChar = 'S';");
+        assertEquals('E', o.publicFinalChar);
+    }
+
+    @Test
+    public void accessFinalCharArray() throws ScriptException {
+        e.eval("var pf_char_array = o.publicFinalCharArray;");
+        assertEquals(o.publicFinalCharArray[0], e.eval("o.publicFinalCharArray[0];"));
+        assertArrayEquals(o.publicFinalCharArray, (char[])e.get("pf_char_array"));
+        e.eval("var tf_char_arr = new (Java.type(\"char[]\"))(3);" +
+                "tf_char_arr[0] = 'F';" +
+                "tf_char_arr[1] = 'o';" +
+                "tf_char_arr[2] = 'o';" +
+                "o.publicFinalCharArray = tf_char_arr;");
+        assertArrayEquals("Nashorn hello".toCharArray(), o.publicFinalCharArray);
+        e.eval("o.publicFinalCharArray[0] = 'Z';");
+        assertEquals('Z', o.publicFinalCharArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldChar() throws ScriptException {
+        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
+        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
+        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
+        assertEquals('K', SharedObject.publicStaticFinalChar);
+    }
+
+    @Test
+    public void accessStaticFinalFieldCharArray() throws ScriptException {
+        e.eval("var psf_char_array = SharedObject.publicStaticFinalCharArray;");
+        assertEquals(SharedObject.publicStaticFinalCharArray[0], e.eval("SharedObject.publicStaticFinalCharArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalCharArray, (char[])e.get("psf_char_array"));
+        e.eval("var tsf_char_arr = new (Java.type(\"char[]\"))(3);" +
+                "tsf_char_arr[0] = 'Z';" +
+                "tsf_char_arr[1] = 'o';" +
+                "tsf_char_arr[2] = 'o';" +
+                "SharedObject.publicStaticFinalCharArray = tsf_char_arr;");
+        assertArrayEquals("StaticString".toCharArray(), SharedObject.publicStaticFinalCharArray);
+        e.eval("SharedObject.publicStaticFinalCharArray[0] = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticFinalCharArray[0]);
+    }
+
+    // --------------------------------float
+    // tests------------------------------------
+    @Test
+    public void accessFieldFloat() throws ScriptException {
+        e.eval("var p_float = o.publicFloat;");
+        assertEquals((double)o.publicFloat, ((Number)e.get("p_float")).doubleValue());
+        o.publicFloat = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(o.publicFloat)"));
+        o.publicFloat = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloat"));
+        o.publicFloat = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloat"));
+        e.eval("o.publicFloat = 20;");
+        assertEquals(20, o.publicFloat, 1e-10);
+        e.eval("o.publicFloat = 0.0/0.0;");
+        assertTrue(Float.isNaN(o.publicFloat));
+        e.eval("o.publicFloat = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloat));
+        e.eval("o.publicFloat = -1.0/0.0;");
+        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloat, 1e-10);
+    }
+
+    @Test
+    public void accessFieldFloatArray() throws ScriptException {
+        e.eval("var p_float_array = o.publicFloatArray;");
+        assertEquals(o.publicFloatArray[0], e.eval("o.publicFloatArray[0];"));
+        assertArrayEquals(o.publicFloatArray, (float[])e.get("p_float_array"), 1e-10f);
+        e.eval("var t_float_arr = new (Java.type(\"float[]\"))(3);" +
+                "t_float_arr[0] = 9.0;" +
+                "t_float_arr[1] = 5.12345;" +
+                "t_float_arr[2] = -60.03;" +
+                "o.publicFloatArray = t_float_arr;");
+        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
+        e.eval("o.publicFloatArray[0] = -513.2;");
+        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, o.publicFloatArray, 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFieldFloat() throws ScriptException {
+        e.eval("var ps_float = SharedObject.publicStaticFloat;");
+        assertEquals((double)SharedObject.publicStaticFloat, ((Number)e.get("ps_float")).doubleValue());
+        SharedObject.publicStaticFloat = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
+        SharedObject.publicStaticFloat = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
+        SharedObject.publicStaticFloat = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
+        e.eval("SharedObject.publicStaticFloat = 20.0;");
+        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
+        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
+        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+    }
+
+    @Test
+    public void accessStaticFieldFloatArray() throws ScriptException {
+        e.eval("var ps_float_array = SharedObject.publicStaticFloatArray;");
+        assertEquals(SharedObject.publicStaticFloatArray[0], e.eval("SharedObject.publicStaticFloatArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFloatArray, (float[])e.get("ps_float_array"), 1e-10f);
+        e.eval("var ts_float_arr = new (Java.type(\"float[]\"))(3);" +
+                "ts_float_arr[0] = 9.0;" +
+                "ts_float_arr[1] = 5.12345;" +
+                "ts_float_arr[2] = -60.03;" +
+                "SharedObject.publicStaticFloatArray = ts_float_arr;");
+        assertArrayEquals(new float[] { 9.0f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
+        e.eval("SharedObject.publicStaticFloatArray[0] = -513.2;");
+        assertArrayEquals(new float[] { -513.2f, 5.12345f, -60.03f }, SharedObject.publicStaticFloatArray, 1e-10f);
+    }
+
+    @Test
+    public void accessFinalFloat() throws ScriptException {
+        e.eval("var pf_float = o.publicFinalFloat;");
+        assertEquals((double)o.publicFinalFloat, ((Number)e.get("pf_float")).doubleValue());
+        e.eval("o.publicFinalFloat = 20.0;");
+        assertEquals(7.72e8f, o.publicFinalFloat, 1e-10);
+    }
+
+    @Test
+    public void accessFinalFloatArray() throws ScriptException {
+        e.eval("var pf_float_array = o.publicFinalFloatArray;");
+        assertEquals(o.publicFinalFloatArray[0], e.eval("o.publicFinalFloatArray[0];"));
+        assertArrayEquals(o.publicFinalFloatArray, (float[])e.get("pf_float_array"), 1e-10f);
+        e.eval("var tf_float_arr = new (Java.type(\"float[]\"))(3);" +
+                "tf_float_arr[0] = 9.0;" +
+                "tf_float_arr[1] = 5.12345;" +
+                "tf_float_arr[2] = -60.03;" +
+                "o.publicFinalFloatArray = tf_float_arr;");
+        assertArrayEquals(new float[] { -131.012f, 189.32f, -31.32e8f, 3.72f }, o.publicFinalFloatArray, 1e-10f);
+        e.eval("o.publicFinalFloatArray[0] = -513.2;");
+        assertEquals(-513.2f, o.publicFinalFloatArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFinalFieldFloat() throws ScriptException {
+        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
+        assertEquals((double)SharedObject.publicStaticFinalFloat, ((Number)e.get("psf_float")).doubleValue());
+        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
+        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
+    }
+
+    @Test
+    public void accessStaticFinalFieldFloatArray() throws ScriptException {
+        e.eval("var psf_float_array = SharedObject.publicStaticFinalFloatArray;");
+        assertEquals(SharedObject.publicStaticFinalFloatArray[0], e.eval("SharedObject.publicStaticFinalFloatArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalFloatArray, (float[])e.get("psf_float_array"), 1e-10f);
+        e.eval("var tsf_float_arr = new (Java.type(\"float[]\"))(3);" +
+                "tsf_float_arr[0] = 9.0;" +
+                "tsf_float_arr[1] = 5.12345;" +
+                "tsf_float_arr[2] = -60.03;" +
+                "SharedObject.publicStaticFinalFloatArray = tsf_float_arr;");
+        assertArrayEquals(new float[] { -8131.012f, 9.32f, -138.32e8f, 0.72f }, SharedObject.publicStaticFinalFloatArray, 1e-10f);
+        e.eval("SharedObject.publicStaticFinalFloatArray[0] = -513.2;");
+        assertEquals(-513.2f, SharedObject.publicStaticFinalFloatArray[0], 1e-10f);
+    }
+
+    // --------------------------------double
+    // tests------------------------------------
+    @Test
+    public void accessFieldDouble() throws ScriptException {
+        e.eval("var p_double = o.publicDouble;");
+        assertEquals(o.publicDouble, e.get("p_double"));
+        o.publicDouble = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(o.publicDouble)"));
+        o.publicDouble = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDouble"));
+        o.publicDouble = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDouble"));
+        e.eval("o.publicDouble = 30;");
+        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDouble));
+        e.eval("o.publicDouble = 0.0/0.0;");
+        assertTrue(Double.isNaN(o.publicDouble));
+        e.eval("o.publicDouble = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
+        e.eval("o.publicDouble = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDouble));
+    }
+
+    @Test
+    public void accessFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var p_double_array = o.publicDoubleArray;");
+        assertEquals(o.publicDoubleArray[0], e.eval("o.publicDoubleArray[0];"));
+        assertArrayEquals(o.publicDoubleArray, (double[])e.get("p_double_array"), 1e-10);
+        e.eval("var t_double_arr = new (Java.type(\"double[]\"))(3);" +
+                "t_double_arr[0] = 9e10;" +
+                "t_double_arr[1] = 0.677777;" +
+                "t_double_arr[2] = -0.0000001;" +
+                "o.publicDoubleArray = t_double_arr;");
+        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, o.publicDoubleArray, 1e-10f);
+        e.eval("o.publicDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, o.publicDoubleArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFieldDouble() throws ScriptException {
+        e.eval("var ps_double = SharedObject.publicStaticDouble;");
+        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
+        SharedObject.publicStaticDouble = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
+        SharedObject.publicStaticDouble = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
+        SharedObject.publicStaticDouble = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
+        e.eval("SharedObject.publicStaticDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
+        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+    }
+
+    @Test
+    public void accessStaticFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var ps_double_array = SharedObject.publicStaticDoubleArray;");
+        assertEquals(SharedObject.publicStaticDoubleArray[0], e.eval("SharedObject.publicStaticDoubleArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticDoubleArray, (double[])e.get("ps_double_array"), 1e-10);
+        e.eval("var ts_double_arr = new (Java.type(\"double[]\"))(3);" +
+                "ts_double_arr[0] = 9e10;" +
+                "ts_double_arr[1] = 0.677777;" +
+                "ts_double_arr[2] = -0.0000001;" +
+                "SharedObject.publicStaticDoubleArray = ts_double_arr;");
+        assertArrayEquals(new double[] { 9e10, 0.677777, -0.0000001 }, SharedObject.publicStaticDoubleArray, 1e-10f);
+        e.eval("SharedObject.publicStaticDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, SharedObject.publicStaticDoubleArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessFinalFieldDouble() throws ScriptException {
+        e.eval("var pf_double = o.publicFinalDouble;");
+        assertEquals(o.publicFinalDouble, e.get("pf_double"));
+        e.eval("o.publicFinalDouble = 30.0;");
+        assertEquals(Double.doubleToLongBits(1.3412e20), Double.doubleToLongBits(o.publicFinalDouble));
+    }
+
+    @Test
+    public void accessFinalFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var pf_double_array = o.publicFinalDoubleArray;");
+        assertEquals(o.publicFinalDoubleArray[0], e.eval("o.publicFinalDoubleArray[0];"));
+        assertArrayEquals(o.publicFinalDoubleArray, (double[])e.get("pf_double_array"), 1e-10);
+        e.eval("var tf_double_arr = new (Java.type(\"double[]\"))(3);" +
+                "tf_double_arr[0] = 9e10;" +
+                "tf_double_arr[1] = 0.677777;" +
+                "tf_double_arr[2] = -0.0000001;" +
+                "o.publicFinalDoubleArray = tf_double_arr;");
+        assertArrayEquals(new double[] { 0.725e80, 0.12e10, 8e-3, 1.00077 }, o.publicFinalDoubleArray, 1e-10f);
+        e.eval("o.publicFinalDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, o.publicFinalDoubleArray[0], 1e-10f);
+    }
+
+    @Test
+    public void accessStaticFinalFieldDouble() throws ScriptException {
+        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
+        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
+        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
+    }
+
+    @Test
+    public void accessStaticFinalFieldDoubleArrayRead() throws ScriptException {
+        e.eval("var psf_double_array = SharedObject.publicStaticFinalDoubleArray;");
+        assertEquals(SharedObject.publicStaticFinalDoubleArray[0], e.eval("SharedObject.publicStaticFinalDoubleArray[0];"));
+        assertArrayEquals(SharedObject.publicStaticFinalDoubleArray, (double[])e.get("psf_double_array"), 1e-10);
+        e.eval("var tsf_double_arr = new (Java.type(\"double[]\"))(3);" +
+                "tsf_double_arr[0] = 9e10;" +
+                "tsf_double_arr[1] = 0.677777;" +
+                "tsf_double_arr[2] = -0.0000001;" +
+                "SharedObject.publicStaticFinalDoubleArray = tsf_double_arr;");
+        assertArrayEquals(new double[] { 8.725e80, 0.82e10, 18e-3, 1.08077 }, SharedObject.publicStaticFinalDoubleArray, 1e-10f);
+        e.eval("SharedObject.publicStaticFinalDoubleArray[0] = -5.2e10;");
+        assertEquals(-5.2e10, SharedObject.publicStaticFinalDoubleArray[0], 1e-10f);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/NumberBoxingTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,365 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertTrue;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.NumberBoxingTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.NumberBoxingTest
+ */
+@SuppressWarnings("javadoc")
+public class NumberBoxingTest {
+
+    private static ScriptEngine e;
+    private static SharedObject o;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        o = new SharedObject();
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+        o = null;
+    }
+
+    // --------------------------------long
+    // tests------------------------------------
+    @Test
+    public void accessFieldLongBoxing() throws ScriptException {
+        e.eval("var p_long = o.publicLongBox;");
+        assertEquals(o.publicLongBox, e.get("p_long"));
+        e.eval("o.publicLongBox = 12;");
+        assertEquals(Long.valueOf(12), o.publicLongBox);
+    }
+
+    @Test
+    public void accessStaticFieldLongBoxing() throws ScriptException {
+        e.eval("var ps_long = SharedObject.publicStaticLongBox;");
+        assertEquals(SharedObject.publicStaticLongBox, e.get("ps_long"));
+        e.eval("SharedObject.publicStaticLongBox = 120;");
+        assertEquals(120L, SharedObject.publicStaticLongBox.longValue());
+    }
+
+    @Test
+    public void accessFinalFieldLongBoxing() throws ScriptException {
+        e.eval("var pf_long = o.publicFinalLongBox;");
+        assertEquals(o.publicFinalLongBox, e.get("pf_long"));
+        e.eval("o.publicFinalLongBox = 120;");
+        assertEquals(Long.valueOf(9377333334L), o.publicFinalLongBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldLongBoxing() throws ScriptException {
+        e.eval("var psf_long = SharedObject.publicStaticFinalLong;");
+        assertEquals(SharedObject.publicStaticFinalLong, e.get("psf_long"));
+        e.eval("SharedObject.publicStaticFinalLong = 120;");
+        assertEquals(8333333333333L, SharedObject.publicStaticFinalLong);
+    }
+
+    // --------------------------------int
+    // tests------------------------------------
+    @Test
+    public void accessFieldIntBoxing() throws ScriptException {
+        e.eval("var p_int = o.publicIntBox;");
+        assertEquals(o.publicIntBox, e.get("p_int"));
+        e.eval("o.publicIntBox = 14;");
+        assertEquals(Integer.valueOf(14), o.publicIntBox);
+    }
+
+    @Test
+    public void accessStaticFieldIntBoxing() throws ScriptException {
+        e.eval("var ps_int = SharedObject.publicStaticInt;");
+        assertEquals(SharedObject.publicStaticInt, e.get("ps_int"));
+        e.eval("SharedObject.publicStaticInt = 140;");
+        assertEquals(140, SharedObject.publicStaticInt);
+    }
+
+    @Test
+    public void accessFinalFieldIntBoxing() throws ScriptException {
+        e.eval("var pf_int = o.publicFinalIntBox;");
+        assertEquals(o.publicFinalIntBox, e.get("pf_int"));
+        e.eval("o.publicFinalIntBox = 10;");
+        assertEquals(Integer.valueOf(207512301), o.publicFinalIntBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldIntBoxing() throws ScriptException {
+        e.eval("var psf_int = SharedObject.publicStaticFinalInt;");
+        assertEquals(SharedObject.publicStaticFinalInt, e.get("psf_int"));
+        e.eval("SharedObject.publicStaticFinalInt = 140;");
+        assertEquals(207182023, SharedObject.publicStaticFinalInt);
+    }
+
+    // --------------------------------byte
+    // tests------------------------------------
+    @Test
+    public void accessFieldByteBoxing() throws ScriptException {
+        e.eval("var p_byte = o.publicByteBox;");
+        assertEqualsDouble(o.publicByteBox, "p_byte");
+        e.eval("o.publicByteBox = 16;");
+        assertEquals(Byte.valueOf((byte)16), o.publicByteBox);
+    }
+
+    @Test
+    public void accessStaticFieldByteBoxing() throws ScriptException {
+        e.eval("var ps_byte = SharedObject.publicStaticByte;");
+        assertEqualsDouble(SharedObject.publicStaticByte, "ps_byte");
+        e.eval("SharedObject.publicStaticByte = 16;");
+        assertEquals(16, SharedObject.publicStaticByte);
+    }
+
+    @Test
+    public void accessFinalFieldByteBoxing() throws ScriptException {
+        e.eval("var pf_byte = o.publicFinalByteBox;");
+        assertEqualsDouble(o.publicFinalByteBox, "pf_byte");
+        e.eval("o.publicFinalByteBox = 16;");
+        assertEquals(Byte.valueOf((byte)19), o.publicFinalByteBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldByteBoxing() throws ScriptException {
+        e.eval("var psf_byte = SharedObject.publicStaticFinalByte;");
+        assertEqualsDouble(SharedObject.publicStaticFinalByte, "psf_byte");
+        e.eval("SharedObject.publicStaticFinalByte = 16;");
+        assertEquals(-70, SharedObject.publicStaticFinalByte);
+    }
+
+    // --------------------------------short
+    // tests------------------------------------
+    @Test
+    public void accessFieldShortBoxing() throws ScriptException {
+        e.eval("var p_short = o.publicShortBox;");
+        assertEqualsDouble(o.publicShortBox, "p_short");
+        e.eval("o.publicShortBox = 18;");
+        assertEquals(Short.valueOf((short)18), o.publicShortBox);
+    }
+
+    private static void assertEqualsDouble(final Number n, final String name) {
+        assertEquals(n.doubleValue(), ((Number)e.get(name)).doubleValue());
+    }
+
+    @Test
+    public void accessStaticFieldShortBoxing() throws ScriptException {
+        e.eval("var ps_short = SharedObject.publicStaticShort;");
+        assertEqualsDouble(SharedObject.publicStaticShort, "ps_short");
+        e.eval("SharedObject.publicStaticShort = 180;");
+        assertEquals(180, SharedObject.publicStaticShort);
+    }
+
+    @Test
+    public void accessFinalFieldShortBoxing() throws ScriptException {
+        e.eval("var pf_short = o.publicFinalShortBox;");
+        assertEqualsDouble(o.publicFinalShortBox, "pf_short");
+        e.eval("o.publicFinalShortBox = 180;");
+        assertEquals(Short.valueOf((short)-26777), o.publicFinalShortBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldShortBoxing() throws ScriptException {
+        e.eval("var psf_short = SharedObject.publicStaticFinalShort;");
+        assertEqualsDouble(SharedObject.publicStaticFinalShort, "psf_short");
+        e.eval("SharedObject.publicStaticFinalShort = 180;");
+        assertEquals(8888, SharedObject.publicStaticFinalShort);
+    }
+
+    // --------------------------------char
+    // tests------------------------------------
+    @Test
+    public void accessFieldCharBoxing() throws ScriptException {
+        e.eval("var p_char = o.publicCharBox;");
+        assertEquals(o.publicCharBox, e.get("p_char"));
+        e.eval("o.publicCharBox = 'S';");
+        assertEquals(Character.valueOf('S'), o.publicCharBox);
+        e.eval("try {" +
+                "    o.publicCharBox = 'Big string';" +
+                "} catch(e) {" +
+                "    var isThrown = true;" +
+                "}");
+        assertEquals("Exception thrown", true, e.get("isThrown"));
+        assertEquals(Character.valueOf('S'), o.publicCharBox);
+    }
+
+    @Test
+    public void accessStaticFieldCharBoxing() throws ScriptException {
+        e.eval("var ps_char = SharedObject.publicStaticChar;");
+        assertEquals(SharedObject.publicStaticChar, e.get("ps_char"));
+        e.eval("SharedObject.publicStaticChar = 'Z';");
+        assertEquals('Z', SharedObject.publicStaticChar);
+    }
+
+    @Test
+    public void accessFinalFieldCharBoxing() throws ScriptException {
+        e.eval("var pf_char = o.publicFinalCharBox;");
+        assertEquals(o.publicFinalCharBox, e.get("pf_char"));
+        e.eval("o.publicFinalCharBox = 'S';");
+        assertEquals(Character.valueOf('F'), o.publicFinalCharBox);
+    }
+
+    @Test
+    public void accessStaticFinalFieldCharBoxing() throws ScriptException {
+        e.eval("var psf_char = SharedObject.publicStaticFinalChar;");
+        assertEquals(SharedObject.publicStaticFinalChar, e.get("psf_char"));
+        e.eval("SharedObject.publicStaticFinalChar = 'Z';");
+        assertEquals('K', SharedObject.publicStaticFinalChar);
+    }
+
+    // --------------------------------float
+    // tests------------------------------------
+    @Test
+    public void accessFieldFloatBoxing() throws ScriptException {
+        e.eval("var p_float = o.publicFloatBox;");
+        assertEqualsDouble(o.publicFloatBox, "p_float");
+        o.publicFloatBox = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(o.publicFloatBox)"));
+        o.publicFloatBox = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicFloatBox"));
+        o.publicFloatBox = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicFloatBox"));
+        e.eval("o.publicFloatBox = 20;");
+        assertEquals(20, o.publicFloatBox, 1e-10);
+        e.eval("o.publicFloatBox = 0.0/0.0;");
+        assertTrue(Float.isNaN(o.publicFloatBox));
+        e.eval("o.publicFloatBox = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(o.publicFloatBox));
+        e.eval("o.publicFloatBox = -1.0/0.0;");
+        assertEquals(Float.NEGATIVE_INFINITY, o.publicFloatBox, 1e-10);
+    }
+
+    @Test
+    public void accessStaticFieldFloatBoxing() throws ScriptException {
+        e.eval("var ps_float = SharedObject.publicStaticFloat;");
+        assertEqualsDouble(SharedObject.publicStaticFloat, "ps_float");
+        SharedObject.publicStaticFloat = 0.0f / 0.0f;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticFloat)"));
+        SharedObject.publicStaticFloat = 1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticFloat"));
+        SharedObject.publicStaticFloat = -1.0f / 0.0f;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticFloat"));
+        e.eval("SharedObject.publicStaticFloat = 20.0;");
+        assertEquals(20.0f, SharedObject.publicStaticFloat, 1e-10);
+        e.eval("SharedObject.publicStaticFloat = 0.0/0.0;");
+        assertTrue(Float.isNaN(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = 1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.POSITIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+        e.eval("SharedObject.publicStaticFloat = -1.0/0.0;");
+        assertEquals(Float.floatToIntBits(Float.NEGATIVE_INFINITY), Float.floatToIntBits(SharedObject.publicStaticFloat));
+    }
+
+    @Test
+    public void accessFinalFloatBoxing() throws ScriptException {
+        e.eval("var pf_float = o.publicFinalFloatBox;");
+        assertEqualsDouble(o.publicFinalFloatBox, "pf_float");
+        e.eval("o.publicFinalFloatBox = 20.0;");
+        assertEquals(1.372e4f, o.publicFinalFloatBox, 1e-10);
+    }
+
+    @Test
+    public void accessStaticFinalFieldFloatBoxing() throws ScriptException {
+        e.eval("var psf_float = SharedObject.publicStaticFinalFloat;");
+        assertEqualsDouble(SharedObject.publicStaticFinalFloat, "psf_float");
+        e.eval("SharedObject.publicStaticFinalFloat = 20.0;");
+        assertEquals(0.72e8f, SharedObject.publicStaticFinalFloat, 1e-10);
+    }
+
+    // --------------------------------double
+    // tests------------------------------------
+    @Test
+    public void accessFieldDoubleBoxing() throws ScriptException {
+        e.eval("var p_double = o.publicDoubleBox;");
+        assertEquals(o.publicDoubleBox, e.get("p_double"));
+        o.publicDoubleBox = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(o.publicDoubleBox)"));
+        o.publicDoubleBox = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === o.publicDoubleBox"));
+        o.publicDoubleBox = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === o.publicDoubleBox"));
+        e.eval("o.publicDoubleBox = 30;");
+        assertEquals(Double.doubleToLongBits(30.0), Double.doubleToLongBits(o.publicDoubleBox));
+        e.eval("o.publicDoubleBox = 0.0/0.0;");
+        assertTrue(Double.isNaN(o.publicDoubleBox));
+        e.eval("o.publicDoubleBox = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
+        e.eval("o.publicDoubleBox = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(o.publicDoubleBox));
+    }
+
+    @Test
+    public void accessStaticFieldDoubleBoxing() throws ScriptException {
+        e.eval("var ps_double = SharedObject.publicStaticDouble;");
+        assertEquals(SharedObject.publicStaticDouble, e.get("ps_double"));
+        SharedObject.publicStaticDouble = 0.0 / 0.0;
+        assertEquals(true, e.eval("isNaN(SharedObject.publicStaticDouble)"));
+        SharedObject.publicStaticDouble = 1.0 / 0.0;
+        assertEquals(true, e.eval("Number.POSITIVE_INFINITY === SharedObject.publicStaticDouble"));
+        SharedObject.publicStaticDouble = -1.0 / 0.0;
+        assertEquals(true, e.eval("Number.NEGATIVE_INFINITY === SharedObject.publicStaticDouble"));
+        e.eval("SharedObject.publicStaticDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(40.0), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 0.0/0.0;");
+        assertTrue(Double.isNaN(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = 1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.POSITIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+        e.eval("SharedObject.publicStaticDouble = -1.0/0.0;");
+        assertEquals(Double.doubleToLongBits(Double.NEGATIVE_INFINITY), Double.doubleToLongBits(SharedObject.publicStaticDouble));
+    }
+
+    @Test
+    public void accessFinalFieldDoubleBoxing() throws ScriptException {
+        e.eval("var pf_double = o.publicFinalDoubleBox;");
+        assertEquals(o.publicFinalDoubleBox, e.get("pf_double"));
+        e.eval("o.publicFinalDoubleBox = 30.0;");
+        assertEquals(Double.doubleToLongBits(1.412e-12), Double.doubleToLongBits(o.publicFinalDoubleBox));
+    }
+
+    @Test
+    public void accessStaticFinalFieldDoubleBoxing() throws ScriptException {
+        e.eval("var psf_double = SharedObject.publicStaticFinalDouble;");
+        assertEquals(SharedObject.publicStaticFinalDouble, e.get("psf_double"));
+        e.eval("SharedObject.publicStaticFinalDouble = 40.0;");
+        assertEquals(Double.doubleToLongBits(1.8e12), Double.doubleToLongBits(SharedObject.publicStaticFinalDouble));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/ObjectAccessTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.ObjectAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.ObjectAccessTest
+ */
+@SuppressWarnings("javadoc")
+public class ObjectAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = null;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        o = new SharedObject();
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+        e.eval("var Person = Packages.jdk.nashorn.api.javaaccess.Person;");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+        o = null;
+    }
+
+    @Test
+    public void accessFieldObject() throws ScriptException {
+        e.eval("var p_object = o.publicObject;");
+        assertEquals(o.publicObject, e.get("p_object"));
+        assertEquals("object", e.eval("typeof p_object;"));
+        e.eval("o.publicObject = new Person(14);");
+        assertEquals(new Person(14), o.publicObject);
+    }
+
+    @Test
+    public void accessFieldObjectArray() throws ScriptException {
+        e.eval("var p_object_array = o.publicObjectArray;");
+        assertEquals(o.publicObjectArray[0], e.eval("o.publicObjectArray[0]"));
+        assertArrayEquals(o.publicObjectArray, (Object[])e.get("p_object_array"));
+        e.eval("var t_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+                "t_object_arr[0] = new Person(100);" +
+                "t_object_arr[1] = new Person(120);" +
+                "t_object_arr[2] = new Person(140);" +
+                "o.publicObjectArray = t_object_arr;");
+        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, o.publicObjectArray);
+        e.eval("o.publicObjectArray[0] = new Person(10);");
+        assertEquals(new Person(10), o.publicObjectArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldObject() throws ScriptException {
+        e.eval("var ps_object = SharedObject.publicStaticObject;");
+        assertEquals(SharedObject.publicStaticObject, e.get("ps_object"));
+        assertEquals("object", e.eval("typeof ps_object;"));
+        e.eval("SharedObject.publicStaticObject = new Person(16);");
+        assertEquals(new Person(16), SharedObject.publicStaticObject);
+    }
+
+    @Test
+    public void accessStaticFieldObjectArray() throws ScriptException {
+        e.eval("var ps_object_array = SharedObject.publicStaticObjectArray;");
+        assertEquals(SharedObject.publicStaticObjectArray[0], e.eval("SharedObject.publicStaticObjectArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticObjectArray, (Object[])e.get("ps_object_array"));
+        e.eval("var ts_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+                "ts_object_arr[0] = new Person(100);" +
+                "ts_object_arr[1] = new Person(120);" +
+                "ts_object_arr[2] = new Person(140);" +
+                "SharedObject.publicStaticObjectArray = ts_object_arr;");
+        assertArrayEquals(new Person[] { new Person(100), new Person(120), new Person(140) }, SharedObject.publicStaticObjectArray);
+        e.eval("SharedObject.publicStaticObjectArray[0] = new Person(10);");
+        assertEquals(new Person(10), SharedObject.publicStaticObjectArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldObject() throws ScriptException {
+        e.eval("var pf_object = o.publicFinalObject;");
+        assertEquals(o.publicFinalObject, e.get("pf_object"));
+        assertEquals("object", e.eval("typeof pf_object;"));
+        e.eval("o.publicFinalObject = new Person(-999);");
+        assertEquals(new Person(1024), o.publicFinalObject);
+    }
+
+    @Test
+    public void accessFinalFieldObjectArray() throws ScriptException {
+        e.eval("var pf_object_array = o.publicFinalObjectArray;");
+        assertEquals(o.publicFinalObjectArray[0], e.eval("o.publicFinalObjectArray[0]"));
+        assertArrayEquals(o.publicFinalObjectArray, (Object[])e.get("pf_object_array"));
+        e.eval("var tf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+                "tf_object_arr[0] = new Person(100);" +
+                "tf_object_arr[1] = new Person(120);" +
+                "tf_object_arr[2] = new Person(140);" +
+                "o.publicOFinalbjectArray = tf_object_arr;");
+        assertArrayEquals(new Person[] { new Person(-900), new Person(1000), new Person(180) }, o.publicFinalObjectArray);
+        e.eval("o.publicFinalObjectArray[0] = new Person(10);");
+        assertEquals(new Person(10), o.publicFinalObjectArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldObject() throws ScriptException {
+        e.eval("var psf_object = SharedObject.publicStaticFinalObject;");
+        assertEquals(SharedObject.publicStaticFinalObject, e.get("psf_object"));
+        assertEquals("object", e.eval("typeof psf_object;"));
+        e.eval("SharedObject.publicStaticFinalObject = new Person(6);");
+        assertEquals(new Person(2048), SharedObject.publicStaticFinalObject);
+    }
+
+    @Test
+    public void accessStaticFinalFieldObjectArray() throws ScriptException {
+        e.eval("var psf_object_array = SharedObject.publicStaticFinalObjectArray;");
+        assertEquals(SharedObject.publicStaticFinalObjectArray[0], e.eval("SharedObject.publicStaticFinalObjectArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticFinalObjectArray, (Object[])e.get("psf_object_array"));
+        e.eval("var tsf_object_arr = new (Java.type(\"jdk.nashorn.api.javaaccess.Person[]\"))(3);" +
+                "tsf_object_arr[0] = new Person(100);" +
+                "tsf_object_arr[1] = new Person(120);" +
+                "tsf_object_arr[2] = new Person(140);" +
+                "SharedObject.publicStaticFinalObjectArray = tsf_object_arr;");
+        assertArrayEquals(new Person[] { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) }, SharedObject.publicStaticFinalObjectArray);
+        e.eval("SharedObject.publicStaticFinalObjectArray[0] = new Person(90);");
+        assertEquals(new Person(90), SharedObject.publicStaticFinalObjectArray[0]);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/Person.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+@SuppressWarnings("javadoc")
+public class Person {
+
+    public int id = 0;
+
+    public Person() {
+    }
+
+    public Person(final int code) {
+        this.id = code;
+    }
+
+    @Override
+    public boolean equals(final Object obj) {
+        if (obj != null && obj instanceof Person) {
+            final Person o = (Person)obj;
+            return this.id == o.id;
+        }
+        return false;
+    }
+
+    @Override
+    public int hashCode() {
+        return id;
+    }
+
+    @Override
+    public String toString() {
+        return "Person(" + id + ")";
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/SharedObject.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,467 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import javax.script.Invocable;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+@SuppressWarnings("javadoc")
+public class SharedObject {
+
+    // Public fields
+    public String                 publicString                  = "PublicString";
+    public String[]               publicStringArray             = { "ArrayString[0]", "ArrayString[1]", "ArrayString[2]", "ArrayString[3]" };
+    public Person                 publicObject                  = new Person(256);
+    public Person[]               publicObjectArray             = { new Person(4), new Person(-422), new Person(14) };
+    public boolean                publicBoolean                 = true;
+    public boolean[]              publicBooleanArray            = { true, false, false, true };
+    public Boolean                publicBooleanBox              = true;
+    public long                   publicLong                    = 933333333333333333L;
+    public long[]                 publicLongArray               = { 99012333333333L, -124355555L, 89777777777L };
+    public Long                   publicLongBox                 = 9333333333L;
+    public int                    publicInt                     = 2076543123;
+    public int[]                  publicIntArray                = { 0, 1, 1, 2, 3, 5, 8, 13, 21, 34 };
+    public Integer                publicIntBox                  = 20765123;
+    public byte                   publicByte                    = -128;
+    public byte[]                 publicByteArray               = { 1, 2, 4, 8, 16, 32, 64, 127, -128 };
+    public Byte                   publicByteBox                 = 127;
+    public short                  publicShort                   = 32000;
+    public short[]                publicShortArray              = { 3240, 8900, -16789, 1, 12 };
+    public Short                  publicShortBox                = Short.MIN_VALUE;
+    public float                  publicFloat                   = 0.7f;
+    public float[]                publicFloatArray              = { -32.01f, 89.3f, -1.3e8f, 3.1f };
+    public Float                  publicFloatBox                = 1.377e4f;
+    public double                 publicDouble                  = 1.34e20;
+    public double[]               publicDoubleArray             = { 0.75e80, 8e-43, 1.000077, 0.123e10 };
+    public Double                 publicDoubleBox               = 1.4e-19;
+    public char                   publicChar                    = 'A';
+    public char[]                 publicCharArray               = "Hello Nashorn".toCharArray();
+    public Character              publicCharBox                 = 'B';
+    // Public static fields
+    public static String          publicStaticString            = "PublicStaticString";
+    public static String[]        publicStaticStringArray       = { "StaticArrayString[0]", "StaticArrayString[1]", "StaticArrayString[2]", "StaticArrayString[3]" };
+    public static Person          publicStaticObject            = new Person(512);
+    public static Person[]        publicStaticObjectArray       = { new Person(40), new Person(-22), new Person(18) };
+    public static boolean         publicStaticBoolean           = true;
+    public static boolean[]       publicStaticBooleanArray      = { false, false, false, true };
+    public static Boolean         publicStaticBooleanBox        = true;
+    public static long            publicStaticLong              = 13333333333333333L;
+    public static long[]          publicStaticLongArray         = { 19012333333333L, -224355555L, 39777777777L };
+    public static Long            publicStaticLongBox           = 9333333334L;
+    public static int             publicStaticInt               = 207654323;
+    public static int[]           publicStaticIntArray          = { 5, 8, 13, 21, 34 };
+    public static Integer         publicStaticIntBox            = 2075123;
+    public static byte            publicStaticByte              = -12;
+    public static byte[]          publicStaticByteArray         = { 16, 32, 64, 127, -128 };
+    public static Byte            publicStaticByteBox           = 17;
+    public static short           publicStaticShort             = 320;
+    public static short[]         publicStaticShortArray        = { 1240, 900, -1789, 100, 12 };
+    public static Short           publicStaticShortBox          = -16777;
+    public static float           publicStaticFloat             = 7.7e8f;
+    public static float[]         publicStaticFloatArray        = { -131.01f, 189.3f, -31.3e8f, 3.7f };
+    public static Float           publicStaticFloatBox          = 1.37e4f;
+    public static double          publicStaticDouble            = 1.341e20;
+    public static double[]        publicStaticDoubleArray       = { 0.75e80, 0.123e10, 8e-43, 1.000077 };
+    public static Double          publicStaticDoubleBox         = 1.41e-12;
+    public static char            publicStaticChar              = 'C';
+    public static char[]          publicStaticCharArray         = "Nashorn".toCharArray();
+    public static Character       publicStaticCharBox           = 'D';
+    // Public final fields
+    public final String           publicFinalString             = "PublicFinalString";
+    public final String[]         publicFinalStringArray        = { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" };
+    public final Person           publicFinalObject             = new Person(1024);
+    public final Person[]         publicFinalObjectArray        = { new Person(-900), new Person(1000), new Person(180) };
+    public final boolean          publicFinalBoolean            = true;
+    public final boolean[]        publicFinalBooleanArray       = { false, false, true, false };
+    public final Boolean          publicFinalBooleanBox         = true;
+    public final long             publicFinalLong               = 13353333333333333L;
+    public final long[]           publicFinalLongArray          = { 1901733333333L, -2247355555L, 3977377777L };
+    public final Long             publicFinalLongBox            = 9377333334L;
+    public final int              publicFinalInt                = 20712023;
+    public final int[]            publicFinalIntArray           = { 50, 80, 130, 210, 340 };
+    public final Integer          publicFinalIntBox             = 207512301;
+    public final byte             publicFinalByte               = -7;
+    public final byte[]           publicFinalByteArray          = { 1, 3, 6, 17, -128 };
+    public final Byte             publicFinalByteBox            = 19;
+    public final short            publicFinalShort              = 31220;
+    public final short[]          publicFinalShortArray         = { 12240, 9200, -17289, 1200, 12 };
+    public final Short            publicFinalShortBox           = -26777;
+    public final float            publicFinalFloat              = 7.72e8f;
+    public final float[]          publicFinalFloatArray         = { -131.012f, 189.32f, -31.32e8f, 3.72f };
+    public final Float            publicFinalFloatBox           = 1.372e4f;
+    public final double           publicFinalDouble             = 1.3412e20;
+    public final double[]         publicFinalDoubleArray        = { 0.725e80, 0.12e10, 8e-3, 1.00077 };
+    public final Double           publicFinalDoubleBox          = 1.412e-12;
+    public final char             publicFinalChar               = 'E';
+    public final char[]           publicFinalCharArray          = "Nashorn hello".toCharArray();
+    public final Character        publicFinalCharBox            = 'F';
+    // Public static final fields
+    public static final String    publicStaticFinalString       = "PublicStaticFinalString";
+    public static final String[]  publicStaticFinalStringArray  = { "StaticFinalArrayString[0]", "StaticFinalArrayString[1]", "StaticFinalArrayString[2]", "StaticFinalArrayString[3]" };
+    public static final Person    publicStaticFinalObject       = new Person(2048);
+    public static final Person[]  publicStaticFinalObjectArray  = { new Person(-9), new Person(110), new Person(Integer.MAX_VALUE) };
+    public static final boolean   publicStaticFinalBoolean      = true;
+    public static final boolean[] publicStaticFinalBooleanArray = { false, true, false, false };
+    public static final Boolean   publicStaticFinalBooleanBox   = true;
+    public static final long      publicStaticFinalLong         = 8333333333333L;
+    public static final long[]    publicStaticFinalLongArray    = { 19017383333L, -2247358L, 39773787L };
+    public static final Long      publicStaticFinalLongBox      = 9377388334L;
+    public static final int       publicStaticFinalInt          = 207182023;
+    public static final int[]     publicStaticFinalIntArray     = { 1308, 210, 340 };
+    public static final Integer   publicStaticFinalIntBox       = 2078301;
+    public static final byte      publicStaticFinalByte         = -70;
+    public static final byte[]    publicStaticFinalByteArray    = { 17, -128, 81 };
+    public static final Byte      publicStaticFinalByteBox      = 91;
+    public static final short     publicStaticFinalShort        = 8888;
+    public static final short[]   publicStaticFinalShortArray   = { 8240, 9280, -1289, 120, 812 };
+    public static final Short     publicStaticFinalShortBox     = -26;
+    public static final float     publicStaticFinalFloat        = 0.72e8f;
+    public static final float[]   publicStaticFinalFloatArray   = { -8131.012f, 9.32f, -138.32e8f, 0.72f };
+    public static final Float     publicStaticFinalFloatBox     = 1.2e4f;
+    public static final double    publicStaticFinalDouble       = 1.8e12;
+    public static final double[]  publicStaticFinalDoubleArray  = { 8.725e80, 0.82e10, 18e-3, 1.08077 };
+    public static final Double    publicStaticFinalDoubleBox    = 1.5612e-13;
+    public static final char      publicStaticFinalChar         = 'K';
+    public static final char[]    publicStaticFinalCharArray    = "StaticString".toCharArray();
+    public static final Character publicStaticFinalCharBox      = 'L';
+
+    // Special vars
+    public volatile boolean       volatileBoolean               = true;
+    public transient boolean      transientBoolean              = true;
+
+    // For methods testing
+    public boolean                isAccessed                    = false;
+    public volatile boolean       isFinished                    = false;
+
+    private ScriptEngine engine;
+
+    public ScriptEngine getEngine() {
+        return engine;
+    }
+
+    public void setEngine(final ScriptEngine engine) {
+        this.engine = engine;
+    }
+
+    public void voidMethod() {
+        isAccessed = true;
+    }
+
+    public boolean booleanMethod(final boolean arg) {
+        return !arg;
+    }
+
+    public Boolean booleanBoxingMethod(final Boolean arg) {
+        return !arg.booleanValue();
+    }
+
+    public boolean[] booleanArrayMethod(final boolean arg[]) {
+        final boolean[] res = new boolean[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = !arg[i];
+        }
+        return res;
+    }
+
+    public int intMethod(final int arg) {
+        return arg + arg;
+    }
+
+    public Integer intBoxingMethod(final Integer arg) {
+        return arg + arg;
+    }
+
+    public int[] intArrayMethod(final int arg[]) {
+        final int[] res = new int[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public long longMethod(final long arg) {
+        return arg + arg;
+    }
+
+    public Long longBoxingMethod(final Long arg) {
+        return arg + arg;
+    }
+
+    public long[] longArrayMethod(final long[] arg) {
+        final long[] res = new long[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public byte byteMethod(final byte arg) {
+        return (byte)(arg + arg);
+    }
+
+    public Byte byteBoxingMethod(final Byte arg) {
+        return (byte)(arg + arg);
+    }
+
+    public byte[] byteArrayMethod(final byte[] arg) {
+        final byte[] res = new byte[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = (byte)(arg[i] * 2);
+        }
+        return res;
+    }
+
+    public char charMethod(final char arg) {
+        return Character.toUpperCase(arg);
+    }
+
+    public Character charBoxingMethod(final Character arg) {
+        return Character.toUpperCase(arg);
+    }
+
+    public char[] charArrayMethod(final char[] arg) {
+        final char[] res = new char[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = Character.toUpperCase(arg[i]);
+        }
+        return res;
+    }
+
+    public short shortMethod(final short arg) {
+        return (short)(arg + arg);
+    }
+
+    public Short shortBoxingMethod(final Short arg) {
+        return (short)(arg + arg);
+    }
+
+    public short[] shortArrayMethod(final short[] arg) {
+        final short[] res = new short[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = (short)(arg[i] * 2);
+        }
+        return res;
+    }
+
+    public float floatMethod(final float arg) {
+        return arg + arg;
+    }
+
+    public Float floatBoxingMethod(final Float arg) {
+        return arg + arg;
+    }
+
+    public float[] floatArrayMethod(final float[] arg) {
+        final float[] res = new float[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public double doubleMethod(final double arg) {
+        return arg + arg;
+    }
+
+    public Double doubleBoxingMethod(final Double arg) {
+        return arg + arg;
+    }
+
+    public double[] doubleArrayMethod(final double[] arg) {
+        final double[] res = new double[arg.length];
+        for (int i = 0; i < arg.length; i++) {
+            res[i] = arg[i] * 2;
+        }
+        return res;
+    }
+
+    public String stringMethod(final String str) {
+        return str + str;
+    }
+
+    public String[] stringArrayMethod(final String[] arr) {
+        final int l = arr.length;
+        final String[] res = new String[l];
+        for (int i = 0; i < l; i++) {
+            res[i] = arr[l - i - 1];
+        }
+        return res;
+    }
+
+    public Person[] objectArrayMethod(final Person[] arr) {
+        final Person[] res = new Person[arr.length];
+        for (int i = 0; i < arr.length; i++) {
+            res[i] = new Person(i + 100);
+        }
+        return res;
+    }
+
+    public Person objectMethod(final Person t) {
+        t.id *= 2;
+        return t;
+    }
+
+    public int twoParamMethod(final long l, final double d) {
+        return (int)(l + d);
+    }
+
+    public int threeParamMethod(final short s, final long l, final char c) {
+        return (int)(s + l + c);
+    }
+
+    public Person[] twoObjectParamMethod(final Person arg1, final Person arg2) {
+        return new Person[] { arg2, arg1 };
+    }
+
+    public Person[] threeObjectParamMethod(final Person arg1, final Person arg2, final Person arg3) {
+        return new Person[] { arg3, arg2, arg1 };
+    }
+
+    public Person[] eightObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8) {
+        return new Person[] { arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
+    }
+
+    public Person[] nineObjectParamMethod(final Person arg1, final Person arg2, final Person arg3, final Person arg4, final Person arg5, final Person arg6, final Person arg7, final Person arg8, final Person arg9) {
+        return new Person[] { arg9, arg8, arg7, arg6, arg5, arg4, arg3, arg2, arg1 };
+    }
+
+    public Person[] methodObjectEllipsis(final Person... args) {
+        final int l = args.length;
+        final Person[] res = new Person[l];
+        for (int i = 0; i < l; i++) {
+            res[i] = args[l - i - 1];
+        }
+        return res;
+    }
+
+    public Person[] methodPrimitiveEllipsis(final int... args) {
+        final int l = args.length;
+        final Person[] res = new Person[l];
+        for (int i = 0; i < l; i++) {
+            res[i] = new Person(args[i]);
+        }
+        return res;
+    }
+
+    public Object[] methodMixedEllipsis(final Object... args) {
+        return args;
+    }
+
+    public Object[] methodObjectWithEllipsis(final String arg, final int... args) {
+        final Object[] res = new Object[args.length + 1];
+        res[0] = arg;
+        for (int i = 0; i < args.length; i++) {
+            res[i + 1] = args[i];
+        }
+        return res;
+    }
+
+    public Object[] methodPrimitiveWithEllipsis(final int arg, final long... args) {
+        final Object[] res = new Object[args.length + 1];
+        res[0] = arg;
+        for (int i = 0; i < args.length; i++) {
+            res[i + 1] = args[i];
+        }
+        return res;
+    }
+
+    public Object[] methodMixedWithEllipsis(final String arg1, final int arg2, final Object... args) {
+        final Object[] res = new Object[args.length + 2];
+        res[0] = arg1;
+        res[1] = arg2;
+        System.arraycopy(args, 0, res, 2, args.length);
+        return res;
+    }
+
+    public void methodStartsThread() {
+        isFinished = false;
+
+        final Thread t = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    Thread.sleep(1000);
+                    isFinished = true;
+                } catch (final InterruptedException e) {
+                    e.printStackTrace();
+                }
+            }
+        });
+
+        t.start();
+    }
+
+    public String overloadedMethodDoubleVSint(final int arg) {
+        return "int";
+    }
+
+    public String overloadedMethodDoubleVSint(final double arg) {
+        return "double";
+    }
+
+    public int overloadedMethod(final int arg) {
+        return arg*2;
+    }
+
+    public int overloadedMethod(final String arg) {
+        return arg.length();
+    }
+
+    public int overloadedMethod(final boolean arg) {
+        return (arg) ? 1 : 0;
+    }
+
+    public int overloadedMethod(final Person arg) {
+        return arg.id*2;
+    }
+
+    public int firstLevelMethodInt(final int arg) throws ScriptException, NoSuchMethodException {
+        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInt", arg);
+    }
+
+    public int thirdLevelMethodInt(final int arg) {
+        return arg*5;
+    }
+
+    public int firstLevelMethodInteger(final Integer arg) throws ScriptException, NoSuchMethodException {
+        return (int) ((Invocable)engine).invokeFunction("secondLevelMethodInteger", arg);
+    }
+
+    public int thirdLevelMethodInteger(final Integer arg) {
+        return arg*10;
+    }
+
+    public Person firstLevelMethodObject(final Person p) throws ScriptException, NoSuchMethodException {
+        return (Person) ((Invocable)engine).invokeFunction("secondLevelMethodObject", p);
+    }
+
+    public Person thirdLevelMethodObject(final Person p) {
+        p.id *= 10;
+        return p;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/javaaccess/test/StringAccessTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.javaaccess.test;
+
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.internal.junit.ArrayAsserts.assertArrayEquals;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.TestNG;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @build jdk.nashorn.api.javaaccess.SharedObject jdk.nashorn.api.javaaccess.Person jdk.nashorn.api.javaaccess.StringAccessTest
+ * @run testng/othervm jdk.nashorn.api.javaaccess.StringAccessTest
+ */
+@SuppressWarnings("javadoc")
+public class StringAccessTest {
+
+    private static ScriptEngine e = null;
+    private static SharedObject o = null;
+
+    public static void main(final String[] args) {
+        TestNG.main(args);
+    }
+
+    @BeforeClass
+    public static void setUpClass() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        e = m.getEngineByName("nashorn");
+        o = new SharedObject();
+        e.put("o", o);
+        e.eval("var SharedObject = Packages.jdk.nashorn.api.javaaccess.SharedObject;");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        e = null;
+        o = null;
+    }
+
+    @Test
+    public void accessFieldString() throws ScriptException {
+        e.eval("var p_string = o.publicString;");
+        assertEquals(o.publicString, e.get("p_string"));
+        assertEquals("string", e.eval("typeof p_string;"));
+        e.eval("o.publicString = 'changedString';");
+        assertEquals("changedString", o.publicString);
+    }
+
+    @Test
+    public void accessFieldStringArray() throws ScriptException {
+        e.eval("var p_string_array = o.publicStringArray;");
+        assertEquals(o.publicStringArray[0], e.eval("o.publicStringArray[0]"));
+        assertArrayEquals(o.publicStringArray, (String[])e.get("p_string_array"));
+        e.eval("var t_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
+                "t_string_arr[0] = 'abc';" +
+                "t_string_arr[1] = '123';" +
+                "t_string_arr[2] = 'xyzzzz';" +
+                "o.publicStringArray = t_string_arr;");
+        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, o.publicStringArray);
+        e.eval("o.publicStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", o.publicStringArray[0]);
+    }
+
+    @Test
+    public void accessStaticFieldString() throws ScriptException {
+        e.eval("var ps_string = SharedObject.publicStaticString;");
+        assertEquals(SharedObject.publicStaticString, e.get("ps_string"));
+        assertEquals("string", e.eval("typeof ps_string;"));
+        e.eval("SharedObject.publicStaticString = 'changedString';");
+        assertEquals("changedString", SharedObject.publicStaticString);
+    }
+
+    @Test
+    public void accessStaticFieldStringArray() throws ScriptException {
+        e.eval("var ps_string_array = SharedObject.publicStaticStringArray;");
+        assertEquals(SharedObject.publicStaticStringArray[0], e.eval("SharedObject.publicStaticStringArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticStringArray, (String[])e.get("ps_string_array"));
+        e.eval("var ts_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
+                "ts_string_arr[0] = 'abc';" +
+                "ts_string_arr[1] = '123';" +
+                "ts_string_arr[2] = 'xyzzzz';" +
+                "SharedObject.publicStaticStringArray = ts_string_arr;");
+        assertArrayEquals(new String[] { "abc", "123", "xyzzzz" }, SharedObject.publicStaticStringArray);
+        e.eval("SharedObject.publicStaticStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", SharedObject.publicStaticStringArray[0]);
+    }
+
+    @Test
+    public void accessFinalFieldString() throws ScriptException {
+        e.eval("var pf_string = o.publicFinalString;");
+        assertEquals(o.publicFinalString, e.get("pf_string"));
+        assertEquals("string", e.eval("typeof pf_string;"));
+        e.eval("o.publicFinalString = 'changedString';");
+        assertEquals("PublicFinalString", o.publicFinalString);
+    }
+
+    @Test
+    public void accessFinalFieldStringArray() throws ScriptException {
+        e.eval("var pf_string_array = o.publicFinalStringArray;");
+        assertEquals(o.publicFinalStringArray[0], e.eval("o.publicFinalStringArray[0]"));
+        assertArrayEquals(o.publicFinalStringArray, (String[])e.get("pf_string_array"));
+        e.eval("var tf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
+                "tf_string_arr[0] = 'abc';" +
+                "tf_string_arr[1] = '123';" +
+                "tf_string_arr[2] = 'xyzzzz';" +
+                "o.publicFinalStringArray = tf_string_arr;");
+        assertArrayEquals(new String[] { "FinalArrayString[0]", "FinalArrayString[1]", "FinalArrayString[2]", "FinalArrayString[3]" }, o.publicFinalStringArray);
+        e.eval("o.publicFinalStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", o.publicFinalStringArray[0]);
+    }
+
+    @Test
+    public void accessStaticFinalFieldString() throws ScriptException {
+        e.eval("var psf_string = SharedObject.publicStaticFinalString;");
+        assertEquals(SharedObject.publicStaticFinalString, e.get("psf_string"));
+        assertEquals("string", e.eval("typeof psf_string;"));
+        e.eval("SharedObject.publicStaticFinalString = 'changedString';");
+        assertEquals("PublicStaticFinalString", SharedObject.publicStaticFinalString);
+    }
+
+    @Test
+    public void accessStaticFinalFieldStringArray() throws ScriptException {
+        e.eval("var psf_string_array = SharedObject.publicStaticFinalStringArray;");
+        assertEquals(SharedObject.publicStaticFinalStringArray[0], e.eval("SharedObject.publicStaticFinalStringArray[0]"));
+        assertArrayEquals(SharedObject.publicStaticFinalStringArray, (String[])e.get("psf_string_array"));
+        e.eval("var tsf_string_arr = new (Java.type(\"java.lang.String[]\"))(3);" +
+                "tsf_string_arr[0] = 'abc';" +
+                "tsf_string_arr[1] = '123';" +
+                "tsf_string_arr[2] = 'xyzzzz';" +
+                "SharedObject.publicStaticFinalStringArray = tsf_string_arr;");
+        assertArrayEquals(new String[] { "StaticFinalArrayString[0]",
+                    "StaticFinalArrayString[1]",
+                    "StaticFinalArrayString[2]",
+                    "StaticFinalArrayString[3]" },
+                SharedObject.publicStaticFinalStringArray);
+        e.eval("SharedObject.publicStaticFinalStringArray[0] = 'nashorn';");
+        assertEquals("nashorn", SharedObject.publicStaticFinalStringArray[0]);
+    }
+
+}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/InvocableTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,539 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-import java.util.Objects;
-import java.util.function.Function;
-import javax.script.Invocable;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import javax.script.SimpleScriptContext;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * Tests for javax.script.Invocable implementation of nashorn.
- */
-@SuppressWarnings("javadoc")
-public class InvocableTest {
-
-    private static void log(final String msg) {
-        org.testng.Reporter.log(msg, true);
-    }
-
-    @Test
-    public void invokeMethodTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            e.eval("var Example = function() { this.hello = function() { return 'Hello World!'; };}; myExample = new Example();");
-            final Object obj = e.get("myExample");
-            final Object res = ((Invocable) e).invokeMethod(obj, "hello");
-            assertEquals(res, "Hello World!");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    /**
-     * Check that we can call invokeMethod on an object that we got by
-     * evaluating script with different Context set.
-     */
-    public void invokeMethodDifferentContextTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            // define an object with method on it
-            final Object obj = e.eval("({ hello: function() { return 'Hello World!'; } })");
-
-            final ScriptContext ctxt = new SimpleScriptContext();
-            ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
-            e.setContext(ctxt);
-
-            // invoke 'func' on obj - but with current script context changed
-            final Object res = ((Invocable) e).invokeMethod(obj, "hello");
-            assertEquals(res, "Hello World!");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    /**
-     * Check that invokeMethod throws NPE on null method name.
-     */
-    public void invokeMethodNullNameTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            final Object obj = e.eval("({})");
-            ((Invocable) e).invokeMethod(obj, null);
-            fail("should have thrown NPE");
-        } catch (final Exception exp) {
-            if (!(exp instanceof NullPointerException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that invokeMethod throws NoSuchMethodException on missing method.
-     */
-    public void invokeMethodMissingTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            final Object obj = e.eval("({})");
-            ((Invocable) e).invokeMethod(obj, "nonExistentMethod");
-            fail("should have thrown NoSuchMethodException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof NoSuchMethodException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that calling method on non-script object 'thiz' results in
-     * IllegalArgumentException.
-     */
-    public void invokeMethodNonScriptObjectThizTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            ((Invocable) e).invokeMethod(new Object(), "toString");
-            fail("should have thrown IllegalArgumentException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof IllegalArgumentException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that calling method on null 'thiz' results in
-     * IllegalArgumentException.
-     */
-    public void invokeMethodNullThizTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            ((Invocable) e).invokeMethod(null, "toString");
-            fail("should have thrown IllegalArgumentException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof IllegalArgumentException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that calling method on mirror created by another engine results in
-     * IllegalArgumentException.
-     */
-    public void invokeMethodMixEnginesTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine engine1 = m.getEngineByName("nashorn");
-        final ScriptEngine engine2 = m.getEngineByName("nashorn");
-
-        try {
-            final Object obj = engine1.eval("({ run: function() {} })");
-            // pass object from engine1 to engine2 as 'thiz' for invokeMethod
-            ((Invocable) engine2).invokeMethod(obj, "run");
-            fail("should have thrown IllegalArgumentException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof IllegalArgumentException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    public void getInterfaceTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Invocable inv = (Invocable) e;
-
-        // try to get interface from global functions
-        try {
-            e.eval("function run() { print('run'); };");
-            final Runnable runnable = inv.getInterface(Runnable.class);
-            runnable.run();
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-
-        // try interface on specific script object
-        try {
-            e.eval("var obj = { run: function() { print('run from obj'); } };");
-            final Object obj = e.get("obj");
-            final Runnable runnable = inv.getInterface(obj, Runnable.class);
-            runnable.run();
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    public interface Foo {
-
-        public void bar();
-    }
-
-    public interface Foo2 extends Foo {
-
-        public void bar2();
-    }
-
-    @Test
-    public void getInterfaceMissingTest() {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine engine = manager.getEngineByName("nashorn");
-
-        // don't define any function.
-        try {
-            engine.eval("");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-
-        Runnable runnable = ((Invocable) engine).getInterface(Runnable.class);
-        if (runnable != null) {
-            fail("runnable is not null!");
-        }
-
-        // now define "run"
-        try {
-            engine.eval("function run() { print('this is run function'); }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-        runnable = ((Invocable) engine).getInterface(Runnable.class);
-        // should not return null now!
-        runnable.run();
-
-        // define only one method of "Foo2"
-        try {
-            engine.eval("function bar() { print('bar function'); }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-
-        Foo2 foo2 = ((Invocable) engine).getInterface(Foo2.class);
-        if (foo2 != null) {
-            throw new RuntimeException("foo2 is not null!");
-        }
-
-        // now define other method of "Foo2"
-        try {
-            engine.eval("function bar2() { print('bar2 function'); }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-        foo2 = ((Invocable) engine).getInterface(Foo2.class);
-        foo2.bar();
-        foo2.bar2();
-    }
-
-    @Test
-    /**
-     * Try passing non-interface Class object for interface implementation.
-     */
-    public void getNonInterfaceGetInterfaceTest() {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine engine = manager.getEngineByName("nashorn");
-        try {
-            log(Objects.toString(((Invocable) engine).getInterface(Object.class)));
-            fail("Should have thrown IllegalArgumentException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof IllegalArgumentException)) {
-                fail("IllegalArgumentException expected, got " + exp);
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that we can get interface out of a script object even after
-     * switching to use different ScriptContext.
-     */
-    public void getInterfaceDifferentContext() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            final Object obj = e.eval("({ run: function() { } })");
-
-            // change script context
-            final ScriptContext ctxt = new SimpleScriptContext();
-            ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
-            e.setContext(ctxt);
-
-            final Runnable r = ((Invocable) e).getInterface(obj, Runnable.class);
-            r.run();
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    /**
-     * Check that getInterface on non-script object 'thiz' results in
-     * IllegalArgumentException.
-     */
-    public void getInterfaceNonScriptObjectThizTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            ((Invocable) e).getInterface(new Object(), Runnable.class);
-            fail("should have thrown IllegalArgumentException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof IllegalArgumentException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that getInterface on null 'thiz' results in
-     * IllegalArgumentException.
-     */
-    public void getInterfaceNullThizTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            ((Invocable) e).getInterface(null, Runnable.class);
-            fail("should have thrown IllegalArgumentException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof IllegalArgumentException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that calling getInterface on mirror created by another engine
-     * results in IllegalArgumentException.
-     */
-    public void getInterfaceMixEnginesTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine engine1 = m.getEngineByName("nashorn");
-        final ScriptEngine engine2 = m.getEngineByName("nashorn");
-
-        try {
-            final Object obj = engine1.eval("({ run: function() {} })");
-            // pass object from engine1 to engine2 as 'thiz' for getInterface
-            ((Invocable) engine2).getInterface(obj, Runnable.class);
-            fail("should have thrown IllegalArgumentException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof IllegalArgumentException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * check that null function name results in NPE.
-     */
-    public void invokeFunctionNullNameTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            ((Invocable)e).invokeFunction(null);
-            fail("should have thrown NPE");
-        } catch (final Exception exp) {
-            if (!(exp instanceof NullPointerException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that attempt to call missing function results in
-     * NoSuchMethodException.
-     */
-    public void invokeFunctionMissingTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            ((Invocable)e).invokeFunction("NonExistentFunc");
-            fail("should have thrown NoSuchMethodException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof NoSuchMethodException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    /**
-     * Check that invokeFunction calls functions only from current context's
-     * Bindings.
-     */
-    public void invokeFunctionDifferentContextTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            // define an object with method on it
-            e.eval("function hello() { return 'Hello World!'; }");
-            final ScriptContext ctxt = new SimpleScriptContext();
-            ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
-            // change engine's current context
-            e.setContext(ctxt);
-
-            ((Invocable) e).invokeFunction("hello"); // no 'hello' in new context!
-            fail("should have thrown NoSuchMethodException");
-        } catch (final Exception exp) {
-            if (!(exp instanceof NoSuchMethodException)) {
-                exp.printStackTrace();
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    public void invokeFunctionExceptionTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("function func() { throw new TypeError(); }");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-
-        try {
-            ((Invocable) e).invokeFunction("func");
-            fail("should have thrown exception");
-        } catch (final ScriptException se) {
-            // ECMA TypeError property wrapped as a ScriptException
-            log("got " + se + " as expected");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-    }
-
-    @Test
-    public void invokeMethodExceptionTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("var sobj = {}; sobj.foo = function func() { throw new TypeError(); }");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-
-        try {
-            final Object sobj = e.get("sobj");
-            ((Invocable) e).invokeMethod(sobj, "foo");
-            fail("should have thrown exception");
-        } catch (final ScriptException se) {
-            // ECMA TypeError property wrapped as a ScriptException
-            log("got " + se + " as expected");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-    }
-
-    @Test
-    /**
-     * Tests whether invocation of a JavaScript method through a variable arity
-     * Java method will pass the vararg array. Both non-vararg and vararg
-     * JavaScript methods are tested.
-     *
-     * @throws ScriptException
-     */
-    public void variableArityInterfaceTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.eval(
-                "function test1(i, strings) {"
-                + "    return 'i == ' + i + ', strings instanceof java.lang.String[] == ' + (strings instanceof Java.type('java.lang.String[]')) + ', strings == ' + java.util.Arrays.toString(strings)"
-                + "}"
-                + "function test2() {"
-                + "    return 'arguments[0] == ' + arguments[0] + ', arguments[1] instanceof java.lang.String[] == ' + (arguments[1] instanceof Java.type('java.lang.String[]')) + ', arguments[1] == ' + java.util.Arrays.toString(arguments[1])"
-                + "}");
-        final VariableArityTestInterface itf = ((Invocable) e).getInterface(VariableArityTestInterface.class);
-        Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]");
-        Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]");
-    }
-
-    @Test
-    public void defaultMethodTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Invocable inv = (Invocable) e;
-
-        final Object obj = e.eval("({ apply: function(arg) { return arg.toUpperCase(); }})");
-        @SuppressWarnings("unchecked")
-        final Function<String, String> func = inv.getInterface(obj, Function.class);
-        assertEquals(func.apply("hello"), "HELLO");
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/MultipleEngineTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.annotations.Test;
-
-/**
- * Test that we can create multiple, independent script engines and use those
- * independently.
- *
- * @test
- * @run testng jdk.nashorn.api.scripting.MultipleEngineTest
- */
-@SuppressWarnings("javadoc")
-public class MultipleEngineTest {
-    @Test
-    public void createAndUseManyEngine() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-
-        final ScriptEngine e1 = m.getEngineByName("nashorn");
-        e1.eval("var  x = 33; print(x);");
-
-        final ScriptEngine e2 = m.getEngineByName("nashorn");
-        e2.eval("try { print(x) } catch(e) { print(e); }");
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/PluggableJSObjectTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,288 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.fail;
-
-import java.nio.IntBuffer;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.Set;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import org.testng.annotations.Test;
-
-/**
- * Tests for pluggable external impls. of jdk.nashorn.api.scripting.JSObject.
- *
- * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external
- * JSObject implementations.
- */
-@SuppressWarnings("javadoc")
-public class PluggableJSObjectTest {
-    public static class MapWrapperObject extends AbstractJSObject {
-        private final HashMap<String, Object> map = new LinkedHashMap<>();
-
-        public HashMap<String, Object> getMap() {
-            return map;
-        }
-
-        @Override
-        public Object getMember(final String name) {
-            return map.get(name);
-        }
-
-        @Override
-        public void setMember(final String name, final Object value) {
-            map.put(name, value);
-        }
-
-        @Override
-        public boolean hasMember(final String name) {
-            return map.containsKey(name);
-        }
-
-        @Override
-        public void removeMember(final String name) {
-            map.remove(name);
-        }
-
-        @Override
-        public Set<String> keySet() {
-            return map.keySet();
-        }
-
-        @Override
-        public Collection<Object> values() {
-            return map.values();
-        }
-    }
-
-    @Test
-    // Named property access on a JSObject
-    public void namedAccessTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            final MapWrapperObject obj = new MapWrapperObject();
-            e.put("obj", obj);
-            obj.getMap().put("foo", "bar");
-
-            // property-like access on MapWrapperObject objects
-            assertEquals(e.eval("obj.foo"), "bar");
-            e.eval("obj.foo = 'hello'");
-            assertEquals(e.eval("'foo' in obj"), Boolean.TRUE);
-            assertEquals(e.eval("obj.foo"), "hello");
-            assertEquals(obj.getMap().get("foo"), "hello");
-            e.eval("delete obj.foo");
-            assertFalse(obj.getMap().containsKey("foo"));
-            assertEquals(e.eval("'foo' in obj"), Boolean.FALSE);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    // @bug 8062030: Nashorn bug retrieving array property after key string concatenation
-    @Test
-    // ConsString attribute access on a JSObject
-    public void consStringTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            final MapWrapperObject obj = new MapWrapperObject();
-            e.put("obj", obj);
-            e.put("f", "f");
-            e.eval("obj[f + 'oo'] = 'bar';");
-
-            assertEquals(obj.getMap().get("foo"), "bar");
-            assertEquals(e.eval("obj[f + 'oo']"), "bar");
-            assertEquals(e.eval("obj['foo']"), "bar");
-            assertEquals(e.eval("f + 'oo' in obj"), Boolean.TRUE);
-            assertEquals(e.eval("'foo' in obj"), Boolean.TRUE);
-            e.eval("delete obj[f + 'oo']");
-            assertFalse(obj.getMap().containsKey("foo"));
-            assertEquals(e.eval("obj[f + 'oo']"), null);
-            assertEquals(e.eval("obj['foo']"), null);
-            assertEquals(e.eval("f + 'oo' in obj"), Boolean.FALSE);
-            assertEquals(e.eval("'foo' in obj"), Boolean.FALSE);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    public static class BufferObject extends AbstractJSObject {
-        private final IntBuffer buf;
-
-        public BufferObject(final int size) {
-            buf = IntBuffer.allocate(size);
-        }
-
-        public IntBuffer getBuffer() {
-            return buf;
-        }
-
-        @Override
-        public Object getMember(final String name) {
-            return name.equals("length")? buf.capacity() : null;
-        }
-
-        @Override
-        public boolean hasSlot(final int i) {
-            return i > -1 && i < buf.capacity();
-        }
-
-        @Override
-        public Object getSlot(final int i) {
-            return buf.get(i);
-        }
-
-        @Override
-        public void setSlot(final int i, final Object value) {
-            buf.put(i, ((Number)value).intValue());
-        }
-
-        @Override
-        public boolean isArray() {
-            return true;
-        }
-    }
-
-    @Test
-    // array-like indexed access for a JSObject
-    public void indexedAccessTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            final BufferObject buf = new BufferObject(2);
-            e.put("buf", buf);
-
-            // array-like access on BufferObject objects
-            assertEquals(e.eval("buf.length"), buf.getBuffer().capacity());
-            e.eval("buf[0] = 23");
-            assertEquals(buf.getBuffer().get(0), 23);
-            assertEquals(e.eval("buf[0]"), 23);
-            assertEquals(e.eval("buf[1]"), 0);
-            buf.getBuffer().put(1, 42);
-            assertEquals(e.eval("buf[1]"), 42);
-            assertEquals(e.eval("Array.isArray(buf)"), Boolean.TRUE);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    public static class Adder extends AbstractJSObject {
-        @Override
-        public Object call(final Object thiz, final Object... args) {
-            double res = 0.0;
-            for (final Object arg : args) {
-                res += ((Number)arg).doubleValue();
-            }
-            return res;
-        }
-
-        @Override
-        public boolean isFunction() {
-            return true;
-        }
-    }
-
-    @Test
-    // a callable JSObject
-    public void callableJSObjectTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.put("sum", new Adder());
-            // check callability of Adder objects
-            assertEquals(e.eval("typeof sum"), "function");
-            assertEquals(((Number)e.eval("sum(1, 2, 3, 4, 5)")).intValue(), 15);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    public static class Factory extends AbstractJSObject {
-        @SuppressWarnings("unused")
-        @Override
-        public Object newObject(final Object... args) {
-            return new HashMap<Object, Object>();
-        }
-
-        @Override
-        public boolean isFunction() {
-            return true;
-        }
-    }
-
-    @Test
-    // a factory JSObject
-    public void factoryJSObjectTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.put("Factory", new Factory());
-
-            // check new on Factory
-            assertEquals(e.eval("typeof Factory"), "function");
-            assertEquals(e.eval("typeof new Factory()"), "object");
-            assertEquals(e.eval("(new Factory()) instanceof java.util.Map"), Boolean.TRUE);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    // iteration tests
-    public void iteratingJSObjectTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            final MapWrapperObject obj = new MapWrapperObject();
-            obj.setMember("foo", "hello");
-            obj.setMember("bar", "world");
-            e.put("obj", obj);
-
-            // check for..in
-            Object val = e.eval("var str = ''; for (i in obj) str += i; str");
-            assertEquals(val.toString(), "foobar");
-
-            // check for..each..in
-            val = e.eval("var str = ''; for each (i in obj) str += i; str");
-            assertEquals(val.toString(), "helloworld");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScopeTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,779 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.nashorn.api.scripting;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import javax.script.SimpleBindings;
-import javax.script.SimpleScriptContext;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * Tests for jsr223 Bindings "scope" (engine, global scopes)
- */
-@SuppressWarnings("javadoc")
-public class ScopeTest {
-
-    @Test
-    public void createBindingsTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        b.put("foo", 42.0);
-        Object res = null;
-        try {
-            res = e.eval("foo == 42.0", b);
-        } catch (final ScriptException | NullPointerException se) {
-            se.printStackTrace();
-            fail(se.getMessage());
-        }
-
-        assertEquals(res, Boolean.TRUE);
-    }
-
-    @Test
-    public void engineScopeTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings engineScope = e.getBindings(ScriptContext.ENGINE_SCOPE);
-
-        // check few ECMA standard built-in global properties
-        assertNotNull(engineScope.get("Object"));
-        assertNotNull(engineScope.get("TypeError"));
-        assertNotNull(engineScope.get("eval"));
-
-        // can access via ScriptEngine.get as well
-        assertNotNull(e.get("Object"));
-        assertNotNull(e.get("TypeError"));
-        assertNotNull(e.get("eval"));
-
-        // Access by either way should return same object
-        assertEquals(engineScope.get("Array"), e.get("Array"));
-        assertEquals(engineScope.get("EvalError"), e.get("EvalError"));
-        assertEquals(engineScope.get("undefined"), e.get("undefined"));
-
-        // try exposing a new variable from scope
-        engineScope.put("myVar", "foo");
-        try {
-            assertEquals(e.eval("myVar"), "foo");
-        } catch (final ScriptException se) {
-            se.printStackTrace();
-            fail(se.getMessage());
-        }
-
-        // update "myVar" in script an check the value from scope
-        try {
-            e.eval("myVar = 'nashorn';");
-        } catch (final ScriptException se) {
-            se.printStackTrace();
-            fail(se.getMessage());
-        }
-
-        // now check modified value from scope and engine
-        assertEquals(engineScope.get("myVar"), "nashorn");
-        assertEquals(e.get("myVar"), "nashorn");
-    }
-
-    @Test
-    public void multiGlobalTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        try {
-            final Object obj1 = e.eval("Object");
-            final Object obj2 = e.eval("Object", newCtxt);
-            Assert.assertNotEquals(obj1, obj2);
-            Assert.assertNotNull(obj1);
-            Assert.assertNotNull(obj2);
-            Assert.assertEquals(obj1.toString(), obj2.toString());
-
-            e.eval("x = 'hello'");
-            e.eval("x = 'world'", newCtxt);
-            Object x1 = e.getContext().getAttribute("x");
-            Object x2 = newCtxt.getAttribute("x");
-            Assert.assertNotEquals(x1, x2);
-            Assert.assertEquals(x1, "hello");
-            Assert.assertEquals(x2, "world");
-
-            x1 = e.eval("x");
-            x2 = e.eval("x", newCtxt);
-            Assert.assertNotEquals(x1, x2);
-            Assert.assertEquals(x1, "hello");
-            Assert.assertEquals(x2, "world");
-
-            final ScriptContext origCtxt = e.getContext();
-            e.setContext(newCtxt);
-            e.eval("y = new Object()");
-            e.eval("y = new Object()", origCtxt);
-
-            final Object y1 = origCtxt.getAttribute("y");
-            final Object y2 = newCtxt.getAttribute("y");
-            Assert.assertNotEquals(y1, y2);
-            final Object yeval1 = e.eval("y");
-            final Object yeval2 = e.eval("y", origCtxt);
-            Assert.assertNotEquals(yeval1, yeval2);
-            Assert.assertEquals("[object Object]", y1.toString());
-            Assert.assertEquals("[object Object]", y2.toString());
-        } catch (final ScriptException se) {
-            se.printStackTrace();
-            fail(se.getMessage());
-        }
-    }
-
-    @Test
-    public void userEngineScopeBindingsTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.eval("function func() {}");
-
-        final ScriptContext newContext = new SimpleScriptContext();
-        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
-        // we are using a new bindings - so it should have 'func' defined
-        final Object value = e.eval("typeof func", newContext);
-        assertTrue(value.equals("undefined"));
-    }
-
-    @Test
-    public void userEngineScopeBindingsNoLeakTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptContext newContext = new SimpleScriptContext();
-        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
-        e.eval("function foo() {}", newContext);
-
-        // in the default context's ENGINE_SCOPE, 'foo' shouldn't exist
-        assertTrue(e.eval("typeof foo").equals("undefined"));
-    }
-
-    @Test
-    public void userEngineScopeBindingsRetentionTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptContext newContext = new SimpleScriptContext();
-        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
-        e.eval("function foo() {}", newContext);
-
-        // definition retained with user's ENGINE_SCOPE Binding
-        assertTrue(e.eval("typeof foo", newContext).equals("function"));
-
-        final Bindings oldBindings = newContext.getBindings(ScriptContext.ENGINE_SCOPE);
-        // but not in another ENGINE_SCOPE binding
-        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
-        assertTrue(e.eval("typeof foo", newContext).equals("undefined"));
-
-        // restore ENGINE_SCOPE and check again
-        newContext.setBindings(oldBindings, ScriptContext.ENGINE_SCOPE);
-        assertTrue(e.eval("typeof foo", newContext).equals("function"));
-    }
-
-    @Test
-    // check that engine.js definitions are visible in all new global instances
-    public void checkBuiltinsInNewBindingsTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        // check default global instance has engine.js definitions
-        final Bindings g = (Bindings) e.eval("this");
-        Object value = g.get("__noSuchProperty__");
-        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
-        value = g.get("print");
-        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
-
-        // check new global instance created has engine.js definitions
-        final Bindings b = e.createBindings();
-        value = b.get("__noSuchProperty__");
-        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
-        value = b.get("print");
-        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
-
-        // put a mapping into GLOBAL_SCOPE
-        final Bindings globalScope = e.getContext().getBindings(ScriptContext.GLOBAL_SCOPE);
-        globalScope.put("x", "hello");
-
-        // GLOBAL_SCOPE mapping should be visible from default ScriptContext eval
-        assertTrue(e.eval("x").equals("hello"));
-
-        final ScriptContext ctx = new SimpleScriptContext();
-        ctx.setBindings(globalScope, ScriptContext.GLOBAL_SCOPE);
-        ctx.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        // GLOBAL_SCOPE mapping should be visible from non-default ScriptContext eval
-        assertTrue(e.eval("x", ctx).equals("hello"));
-
-        // try some arbitray Bindings for ENGINE_SCOPE
-        final Bindings sb = new SimpleBindings();
-        ctx.setBindings(sb, ScriptContext.ENGINE_SCOPE);
-
-        // GLOBAL_SCOPE mapping should be visible from non-default ScriptContext eval
-        assertTrue(e.eval("x", ctx).equals("hello"));
-
-        // engine.js builtins are still defined even with arbitrary Bindings
-        assertTrue(e.eval("typeof print", ctx).equals("function"));
-        assertTrue(e.eval("typeof __noSuchProperty__", ctx).equals("function"));
-
-        // ENGINE_SCOPE definition should 'hide' GLOBAL_SCOPE definition
-        sb.put("x", "newX");
-        assertTrue(e.eval("x", ctx).equals("newX"));
-    }
-
-    /**
-     * Test multi-threaded access to defined global variables for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedVarTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-        final String sharedScript = "foo";
-
-        assertEquals(e.eval("var foo = 'original context';", origContext), null);
-        assertEquals(e.eval("var foo = 'new context';", newCtxt), null);
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        assertEquals(e.eval("var foo = 'newer context';", newCtxt), null);
-        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
-
-        t3.start();
-        t4.start();
-        t3.join();
-        t4.join();
-
-        assertEquals(e.eval(sharedScript), "original context");
-        assertEquals(e.eval(sharedScript, newCtxt), "newer context");
-    }
-
-    /**
-     * Test multi-threaded access to undefined global variables for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedGlobalTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        assertEquals(e.eval("foo = 'original context';", origContext), "original context");
-        assertEquals(e.eval("foo = 'new context';", newCtxt), "new context");
-        final String sharedScript = "foo";
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        final Object obj3 = e.eval("delete foo; foo = 'newer context';", newCtxt);
-        assertEquals(obj3, "newer context");
-        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
-
-        t3.start();
-        t4.start();
-        t3.join();
-        t4.join();
-
-        Assert.assertEquals(e.eval(sharedScript), "original context");
-        Assert.assertEquals(e.eval(sharedScript, newCtxt), "newer context");
-    }
-
-    /**
-     * Test multi-threaded access using the postfix ++ operator for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedIncTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        assertEquals(e.eval("var x = 0;", origContext), null);
-        assertEquals(e.eval("var x = 2;", newCtxt), null);
-        final String sharedScript = "x++;";
-
-        final Thread t1 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    for (int i = 0; i < 1000; i++) {
-                        assertEquals(e.eval(sharedScript, origContext), (double)i);
-                    }
-                } catch (final ScriptException se) {
-                    fail(se.toString());
-                }
-            }
-        });
-        final Thread t2 = new Thread(new Runnable() {
-            @Override
-            public void run() {
-                try {
-                    for (int i = 2; i < 1000; i++) {
-                        assertEquals(e.eval(sharedScript, newCtxt), (double)i);
-                    }
-                } catch (final ScriptException se) {
-                    fail(se.toString());
-                }
-            }
-        });
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-    }
-
-    /**
-     * Test multi-threaded access to primitive prototype properties for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedPrimitiveTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        final Object obj1 = e.eval("String.prototype.foo = 'original context';", origContext);
-        final Object obj2 = e.eval("String.prototype.foo = 'new context';", newCtxt);
-        assertEquals(obj1, "original context");
-        assertEquals(obj2, "new context");
-        final String sharedScript = "''.foo";
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        final Object obj3 = e.eval("delete String.prototype.foo; Object.prototype.foo = 'newer context';", newCtxt);
-        assertEquals(obj3, "newer context");
-        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
-
-        t3.start();
-        t4.start();
-        t3.join();
-        t4.join();
-
-        Assert.assertEquals(e.eval(sharedScript), "original context");
-        Assert.assertEquals(e.eval(sharedScript, newCtxt), "newer context");
-    }
-
-
-    /**
-     * Test multi-threaded access to prototype user accessor properties for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedAccessorTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        e.eval("Object.defineProperty(Object.prototype, 'foo', { get: function() 'original context' })", origContext);
-        e.eval("Object.defineProperty(Object.prototype, 'foo', { get: function() 'new context', configurable: true })", newCtxt);
-        final String sharedScript = "({}).foo";
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        final Object obj3 = e.eval("delete Object.prototype.foo; Object.prototype.foo = 'newer context';", newCtxt);
-        assertEquals(obj3, "newer context");
-        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
-
-        t3.start();
-        t4.start();
-        t3.join();
-        t4.join();
-    }
-
-    /**
-     * Test multi-threaded access to primitive prototype user accessor properties for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedPrimitiveAccessorTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        e.eval("Object.defineProperty(String.prototype, 'foo', { get: function() 'original context' })", origContext);
-        e.eval("Object.defineProperty(String.prototype, 'foo', { get: function() 'new context' })", newCtxt);
-        final String sharedScript = "''.foo";
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        final Object obj3 = e.eval("delete String.prototype.foo; Object.prototype.foo = 'newer context';", newCtxt);
-        assertEquals(obj3, "newer context");
-        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
-
-        t3.start();
-        t4.start();
-        t3.join();
-        t4.join();
-    }
-
-    /**
-     * Test multi-threaded scope function invocation for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedFunctionTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-        e.eval(new URLReader(ScopeTest.class.getResource("resources/func.js")), origContext);
-        assertEquals(origContext.getAttribute("scopeVar"), 1);
-        assertEquals(e.eval("scopeTest()"), 1);
-
-        e.eval(new URLReader(ScopeTest.class.getResource("resources/func.js")), newCtxt);
-        assertEquals(newCtxt.getAttribute("scopeVar"), 1);
-        assertEquals(e.eval("scopeTest();", newCtxt), 1);
-
-        assertEquals(e.eval("scopeVar = 3;", newCtxt), 3);
-        assertEquals(newCtxt.getAttribute("scopeVar"), 3);
-
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, "scopeTest()", 1, 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, "scopeTest()", 3, 1000));
-
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-    }
-
-    /**
-     * Test multi-threaded access to global getters and setters for shared script classes with multiple globals.
-     */
-    @Test
-    public static void getterSetterTest() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-        final String sharedScript = "accessor1";
-
-        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), origContext);
-        assertEquals(e.eval("accessor1 = 1;"), 1);
-        assertEquals(e.eval(sharedScript), 1);
-
-        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), newCtxt);
-        assertEquals(e.eval("accessor1 = 2;", newCtxt), 2);
-        assertEquals(e.eval(sharedScript, newCtxt), 2);
-
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, 1, 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, 2, 1000));
-
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        assertEquals(e.eval(sharedScript), 1);
-        assertEquals(e.eval(sharedScript, newCtxt), 2);
-        assertEquals(e.eval("v"), 1);
-        assertEquals(e.eval("v", newCtxt), 2);
-    }
-
-    /**
-     * Test multi-threaded access to global getters and setters for shared script classes with multiple globals.
-     */
-    @Test
-    public static void getterSetter2Test() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-        final String sharedScript = "accessor2";
-
-        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), origContext);
-        assertEquals(e.eval("accessor2 = 1;"), 1);
-        assertEquals(e.eval(sharedScript), 1);
-
-        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), newCtxt);
-        assertEquals(e.eval("accessor2 = 2;", newCtxt), 2);
-        assertEquals(e.eval(sharedScript, newCtxt), 2);
-
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, 1, 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, 2, 1000));
-
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        assertEquals(e.eval(sharedScript), 1);
-        assertEquals(e.eval(sharedScript, newCtxt), 2);
-        assertEquals(e.eval("x"), 1);
-        assertEquals(e.eval("x", newCtxt), 2);
-    }
-
-    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
-    @Test
-    public static void contextOverwriteTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = new SimpleBindings();
-        b.put("context", "hello");
-        b.put("foo", 32);
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-        e.setContext(newCtxt);
-        assertEquals(e.eval("context"), "hello");
-        assertEquals(((Number)e.eval("foo")).intValue(), 32);
-    }
-
-    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
-    @Test
-    public static void contextOverwriteInScriptTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.put("foo", 32);
-
-        assertEquals(((Number)e.eval("foo")).intValue(), 32);
-        assertEquals(e.eval("context = 'bar'"), "bar");
-        assertEquals(((Number)e.eval("foo")).intValue(), 32);
-    }
-
-    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
-    @Test
-    public static void engineOverwriteTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Bindings b = new SimpleBindings();
-        b.put("engine", "hello");
-        b.put("foo", 32);
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-        e.setContext(newCtxt);
-        assertEquals(e.eval("engine"), "hello");
-        assertEquals(((Number)e.eval("foo")).intValue(), 32);
-    }
-
-    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
-    @Test
-    public static void engineOverwriteInScriptTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.put("foo", 32);
-
-        assertEquals(((Number)e.eval("foo")).intValue(), 32);
-        assertEquals(e.eval("engine = 'bar'"), "bar");
-        assertEquals(((Number)e.eval("foo")).intValue(), 32);
-    }
-
-    // @bug 8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
-    @Test
-    public static void testMegamorphicGetInGlobal() throws Exception {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine engine = m.getEngineByName("nashorn");
-        final String script = "foo";
-        // "foo" is megamorphic because of different global scopes.
-        // Make sure ScriptContext variable search works even after
-        // it becomes megamorphic.
-        for (int index = 0; index < 25; index++) {
-            final Bindings bindings = new SimpleBindings();
-            bindings.put("foo", index);
-            final Number value = (Number)engine.eval(script, bindings);
-            assertEquals(index, value.intValue());
-        }
-    }
-
-    /**
-     * Test "slow" scopes involving {@code with} and {@code eval} statements for shared script classes with multiple globals.
-     * @throws ScriptException
-     * @throws InterruptedException
-     */
-    @Test
-    public static void testSlowScope() throws ScriptException, InterruptedException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        for (int i = 0; i < 100; i++) {
-            final Bindings b = e.createBindings();
-            final ScriptContext ctxt = new SimpleScriptContext();
-            ctxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-
-            e.eval(new URLReader(ScopeTest.class.getResource("resources/witheval.js")), ctxt);
-            assertEquals(e.eval("a", ctxt), 1);
-            assertEquals(b.get("a"), 1);
-            assertEquals(e.eval("b", ctxt), 3);
-            assertEquals(b.get("b"), 3);
-            assertEquals(e.eval("c", ctxt), 10);
-            assertEquals(b.get("c"), 10);
-        }
-    }
-
-    private static class ScriptRunner implements Runnable {
-
-        final ScriptEngine engine;
-        final ScriptContext context;
-        final String source;
-        final Object expected;
-        final int iterations;
-
-        ScriptRunner(final ScriptEngine engine, final ScriptContext context, final String source, final Object expected, final int iterations) {
-            this.engine = engine;
-            this.context = context;
-            this.source = source;
-            this.expected = expected;
-            this.iterations = iterations;
-        }
-
-        @Override
-        public void run() {
-            try {
-                for (int i = 0; i < iterations; i++) {
-                    assertEquals(engine.eval(source, context), expected);
-                }
-            } catch (final ScriptException se) {
-                throw new RuntimeException(se);
-            }
-        }
-    }
-
-    // @bug 8071678: NashornScriptEngine returns javax.script.ScriptContext instance
-    // with get/setAttribute methods insonsistent for GLOBAL_SCOPE
-    @Test
-    public void testGlobalScopeSearch() throws Exception {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptContext c = e.getContext();
-        c.setAttribute("name1234", "value", ScriptContext.GLOBAL_SCOPE);
-        assertEquals(c.getAttribute("name1234"), "value");
-        assertEquals(c.getAttributesScope("name1234"),
-            ScriptContext.GLOBAL_SCOPE);
-    }
-
-    // @bug 8071594: NashornScriptEngine returns javax.script.ScriptContext instance
-    // which doesn't completely conform to the spec regarding exceptions throwing
-    @Test
-    public void testScriptContext_NPE_IAE() throws Exception {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptContext c = e.getContext();
-        try {
-            c.getAttribute("");
-            throw new AssertionError("should have thrown IAE");
-        } catch (IllegalArgumentException iae1) {}
-
-        try {
-            c.getAttribute(null);
-            throw new AssertionError("should have thrown NPE");
-        } catch (NullPointerException npe1) {}
-
-        try {
-            c.getAttribute("", ScriptContext.ENGINE_SCOPE);
-            throw new AssertionError("should have thrown IAE");
-        } catch (IllegalArgumentException iae2) {}
-
-        try {
-            c.getAttribute(null, ScriptContext.ENGINE_SCOPE);
-            throw new AssertionError("should have thrown NPE");
-        } catch (NullPointerException npe2) {}
-
-        try {
-            c.removeAttribute("", ScriptContext.ENGINE_SCOPE);
-            throw new AssertionError("should have thrown IAE");
-        } catch (IllegalArgumentException iae3) {}
-
-        try {
-            c.removeAttribute(null, ScriptContext.ENGINE_SCOPE);
-            throw new AssertionError("should have thrown NPE");
-        } catch (NullPointerException npe3) {}
-
-        try {
-            c.setAttribute("", "value", ScriptContext.ENGINE_SCOPE);
-            throw new AssertionError("should have thrown IAE");
-        } catch (IllegalArgumentException iae4) {}
-
-        try {
-            c.setAttribute(null, "value", ScriptContext.ENGINE_SCOPE);
-            throw new AssertionError("should have thrown NPE");
-        } catch (NullPointerException npe4) {}
-
-        try {
-            c.getAttributesScope("");
-            throw new AssertionError("should have thrown IAE");
-        } catch (IllegalArgumentException iae5) {}
-
-        try {
-            c.getAttributesScope(null);
-            throw new AssertionError("should have thrown NPE");
-        } catch (NullPointerException npe5) {}
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineSecurityTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,311 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-import static org.testng.Assert.fail;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.annotations.Test;
-
-/**
- * jsr223 tests for security access checks.
- */
-@SuppressWarnings("javadoc")
-public class ScriptEngineSecurityTest {
-
-    private static void log(final String msg) {
-        org.testng.Reporter.log(msg, true);
-    }
-
-    @Test
-    public void securityPackagesTest() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("var v = Packages.sun.misc.Unsafe;");
-            fail("should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (exp instanceof SecurityException) {
-                log("got " + exp + " as expected");
-            } else {
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    public void securityJavaTypeTest() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("var v = Java.type('sun.misc.Unsafe');");
-            fail("should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (exp instanceof SecurityException) {
-                log("got " + exp + " as expected");
-            } else {
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    public void securityClassForNameTest() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("var v = java.lang.Class.forName('sun.misc.Unsafe');");
-            fail("should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (exp instanceof SecurityException) {
-                log("got " + exp + " as expected");
-            } else {
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    @Test
-    public void securitySystemExit() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("java.lang.System.exit(0);");
-            fail("should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (exp instanceof SecurityException) {
-                log("got " + exp + " as expected");
-            } else {
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-
-    @Test
-    public void securitySystemExitFromFinalizerThread() throws ScriptException {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.eval("var o = Java.extend(Java.type('javax.imageio.spi.ServiceRegistry'), { deregisterAll: this.exit.bind(null, 1234)});\n" +
-                "new o(new java.util.ArrayList().iterator())");
-        System.gc();
-        System.runFinalization();
-        // NOTE: this test just exits the VM if it fails.
-    }
-
-    @Test
-    public void securitySystemLoadLibrary() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("java.lang.System.loadLibrary('foo');");
-            fail("should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (exp instanceof SecurityException) {
-                log("got " + exp + " as expected");
-            } else {
-                fail(exp.getMessage());
-            }
-        }
-    }
-
-    // @bug 8032948: Nashorn linkages awry
-    @SuppressWarnings("serial")
-    public static class FakeProxy extends Proxy {
-        public FakeProxy(final InvocationHandler ih) {
-            super(ih);
-        }
-
-        public static Class<?> makeProxyClass(final ClassLoader cl, final Class<?>... ifaces) {
-            return Proxy.getProxyClass(cl, ifaces);
-        }
-    }
-
-    @Test
-    public void fakeProxySubclassAccessCheckTest() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        e.put("name", ScriptEngineSecurityTest.class.getName());
-        e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
-        e.put("intfs", new Class[] { Runnable.class });
-
-        final String getClass = "Java.type(name + '$FakeProxy').getProxyClass(cl, intfs);";
-
-        // Should not be able to call static methods of Proxy via fake subclass
-        try {
-            e.eval(getClass);
-            fail("should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (! (exp instanceof SecurityException)) {
-                fail("SecurityException expected, got " + exp);
-            }
-        }
-    }
-
-    @Test
-    public void fakeProxySubclassAccessCheckTest2() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        e.put("name", ScriptEngineSecurityTest.class.getName());
-        e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
-        e.put("intfs", new Class[] { Runnable.class });
-
-        final String getClass = "Java.type(name + '$FakeProxy').makeProxyClass(cl, intfs);";
-
-        // Should not be able to call static methods of Proxy via fake subclass
-        try {
-            e.eval(getClass);
-            fail("should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (! (exp instanceof SecurityException)) {
-                fail("SecurityException expected, got " + exp);
-            }
-        }
-    }
-
-    @Test
-    public static void proxyStaticAccessCheckTest() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Runnable r = (Runnable)Proxy.newProxyInstance(
-            ScriptEngineTest.class.getClassLoader(),
-            new Class[] { Runnable.class },
-            new InvocationHandler() {
-                @Override
-                public Object invoke(final Object p, final Method mtd, final Object[] a) {
-                    return null;
-                }
-            });
-
-        e.put("rc", r.getClass());
-        e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
-        e.put("intfs", new Class[] { Runnable.class });
-
-        // make sure static methods of Proxy is not accessible via subclass
-        try {
-            e.eval("rc.static.getProxyClass(cl, intfs)");
-            fail("Should have thrown SecurityException");
-        } catch (final Exception exp) {
-            if (! (exp instanceof SecurityException)) {
-                fail("SecurityException expected, got " + exp);
-            }
-        }
-    }
-
-
-    @Test
-    public void nashornConfigSecurityTest() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        try {
-            fac.getScriptEngine(new ClassFilter() {
-               @Override
-               public boolean exposeToScripts(final String name) {
-                   return true;
-               }
-            });
-            fail("SecurityException should have been thrown");
-        } catch (final SecurityException e) {
-            //empty
-        }
-    }
-
-    @Test
-    public void nashornConfigSecurityTest2() {
-        if (System.getSecurityManager() == null) {
-            // pass vacuously
-            return;
-        }
-
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        try {
-            fac.getScriptEngine(new String[0], null, new ClassFilter() {
-               @Override
-               public boolean exposeToScripts(final String name) {
-                   return true;
-               }
-            });
-            fail("SecurityException should have been thrown");
-        } catch (final SecurityException e) {
-            //empty
-        }
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptEngineTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,880 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.Collections;
-import java.util.concurrent.Callable;
-import java.util.concurrent.atomic.AtomicBoolean;
-import java.util.function.Consumer;
-import java.util.function.Function;
-import javax.script.Bindings;
-import javax.script.Compilable;
-import javax.script.CompiledScript;
-import javax.script.Invocable;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import javax.script.SimpleScriptContext;
-import org.testng.annotations.Test;
-
-/**
- * Tests for JSR-223 script engine for Nashorn.
- *
- * @test
- * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest
- * @run testng/othervm jdk.nashorn.api.scripting.ScriptEngineTest
- */
-@SuppressWarnings("javadoc")
-public class ScriptEngineTest {
-
-    private static void log(final String msg) {
-        org.testng.Reporter.log(msg, true);
-    }
-
-    @Test
-    public void argumentsTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        final String[] args = new String[] { "hello", "world" };
-        try {
-            e.put("arguments", args);
-            final Object arg0 = e.eval("arguments[0]");
-            final Object arg1 = e.eval("arguments[1]");
-            assertEquals(args[0], arg0);
-            assertEquals(args[1], arg1);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void argumentsWithTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        final String[] args = new String[] { "hello", "world" };
-        try {
-            e.put("arguments", args);
-            final Object arg0 = e.eval("var imports = new JavaImporter(java.io); " +
-                    " with(imports) { arguments[0] }");
-            final Object arg1 = e.eval("var imports = new JavaImporter(java.util, java.io); " +
-                    " with(imports) { arguments[1] }");
-            assertEquals(args[0], arg0);
-            assertEquals(args[1], arg1);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void argumentsEmptyTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            assertEquals(e.eval("arguments instanceof Array"), true);
-            assertEquals(e.eval("arguments.length == 0"), true);
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void factoryTests() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        assertNotNull(e);
-
-        final ScriptEngineFactory fac = e.getFactory();
-
-        assertEquals(fac.getLanguageName(), "ECMAScript");
-        assertEquals(fac.getParameter(ScriptEngine.NAME), "javascript");
-        assertEquals(fac.getLanguageVersion(), "ECMA - 262 Edition 5.1");
-        assertEquals(fac.getEngineName(), "Oracle Nashorn");
-        assertEquals(fac.getOutputStatement("context"), "print(context)");
-        assertEquals(fac.getProgram("print('hello')", "print('world')"), "print('hello');print('world');");
-        assertEquals(fac.getParameter(ScriptEngine.NAME), "javascript");
-
-        boolean seenJS = false;
-        for (final String ext : fac.getExtensions()) {
-            if (ext.equals("js")) {
-                seenJS = true;
-            }
-        }
-
-        assertEquals(seenJS, true);
-        final String str = fac.getMethodCallSyntax("obj", "foo", "x");
-        assertEquals(str, "obj.foo(x)");
-
-        boolean seenNashorn = false, seenJavaScript = false, seenECMAScript = false;
-        for (final String name : fac.getNames()) {
-            switch (name) {
-                case "nashorn": seenNashorn = true; break;
-                case "javascript": seenJavaScript = true; break;
-                case "ECMAScript": seenECMAScript = true; break;
-            default:
-                break;
-            }
-        }
-
-        assertTrue(seenNashorn);
-        assertTrue(seenJavaScript);
-        assertTrue(seenECMAScript);
-
-        boolean seenAppJS = false, seenAppECMA = false, seenTextJS = false, seenTextECMA = false;
-        for (final String mime : fac.getMimeTypes()) {
-            switch (mime) {
-                case "application/javascript": seenAppJS = true; break;
-                case "application/ecmascript": seenAppECMA = true; break;
-                case "text/javascript": seenTextJS = true; break;
-                case "text/ecmascript": seenTextECMA = true; break;
-            default:
-                break;
-            }
-        }
-
-        assertTrue(seenAppJS);
-        assertTrue(seenAppECMA);
-        assertTrue(seenTextJS);
-        assertTrue(seenTextECMA);
-    }
-
-    @Test
-    public void evalTests() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.put(ScriptEngine.FILENAME, "myfile.js");
-
-        try {
-            e.eval("print('hello')");
-        } catch (final ScriptException se) {
-            fail(se.getMessage());
-        }
-        try {
-            e.eval("print('hello)");
-            fail("script exception expected");
-        } catch (final ScriptException se) {
-            assertEquals(se.getLineNumber(), 1);
-            assertEquals(se.getColumnNumber(), 13);
-            assertEquals(se.getFileName(), "myfile.js");
-            // se.printStackTrace();
-        }
-
-        try {
-            Object obj = e.eval("34 + 41");
-            assertTrue(34.0 + 41.0 == ((Number)obj).doubleValue());
-            obj = e.eval("x = 5");
-            assertTrue(5.0 == ((Number)obj).doubleValue());
-        } catch (final ScriptException se) {
-            se.printStackTrace();
-            fail(se.getMessage());
-        }
-    }
-
-    @Test
-    public void compileTests() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        CompiledScript script = null;
-
-        try {
-            script = ((Compilable)e).compile("print('hello')");
-        } catch (final ScriptException se) {
-            fail(se.getMessage());
-        }
-
-        try {
-            script.eval();
-        } catch (final ScriptException | NullPointerException se) {
-            se.printStackTrace();
-            fail(se.getMessage());
-        }
-
-        // try to compile from a Reader
-        try {
-            script = ((Compilable)e).compile(new StringReader("print('world')"));
-        } catch (final ScriptException se) {
-            fail(se.getMessage());
-        }
-
-        try {
-            script.eval();
-        } catch (final ScriptException | NullPointerException se) {
-            se.printStackTrace();
-            fail(se.getMessage());
-        }
-    }
-
-    @Test
-    public void compileAndEvalInDiffContextTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine engine = m.getEngineByName("js");
-        final Compilable compilable = (Compilable) engine;
-        final CompiledScript compiledScript = compilable.compile("foo");
-        final ScriptContext ctxt = new SimpleScriptContext();
-        ctxt.setAttribute("foo", "hello", ScriptContext.ENGINE_SCOPE);
-        assertEquals(compiledScript.eval(ctxt), "hello");
-    }
-
-    @Test
-    public void accessGlobalTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            e.eval("var x = 'hello'");
-            assertEquals(e.get("x"), "hello");
-        } catch (final ScriptException exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void exposeGlobalTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            e.put("y", "foo");
-            e.eval("print(y)");
-        } catch (final ScriptException exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void putGlobalFunctionTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        e.put("callable", new Callable<String>() {
-            @Override
-            public String call() throws Exception {
-                return "callable was called";
-            }
-        });
-
-        try {
-            e.eval("print(callable.call())");
-        } catch (final ScriptException exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void windowAlertTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Window window = new Window();
-
-        try {
-            e.put("window", window);
-            e.eval("print(window.alert)");
-            e.eval("window.alert('calling window.alert...')");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void windowLocationTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Window window = new Window();
-
-        try {
-            e.put("window", window);
-            e.eval("print(window.location)");
-            final Object locationValue = e.eval("window.getLocation()");
-            assertEquals(locationValue, "http://localhost:8080/window");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void windowItemTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Window window = new Window();
-
-        try {
-            e.put("window", window);
-            final String item1 = (String)e.eval("window.item(65535)");
-            assertEquals(item1, "ffff");
-            final String item2 = (String)e.eval("window.item(255)");
-            assertEquals(item2, "ff");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void windowEventTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Window window = new Window();
-
-        try {
-            e.put("window", window);
-            e.eval("window.onload = function() { print('window load event fired'); return true }");
-            assertTrue((Boolean)e.eval("window.onload.loaded()"));
-            final WindowEventHandler handler = window.getOnload();
-            assertNotNull(handler);
-            assertTrue(handler.loaded());
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void throwTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.put(ScriptEngine.FILENAME, "throwtest.js");
-
-        try {
-            e.eval("throw 'foo'");
-        } catch (final ScriptException exp) {
-            log(exp.getMessage());
-            assertEquals(exp.getMessage(), "foo in throwtest.js at line number 1 at column number 0");
-            assertEquals(exp.getFileName(), "throwtest.js");
-            assertEquals(exp.getLineNumber(), 1);
-        }
-    }
-
-    @Test
-    public void setTimeoutTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final Window window = new Window();
-
-        try {
-            final Class<?> setTimeoutParamTypes[] = { Window.class, String.class, int.class };
-            final Method setTimeout = Window.class.getDeclaredMethod("setTimeout", setTimeoutParamTypes);
-            assertNotNull(setTimeout);
-            e.put("window", window);
-            e.eval("window.setTimeout('foo()', 100)");
-
-            // try to make setTimeout global
-            e.put("setTimeout", setTimeout);
-            // TODO: java.lang.ClassCastException: required class
-            // java.lang.Integer but encountered class java.lang.Double
-            // e.eval("setTimeout('foo2()', 200)");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void setWriterTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final StringWriter sw = new StringWriter();
-        e.getContext().setWriter(sw);
-
-        try {
-            e.eval("print('hello world')");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-        assertEquals(sw.toString(), println("hello world"));
-    }
-
-    @Test
-    public void redefineEchoTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        try {
-            e.eval("var echo = {}; if (typeof echo !== 'object') { throw 'echo is a '+typeof echo; }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-    @Test
-    public void noEnumerablePropertiesTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("for (i in this) { throw 'found property: ' + i }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void noRefErrorForGlobalThisAccessTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("this.foo");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void refErrorForUndeclaredAccessTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("try { print(foo); throw 'no ref error' } catch (e) { if (!(e instanceof ReferenceError)) throw e; }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void typeErrorForGlobalThisCallTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("try { this.foo() } catch(e) { if (! (e instanceof TypeError)) throw 'no type error' }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void refErrorForUndeclaredCallTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("try { foo() } catch(e) { if (! (e instanceof ReferenceError)) throw 'no ref error' }");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    // check that print function prints arg followed by newline char
-    public void printTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final StringWriter sw = new StringWriter();
-        e.getContext().setWriter(sw);
-        try {
-            e.eval("print('hello')");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-
-        assertEquals(sw.toString(), println("hello"));
-    }
-
-    @Test
-    // check that print prints all arguments (more than one)
-    public void printManyTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final StringWriter sw = new StringWriter();
-        e.getContext().setWriter(sw);
-        try {
-            e.eval("print(34, true, 'hello')");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-
-        assertEquals(sw.toString(), println("34 true hello"));
-    }
-
-    @Test
-    public void scriptObjectAutoConversionTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.eval("obj = { foo: 'hello' }");
-        e.put("Window", e.eval("Packages.jdk.nashorn.api.scripting.Window"));
-        assertEquals(e.eval("Window.funcJSObject(obj)"), "hello");
-        assertEquals(e.eval("Window.funcScriptObjectMirror(obj)"), "hello");
-        assertEquals(e.eval("Window.funcMap(obj)"), "hello");
-        assertEquals(e.eval("Window.funcJSObject(obj)"), "hello");
-    }
-
-    // @bug 8032948: Nashorn linkages awry
-    @Test
-    public void checkProxyAccess() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final boolean[] reached = new boolean[1];
-        final Runnable r = (Runnable)Proxy.newProxyInstance(
-            ScriptEngineTest.class.getClassLoader(),
-            new Class[] { Runnable.class },
-            new InvocationHandler() {
-                @Override
-                public Object invoke(final Object p, final Method mtd, final Object[] a) {
-                    reached[0] = true;
-                    return null;
-                }
-            });
-
-        e.put("r", r);
-        e.eval("r.run()");
-
-        assertTrue(reached[0]);
-    }
-
-    // properties that can be read by any code
-    private static String[] propNames = {
-        "java.version",
-        "java.vendor",
-        "java.vendor.url",
-        "java.class.version",
-        "os.name",
-        "os.version",
-        "os.arch",
-        "file.separator",
-        "path.separator",
-        "line.separator",
-        "java.specification.version",
-        "java.specification.vendor",
-        "java.specification.name",
-        "java.vm.specification.version",
-        "java.vm.specification.vendor",
-        "java.vm.specification.name",
-        "java.vm.version",
-        "java.vm.vendor",
-        "java.vm.name"
-    };
-
-    // @bug 8033924: Default permissions are not given for eval code
-    @Test
-    public void checkPropertyReadPermissions() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        for (final String name : propNames) {
-            checkProperty(e, name);
-        }
-    }
-
-    // @bug 8046013: TypeError: Cannot apply "with" to non script object
-    @Test
-    public void withOnMirrorTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        final Object obj = e.eval("({ foo: 'hello'})");
-        final Object[] arr = new Object[1];
-        arr[0] = obj;
-        e.put("arr", arr);
-        final Object res = e.eval("var res; with(arr[0]) { res = foo; }; res");
-        assertEquals(res, "hello");
-    }
-
-    // @bug 8054223: Nashorn: AssertionError when use __DIR__ and ScriptEngine.eval()
-    @Test
-    public void check__DIR__Test() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        e.eval("__DIR__");
-    }
-
-    // @bug 8050432:javax.script.filename variable should not be enumerable
-    // with nashorn engine's ENGINE_SCOPE bindings
-    @Test
-    public void enumerableGlobalsTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        e.put(ScriptEngine.FILENAME, "test");
-        final Object enumerable = e.eval(
-            "Object.getOwnPropertyDescriptor(this, " +
-            " 'javax.script.filename').enumerable");
-        assertEquals(enumerable, Boolean.FALSE);
-    }
-
-    public static class Context {
-        private Object myobj;
-
-        public void set(final Object o) {
-            myobj = o;
-        }
-
-        public Object get() {
-            return myobj;
-        }
-    }
-
-    // @bug 8050977: Java8 Javascript Nashorn exception:
-    // no current Global instance for nashorn
-    @Test
-    public void currentGlobalMissingTest() throws Exception {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine e = manager.getEngineByName("nashorn");
-
-        final Context ctx = new Context();
-        e.put("ctx", ctx);
-        e.eval("var obj = { foo: function(str) { return str.toUpperCase() } }");
-        e.eval("ctx.set(obj)");
-        final Invocable inv = (Invocable)e;
-        assertEquals("HELLO", inv.invokeMethod(ctx.get(), "foo", "hello"));
-        // try object literal
-        e.eval("ctx.set({ bar: function(str) { return str.toLowerCase() } })");
-        assertEquals("hello", inv.invokeMethod(ctx.get(), "bar", "HELLO"));
-        // try array literal
-        e.eval("var arr = [ 'hello', 'world' ]");
-        e.eval("ctx.set(arr)");
-        assertEquals("helloworld", inv.invokeMethod(ctx.get(), "join", ""));
-    }
-
-    // @bug 8068524: NashornScriptEngineFactory.getParameter() throws IAE
-    // for an unknown key, doesn't conform to the general spec
-    @Test
-    public void getParameterInvalidKeyTest() throws Exception {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine e = manager.getEngineByName("nashorn");
-        // no exception expected here!
-        Object value = e.getFactory().getParameter("no value assigned to this key");
-        assertNull(value);
-    }
-
-    // @bug JDK-8068889: ConsString arguments to a functional interface wasn't converted to string.
-    @Test
-    public void functionalInterfaceStringTest() throws Exception {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine e = manager.getEngineByName("nashorn");
-        final AtomicBoolean invoked = new AtomicBoolean(false);
-        e.put("f", new Function<String, String>() {
-            @Override
-            public String apply(String t) {
-                invoked.set(true);
-                return t;
-            }
-        });
-        assertEquals(e.eval("var x = 'a'; x += 'b'; f(x)"), "ab");
-        assertTrue(invoked.get());
-    }
-
-    // @bug JDK-8068889: ScriptObject arguments to a functional interface wasn't converted to a mirror.
-    @Test
-    public void functionalInterfaceObjectTest() throws Exception {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine e = manager.getEngineByName("nashorn");
-        final AtomicBoolean invoked = new AtomicBoolean(false);
-        e.put("c", new Consumer<Object>() {
-            @Override
-            public void accept(Object t) {
-                assertTrue(t instanceof ScriptObjectMirror);
-                assertEquals(((ScriptObjectMirror)t).get("a"), "xyz");
-                invoked.set(true);
-            }
-        });
-        e.eval("var x = 'xy'; x += 'z';c({a:x})");
-        assertTrue(invoked.get());
-    }
-
-    @Test
-    public void testLengthOnArrayLikeObjects() throws Exception {
-        final ScriptEngine e = new ScriptEngineManager().getEngineByName("nashorn");
-        final Object val = e.eval("var arr = { length: 1, 0: 1}; arr.length");
-
-        assertTrue(Number.class.isAssignableFrom(val.getClass()));
-        assertTrue(((Number)val).intValue() == 1);
-    }
-
-    // @bug JDK-8068603: NashornScriptEngine.put/get() impls don't conform to NPE, IAE spec assertions
-    @Test
-    public void illegalBindingsValuesTest() throws Exception {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine e = manager.getEngineByName("nashorn");
-
-        try {
-            e.put(null, "null-value");
-            fail();
-        } catch (NullPointerException x) {
-            // expected
-        }
-
-        try {
-            e.put("", "empty-value");
-            fail();
-        } catch (IllegalArgumentException x) {
-            // expected
-        }
-
-        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
-        assertTrue(b instanceof ScriptObjectMirror);
-
-        try {
-            b.put(null, "null-value");
-            fail();
-        } catch (NullPointerException x) {
-            // expected
-        }
-
-        try {
-            b.put("", "empty-value");
-            fail();
-        } catch (IllegalArgumentException x) {
-            // expected
-        }
-
-        try {
-            b.get(null);
-            fail();
-        } catch (NullPointerException x) {
-            // expected
-        }
-
-        try {
-            b.get("");
-            fail();
-        } catch (IllegalArgumentException x) {
-            // expected
-        }
-
-        try {
-            b.get(1);
-            fail();
-        } catch (ClassCastException x) {
-            // expected
-        }
-
-        try {
-            b.remove(null);
-            fail();
-        } catch (NullPointerException x) {
-            // expected
-        }
-
-        try {
-            b.remove("");
-            fail();
-        } catch (IllegalArgumentException x) {
-            // expected
-        }
-
-        try {
-            b.remove(1);
-            fail();
-        } catch (ClassCastException x) {
-            // expected
-        }
-
-        try {
-            b.containsKey(null);
-            fail();
-        } catch (NullPointerException x) {
-            // expected
-        }
-
-        try {
-            b.containsKey("");
-            fail();
-        } catch (IllegalArgumentException x) {
-            // expected
-        }
-
-        try {
-            b.containsKey(1);
-            fail();
-        } catch (ClassCastException x) {
-            // expected
-        }
-
-        try {
-            b.putAll(null);
-            fail();
-        } catch (NullPointerException x) {
-            // expected
-        }
-
-        try {
-            b.putAll(Collections.singletonMap((String)null, "null-value"));
-            fail();
-        } catch (NullPointerException x) {
-            // expected
-        }
-
-        try {
-            b.putAll(Collections.singletonMap("", "empty-value"));
-            fail();
-        } catch (IllegalArgumentException x) {
-            // expected
-        }
-    }
-
-    // @bug 8071989: NashornScriptEngine returns javax.script.ScriptContext instance
-    // with insonsistent get/remove methods behavior for undefined attributes
-    @Test
-    public void testScriptContextGetRemoveUndefined() throws Exception {
-        final ScriptEngineManager manager = new ScriptEngineManager();
-        final ScriptEngine e = manager.getEngineByName("nashorn");
-        final ScriptContext ctx = e.getContext();
-        assertNull(ctx.getAttribute("undefinedname", ScriptContext.ENGINE_SCOPE));
-        assertNull(ctx.removeAttribute("undefinedname", ScriptContext.ENGINE_SCOPE));
-    }
-
-    private static void checkProperty(final ScriptEngine e, final String name)
-        throws ScriptException {
-        final String value = System.getProperty(name);
-        e.put("name", name);
-        assertEquals(value, e.eval("java.lang.System.getProperty(name)"));
-    }
-
-    private static final String LINE_SEPARATOR = System.getProperty("line.separator");
-
-    // Returns String that would be the result of calling PrintWriter.println
-    // of the given String. (This is to handle platform specific newline).
-    private static String println(final String str) {
-        return str + LINE_SEPARATOR;
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/ScriptObjectMirrorTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,387 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.nio.ByteBuffer;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.function.Function;
-import javax.script.Bindings;
-import javax.script.Invocable;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import org.testng.annotations.Test;
-
-/**
- * Tests to check jdk.nashorn.api.scripting.ScriptObjectMirror API.
- */
-@SuppressWarnings("javadoc")
-public class ScriptObjectMirrorTest {
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void reflectionTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-
-        e.eval("var obj = { x: 344, y: 'nashorn' }");
-
-        int count = 0;
-        Map<Object, Object> map = (Map<Object, Object>) e.get("obj");
-        assertFalse(map.isEmpty());
-        assertTrue(map.keySet().contains("x"));
-        assertTrue(map.containsKey("x"));
-        assertTrue(map.values().contains("nashorn"));
-        assertTrue(map.containsValue("nashorn"));
-        for (final Map.Entry<?, ?> ex : map.entrySet()) {
-            final Object key = ex.getKey();
-            if (key.equals("x")) {
-                assertTrue(344 == ((Number) ex.getValue()).doubleValue());
-                count++;
-            } else if (key.equals("y")) {
-                assertEquals(ex.getValue(), "nashorn");
-                count++;
-            }
-        }
-        assertEquals(2, count);
-        assertEquals(2, map.size());
-
-        // add property
-        map.put("z", "hello");
-        assertEquals(e.eval("obj.z"), "hello");
-        assertEquals(map.get("z"), "hello");
-        assertTrue(map.keySet().contains("z"));
-        assertTrue(map.containsKey("z"));
-        assertTrue(map.values().contains("hello"));
-        assertTrue(map.containsValue("hello"));
-        assertEquals(map.size(), 3);
-
-        final Map<Object, Object> newMap = new HashMap<>();
-        newMap.put("foo", 23.0);
-        newMap.put("bar", true);
-        map.putAll(newMap);
-
-        assertEquals(e.eval("obj.foo"), 23.0);
-        assertEquals(e.eval("obj.bar"), true);
-
-        // remove using map method
-        map.remove("foo");
-        assertEquals(e.eval("typeof obj.foo"), "undefined");
-
-        count = 0;
-        e.eval("var arr = [ true, 'hello' ]");
-        map = (Map<Object, Object>) e.get("arr");
-        assertFalse(map.isEmpty());
-        assertTrue(map.containsKey("length"));
-        assertTrue(map.containsValue("hello"));
-        for (final Map.Entry<?, ?> ex : map.entrySet()) {
-            final Object key = ex.getKey();
-            if (key.equals("0")) {
-                assertEquals(ex.getValue(), Boolean.TRUE);
-                count++;
-            } else if (key.equals("1")) {
-                assertEquals(ex.getValue(), "hello");
-                count++;
-            }
-        }
-        assertEquals(count, 2);
-        assertEquals(map.size(), 2);
-
-        // add element
-        map.put("2", "world");
-        assertEquals(map.get("2"), "world");
-        assertEquals(map.size(), 3);
-
-        // remove all
-        map.clear();
-        assertTrue(map.isEmpty());
-        assertEquals(e.eval("typeof arr[0]"), "undefined");
-        assertEquals(e.eval("typeof arr[1]"), "undefined");
-        assertEquals(e.eval("typeof arr[2]"), "undefined");
-    }
-
-    @Test
-    public void jsobjectTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            e.eval("var obj = { '1': 'world', func: function() { return this.bar; }, bar: 'hello' }");
-            final ScriptObjectMirror obj = (ScriptObjectMirror) e.get("obj");
-
-            // try basic get on existing properties
-            if (!obj.getMember("bar").equals("hello")) {
-                fail("obj.bar != 'hello'");
-            }
-
-            if (!obj.getSlot(1).equals("world")) {
-                fail("obj[1] != 'world'");
-            }
-
-            if (!obj.callMember("func", new Object[0]).equals("hello")) {
-                fail("obj.func() != 'hello'");
-            }
-
-            // try setting properties
-            obj.setMember("bar", "new-bar");
-            obj.setSlot(1, "new-element-1");
-            if (!obj.getMember("bar").equals("new-bar")) {
-                fail("obj.bar != 'new-bar'");
-            }
-
-            if (!obj.getSlot(1).equals("new-element-1")) {
-                fail("obj[1] != 'new-element-1'");
-            }
-
-            // try adding properties
-            obj.setMember("prop", "prop-value");
-            obj.setSlot(12, "element-12");
-            if (!obj.getMember("prop").equals("prop-value")) {
-                fail("obj.prop != 'prop-value'");
-            }
-
-            if (!obj.getSlot(12).equals("element-12")) {
-                fail("obj[12] != 'element-12'");
-            }
-
-            // delete properties
-            obj.removeMember("prop");
-            if ("prop-value".equals(obj.getMember("prop"))) {
-                fail("obj.prop is not deleted!");
-            }
-
-            // Simple eval tests
-            assertEquals(obj.eval("typeof Object"), "function");
-            assertEquals(obj.eval("'nashorn'.substring(3)"), "horn");
-        } catch (final Exception exp) {
-            exp.printStackTrace();
-            fail(exp.getMessage());
-        }
-    }
-
-    @Test
-    public void scriptObjectMirrorToStringTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        try {
-            final Object obj = e.eval("new TypeError('wrong type')");
-            assertEquals(obj.toString(), "TypeError: wrong type", "toString returns wrong value");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-
-        try {
-            final Object obj = e.eval("function func() { print('hello'); }");
-            assertEquals(obj.toString(), "function func() { print('hello'); }", "toString returns wrong value");
-        } catch (final Throwable t) {
-            t.printStackTrace();
-            fail(t.getMessage());
-        }
-    }
-
-    @Test
-    public void mirrorNewObjectGlobalFunctionTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptEngine e2 = m.getEngineByName("nashorn");
-
-        e.eval("function func() {}");
-        e2.put("foo", e.get("func"));
-        final ScriptObjectMirror e2global = (ScriptObjectMirror)e2.eval("this");
-        final Object newObj = ((ScriptObjectMirror)e2global.getMember("foo")).newObject();
-        assertTrue(newObj instanceof ScriptObjectMirror);
-    }
-
-    @Test
-    public void mirrorNewObjectInstanceFunctionTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptEngine e2 = m.getEngineByName("nashorn");
-
-        e.eval("function func() {}");
-        e2.put("func", e.get("func"));
-        final ScriptObjectMirror e2obj = (ScriptObjectMirror)e2.eval("({ foo: func })");
-        final Object newObj = ((ScriptObjectMirror)e2obj.getMember("foo")).newObject();
-        assertTrue(newObj instanceof ScriptObjectMirror);
-    }
-
-    @Test
-    public void indexPropertiesExternalBufferTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptObjectMirror obj = (ScriptObjectMirror)e.eval("var obj = {}; obj");
-        final ByteBuffer buf = ByteBuffer.allocate(5);
-        int i;
-        for (i = 0; i < 5; i++) {
-            buf.put(i, (byte)(i+10));
-        }
-        obj.setIndexedPropertiesToExternalArrayData(buf);
-
-        for (i = 0; i < 5; i++) {
-            assertEquals((byte)(i+10), ((Number)e.eval("obj[" + i + "]")).byteValue());
-        }
-
-        e.eval("for (i = 0; i < 5; i++) obj[i] = 0");
-        for (i = 0; i < 5; i++) {
-            assertEquals((byte)0, ((Number)e.eval("obj[" + i + "]")).byteValue());
-            assertEquals((byte)0, buf.get(i));
-        }
-    }
-
-    @Test
-    public void conversionTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        final ScriptObjectMirror arr = (ScriptObjectMirror)e.eval("[33, 45, 23]");
-        final int[] intArr = arr.to(int[].class);
-        assertEquals(intArr[0], 33);
-        assertEquals(intArr[1], 45);
-        assertEquals(intArr[2], 23);
-
-        final List<?> list = arr.to(List.class);
-        assertEquals(list.get(0), 33);
-        assertEquals(list.get(1), 45);
-        assertEquals(list.get(2), 23);
-
-        ScriptObjectMirror obj = (ScriptObjectMirror)e.eval(
-            "({ valueOf: function() { return 42 } })");
-        assertEquals(Double.valueOf(42.0), obj.to(Double.class));
-
-        obj = (ScriptObjectMirror)e.eval(
-            "({ toString: function() { return 'foo' } })");
-        assertEquals("foo", obj.to(String.class));
-    }
-
-    // @bug 8044000: Access to undefined property yields "null" instead of "undefined"
-    @Test
-    public void mapScriptObjectMirrorCallsiteTest() throws ScriptException {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine engine = m.getEngineByName("nashorn");
-        final String TEST_SCRIPT = "typeof obj.foo";
-
-        final Bindings global = engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
-        engine.eval("var obj = java.util.Collections.emptyMap()");
-        // this will drive callsite "obj.foo" of TEST_SCRIPT
-        // to use "obj instanceof Map" as it's guard
-        engine.eval(TEST_SCRIPT, global);
-        // redefine 'obj' to be a script object
-        engine.eval("obj = {}");
-
-        final Bindings newGlobal = engine.createBindings();
-        // transfer 'obj' from default global to new global
-        // new global will get a ScriptObjectMirror wrapping 'obj'
-        newGlobal.put("obj", global.get("obj"));
-
-        // Every ScriptObjectMirror is a Map! If callsite "obj.foo"
-        // does not see the new 'obj' is a ScriptObjectMirror, it'll
-        // continue to use Map's get("obj.foo") instead of ScriptObjectMirror's
-        // getMember("obj.foo") - thereby getting null instead of undefined
-        assertEquals("undefined", engine.eval(TEST_SCRIPT, newGlobal));
-    }
-
-    public interface MirrorCheckExample {
-        Object test1(Object arg);
-        Object test2(Object arg);
-        boolean compare(Object o1, Object o2);
-    }
-
-    // @bug 8053910: ScriptObjectMirror causing havoc with Invocation interface
-    @Test
-    public void checkMirrorToObject() throws Exception {
-        final ScriptEngineManager engineManager = new ScriptEngineManager();
-        final ScriptEngine engine = engineManager.getEngineByName("nashorn");
-        final Invocable invocable = (Invocable)engine;
-
-        engine.eval("function test1(arg) { return { arg: arg }; }");
-        engine.eval("function test2(arg) { return arg; }");
-        engine.eval("function compare(arg1, arg2) { return arg1 == arg2; }");
-
-        final Map<String, Object> map = new HashMap<>();
-        map.put("option", true);
-
-        final MirrorCheckExample example = invocable.getInterface(MirrorCheckExample.class);
-
-        final Object value1 = invocable.invokeFunction("test1", map);
-        final Object value2 = example.test1(map);
-        final Object value3 = invocable.invokeFunction("test2", value2);
-        final Object value4 = example.test2(value2);
-
-        // check that Object type argument receives a ScriptObjectMirror
-        // when ScriptObject is passed
-        assertEquals(ScriptObjectMirror.class, value1.getClass());
-        assertEquals(ScriptObjectMirror.class, value2.getClass());
-        assertEquals(ScriptObjectMirror.class, value3.getClass());
-        assertEquals(ScriptObjectMirror.class, value4.getClass());
-        assertTrue((boolean)invocable.invokeFunction("compare", value1, value1));
-        assertTrue(example.compare(value1, value1));
-        assertTrue((boolean)invocable.invokeFunction("compare", value3, value4));
-        assertTrue(example.compare(value3, value4));
-    }
-
-    // @bug 8053910: ScriptObjectMirror causing havoc with Invocation interface
-    @Test
-    public void mirrorUnwrapInterfaceMethod() throws Exception {
-        final ScriptEngineManager engineManager = new ScriptEngineManager();
-        final ScriptEngine engine = engineManager.getEngineByName("nashorn");
-        final Invocable invocable = (Invocable)engine;
-        engine.eval("function apply(obj) { " +
-            " return obj instanceof Packages.jdk.nashorn.api.scripting.ScriptObjectMirror; " +
-            "}");
-        @SuppressWarnings("unchecked")
-        final Function<Object,Object> func = invocable.getInterface(Function.class);
-        assertFalse((boolean)func.apply(engine.eval("({ x: 2 })")));
-    }
-
-    // @bug 8055687: Wrong "this" passed to JSObject.eval call
-    @Test
-    public void checkThisForJSObjectEval() throws Exception {
-        final ScriptEngineManager engineManager = new ScriptEngineManager();
-        final ScriptEngine e = engineManager.getEngineByName("nashorn");
-        final JSObject jsobj = (JSObject)e.eval("({foo: 23, bar: 'hello' })");
-        assertEquals(((Number)jsobj.eval("this.foo")).intValue(), 23);
-        assertEquals(jsobj.eval("this.bar"), "hello");
-        assertEquals(jsobj.eval("String(this)"), "[object Object]");
-        final Object global = e.eval("this");
-        assertFalse(global.equals(jsobj.eval("this")));
-    }
-
-    @Test
-    public void topLevelAnonFuncStatement() throws Exception {
-        final ScriptEngineManager engineManager = new ScriptEngineManager();
-        final ScriptEngine e = engineManager.getEngineByName("nashorn");
-        final JSObject func = (JSObject)e.eval("function(x) { return x + ' world' }");
-        assertTrue(func.isFunction());
-        assertEquals(func.call(e.eval("this"), "hello"), "hello world");
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/VariableArityTestInterface.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-@SuppressWarnings("javadoc")
-public interface VariableArityTestInterface {
-    public String test1(int i, String... strings);
-    public String test2(int i, String... strings);
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/Window.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-import java.util.Map;
-import javax.script.Bindings;
-
-@SuppressWarnings("javadoc")
-public class Window {
-
-    private String location = "http://localhost:8080/window";
-
-    private WindowEventHandler onload   = null;
-
-    public void alert(final String message) {
-        System.out.println("alert: " + message);
-    }
-
-    public String getLocation() {
-        return location;
-    }
-
-    public void setLocation(final String location) {
-        this.location = location;
-    }
-
-    public String item(final int index) {
-        return Integer.toHexString(index);
-    }
-
-    public WindowEventHandler getOnload() {
-        return onload;
-    }
-
-    public void setOnload(final WindowEventHandler onload) {
-        this.onload = onload;
-    }
-
-    public static int setTimeout(final Window self, final String code, final int delay) {
-        return self.setTimeout(code, delay);
-    }
-
-    public int setTimeout(final String code, final int delay) {
-        System.out.println("window.setTimeout: " + delay + ", code: " + code);
-        return 0;
-    }
-
-    public static Object funcJSObject(final JSObject jsobj) {
-        return jsobj.getMember("foo");
-    }
-
-    public static Object funcScriptObjectMirror(final ScriptObjectMirror sobj) {
-        return sobj.get("foo");
-    }
-
-    public static Object funcMap(final Map<?,?> map) {
-        return map.get("foo");
-    }
-
-    public static Object funcBindings(final Bindings bindings) {
-        return bindings.get("foo");
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/WindowEventHandler.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.api.scripting;
-
-@SuppressWarnings("javadoc")
-public interface WindowEventHandler {
-    public boolean loaded();
-}
--- a/nashorn/test/src/jdk/nashorn/api/scripting/resources/func.js	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
-
-var scopeVar = 1;
-var global = this;
-undefGlobal = this;
-
-function scopeTest() {
-    if (this !== global) {
-        throw new Error("this !== global");
-    }
-    if (this !== undefGlobal) {
-        throw new Error("this !== undefinedGlobal")
-    }
-    return scopeVar;
-}
-
-scopeTest();
--- a/nashorn/test/src/jdk/nashorn/api/scripting/resources/gettersetter.js	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
-
-var v;
-
-Object.defineProperty(this, "accessor1", {
-    get: function() { return v; },
-    set: function(n) { v = n; }
-});
-
-Object.defineProperty(this, "accessor2", {
-    get: function() { return x; },
-    set: function(n) { x = n; }
-});
--- a/nashorn/test/src/jdk/nashorn/api/scripting/resources/witheval.js	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
-
-var a;
-
-function outer(p, e) {
-    eval(e);
-    with(p) {
-        function inner() {
-            a = 1;
-            c = 10;
-            if (a !== 1) {
-                throw new Error("a !== 1");
-            }
-            if (b !== 3) {
-                throw new Error("b !== 3");
-            }
-            if (c !== 10) {
-                throw new Error("c !== 10");
-            }
-        }
-        inner();
-    }
-}
-
-outer({}, "b = 3;");
-
-if (a !== 1) {
-    throw new Error("a !== 1");
-}
-if (b !== 3) {
-    throw new Error("b !== 3");
-}
-if (c !== 10) {
-    throw new Error("c !== 10");
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/InvocableTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,539 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+import java.util.Objects;
+import java.util.function.Function;
+import javax.script.Invocable;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import javax.script.SimpleScriptContext;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for javax.script.Invocable implementation of nashorn.
+ */
+@SuppressWarnings("javadoc")
+public class InvocableTest {
+
+    private static void log(final String msg) {
+        org.testng.Reporter.log(msg, true);
+    }
+
+    @Test
+    public void invokeMethodTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            e.eval("var Example = function() { this.hello = function() { return 'Hello World!'; };}; myExample = new Example();");
+            final Object obj = e.get("myExample");
+            final Object res = ((Invocable) e).invokeMethod(obj, "hello");
+            assertEquals(res, "Hello World!");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    /**
+     * Check that we can call invokeMethod on an object that we got by
+     * evaluating script with different Context set.
+     */
+    public void invokeMethodDifferentContextTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            // define an object with method on it
+            final Object obj = e.eval("({ hello: function() { return 'Hello World!'; } })");
+
+            final ScriptContext ctxt = new SimpleScriptContext();
+            ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
+            e.setContext(ctxt);
+
+            // invoke 'func' on obj - but with current script context changed
+            final Object res = ((Invocable) e).invokeMethod(obj, "hello");
+            assertEquals(res, "Hello World!");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    /**
+     * Check that invokeMethod throws NPE on null method name.
+     */
+    public void invokeMethodNullNameTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            final Object obj = e.eval("({})");
+            ((Invocable) e).invokeMethod(obj, null);
+            fail("should have thrown NPE");
+        } catch (final Exception exp) {
+            if (!(exp instanceof NullPointerException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that invokeMethod throws NoSuchMethodException on missing method.
+     */
+    public void invokeMethodMissingTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            final Object obj = e.eval("({})");
+            ((Invocable) e).invokeMethod(obj, "nonExistentMethod");
+            fail("should have thrown NoSuchMethodException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof NoSuchMethodException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that calling method on non-script object 'thiz' results in
+     * IllegalArgumentException.
+     */
+    public void invokeMethodNonScriptObjectThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable) e).invokeMethod(new Object(), "toString");
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that calling method on null 'thiz' results in
+     * IllegalArgumentException.
+     */
+    public void invokeMethodNullThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable) e).invokeMethod(null, "toString");
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that calling method on mirror created by another engine results in
+     * IllegalArgumentException.
+     */
+    public void invokeMethodMixEnginesTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine1 = m.getEngineByName("nashorn");
+        final ScriptEngine engine2 = m.getEngineByName("nashorn");
+
+        try {
+            final Object obj = engine1.eval("({ run: function() {} })");
+            // pass object from engine1 to engine2 as 'thiz' for invokeMethod
+            ((Invocable) engine2).invokeMethod(obj, "run");
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    public void getInterfaceTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Invocable inv = (Invocable) e;
+
+        // try to get interface from global functions
+        try {
+            e.eval("function run() { print('run'); };");
+            final Runnable runnable = inv.getInterface(Runnable.class);
+            runnable.run();
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+
+        // try interface on specific script object
+        try {
+            e.eval("var obj = { run: function() { print('run from obj'); } };");
+            final Object obj = e.get("obj");
+            final Runnable runnable = inv.getInterface(obj, Runnable.class);
+            runnable.run();
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    public interface Foo {
+
+        public void bar();
+    }
+
+    public interface Foo2 extends Foo {
+
+        public void bar2();
+    }
+
+    @Test
+    public void getInterfaceMissingTest() {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
+
+        // don't define any function.
+        try {
+            engine.eval("");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+
+        Runnable runnable = ((Invocable) engine).getInterface(Runnable.class);
+        if (runnable != null) {
+            fail("runnable is not null!");
+        }
+
+        // now define "run"
+        try {
+            engine.eval("function run() { print('this is run function'); }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+        runnable = ((Invocable) engine).getInterface(Runnable.class);
+        // should not return null now!
+        runnable.run();
+
+        // define only one method of "Foo2"
+        try {
+            engine.eval("function bar() { print('bar function'); }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+
+        Foo2 foo2 = ((Invocable) engine).getInterface(Foo2.class);
+        if (foo2 != null) {
+            throw new RuntimeException("foo2 is not null!");
+        }
+
+        // now define other method of "Foo2"
+        try {
+            engine.eval("function bar2() { print('bar2 function'); }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+        foo2 = ((Invocable) engine).getInterface(Foo2.class);
+        foo2.bar();
+        foo2.bar2();
+    }
+
+    @Test
+    /**
+     * Try passing non-interface Class object for interface implementation.
+     */
+    public void getNonInterfaceGetInterfaceTest() {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine engine = manager.getEngineByName("nashorn");
+        try {
+            log(Objects.toString(((Invocable) engine).getInterface(Object.class)));
+            fail("Should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof IllegalArgumentException)) {
+                fail("IllegalArgumentException expected, got " + exp);
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that we can get interface out of a script object even after
+     * switching to use different ScriptContext.
+     */
+    public void getInterfaceDifferentContext() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final Object obj = e.eval("({ run: function() { } })");
+
+            // change script context
+            final ScriptContext ctxt = new SimpleScriptContext();
+            ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
+            e.setContext(ctxt);
+
+            final Runnable r = ((Invocable) e).getInterface(obj, Runnable.class);
+            r.run();
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    /**
+     * Check that getInterface on non-script object 'thiz' results in
+     * IllegalArgumentException.
+     */
+    public void getInterfaceNonScriptObjectThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable) e).getInterface(new Object(), Runnable.class);
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that getInterface on null 'thiz' results in
+     * IllegalArgumentException.
+     */
+    public void getInterfaceNullThizTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable) e).getInterface(null, Runnable.class);
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that calling getInterface on mirror created by another engine
+     * results in IllegalArgumentException.
+     */
+    public void getInterfaceMixEnginesTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine1 = m.getEngineByName("nashorn");
+        final ScriptEngine engine2 = m.getEngineByName("nashorn");
+
+        try {
+            final Object obj = engine1.eval("({ run: function() {} })");
+            // pass object from engine1 to engine2 as 'thiz' for getInterface
+            ((Invocable) engine2).getInterface(obj, Runnable.class);
+            fail("should have thrown IllegalArgumentException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof IllegalArgumentException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * check that null function name results in NPE.
+     */
+    public void invokeFunctionNullNameTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable)e).invokeFunction(null);
+            fail("should have thrown NPE");
+        } catch (final Exception exp) {
+            if (!(exp instanceof NullPointerException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that attempt to call missing function results in
+     * NoSuchMethodException.
+     */
+    public void invokeFunctionMissingTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            ((Invocable)e).invokeFunction("NonExistentFunc");
+            fail("should have thrown NoSuchMethodException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof NoSuchMethodException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    /**
+     * Check that invokeFunction calls functions only from current context's
+     * Bindings.
+     */
+    public void invokeFunctionDifferentContextTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            // define an object with method on it
+            e.eval("function hello() { return 'Hello World!'; }");
+            final ScriptContext ctxt = new SimpleScriptContext();
+            ctxt.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
+            // change engine's current context
+            e.setContext(ctxt);
+
+            ((Invocable) e).invokeFunction("hello"); // no 'hello' in new context!
+            fail("should have thrown NoSuchMethodException");
+        } catch (final Exception exp) {
+            if (!(exp instanceof NoSuchMethodException)) {
+                exp.printStackTrace();
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    public void invokeFunctionExceptionTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("function func() { throw new TypeError(); }");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+
+        try {
+            ((Invocable) e).invokeFunction("func");
+            fail("should have thrown exception");
+        } catch (final ScriptException se) {
+            // ECMA TypeError property wrapped as a ScriptException
+            log("got " + se + " as expected");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+    }
+
+    @Test
+    public void invokeMethodExceptionTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("var sobj = {}; sobj.foo = function func() { throw new TypeError(); }");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+
+        try {
+            final Object sobj = e.get("sobj");
+            ((Invocable) e).invokeMethod(sobj, "foo");
+            fail("should have thrown exception");
+        } catch (final ScriptException se) {
+            // ECMA TypeError property wrapped as a ScriptException
+            log("got " + se + " as expected");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+    }
+
+    @Test
+    /**
+     * Tests whether invocation of a JavaScript method through a variable arity
+     * Java method will pass the vararg array. Both non-vararg and vararg
+     * JavaScript methods are tested.
+     *
+     * @throws ScriptException
+     */
+    public void variableArityInterfaceTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.eval(
+                "function test1(i, strings) {"
+                + "    return 'i == ' + i + ', strings instanceof java.lang.String[] == ' + (strings instanceof Java.type('java.lang.String[]')) + ', strings == ' + java.util.Arrays.toString(strings)"
+                + "}"
+                + "function test2() {"
+                + "    return 'arguments[0] == ' + arguments[0] + ', arguments[1] instanceof java.lang.String[] == ' + (arguments[1] instanceof Java.type('java.lang.String[]')) + ', arguments[1] == ' + java.util.Arrays.toString(arguments[1])"
+                + "}");
+        final VariableArityTestInterface itf = ((Invocable) e).getInterface(VariableArityTestInterface.class);
+        Assert.assertEquals(itf.test1(42, "a", "b"), "i == 42, strings instanceof java.lang.String[] == true, strings == [a, b]");
+        Assert.assertEquals(itf.test2(44, "c", "d", "e"), "arguments[0] == 44, arguments[1] instanceof java.lang.String[] == true, arguments[1] == [c, d, e]");
+    }
+
+    @Test
+    public void defaultMethodTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Invocable inv = (Invocable) e;
+
+        final Object obj = e.eval("({ apply: function(arg) { return arg.toUpperCase(); }})");
+        @SuppressWarnings("unchecked")
+        final Function<String, String> func = inv.getInterface(obj, Function.class);
+        assertEquals(func.apply("hello"), "HELLO");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/MultipleEngineTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import org.testng.annotations.Test;
+
+/**
+ * Test that we can create multiple, independent script engines and use those
+ * independently.
+ *
+ * @test
+ * @run testng jdk.nashorn.api.scripting.MultipleEngineTest
+ */
+@SuppressWarnings("javadoc")
+public class MultipleEngineTest {
+    @Test
+    public void createAndUseManyEngine() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+
+        final ScriptEngine e1 = m.getEngineByName("nashorn");
+        e1.eval("var  x = 33; print(x);");
+
+        final ScriptEngine e2 = m.getEngineByName("nashorn");
+        e2.eval("try { print(x) } catch(e) { print(e); }");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/PluggableJSObjectTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,289 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.fail;
+
+import java.nio.IntBuffer;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import jdk.nashorn.api.scripting.AbstractJSObject;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for pluggable external impls. of jdk.nashorn.api.scripting.JSObject.
+ *
+ * JDK-8024615: Refactor ScriptObjectMirror and JSObject to support external
+ * JSObject implementations.
+ */
+@SuppressWarnings("javadoc")
+public class PluggableJSObjectTest {
+    public static class MapWrapperObject extends AbstractJSObject {
+        private final HashMap<String, Object> map = new LinkedHashMap<>();
+
+        public HashMap<String, Object> getMap() {
+            return map;
+        }
+
+        @Override
+        public Object getMember(final String name) {
+            return map.get(name);
+        }
+
+        @Override
+        public void setMember(final String name, final Object value) {
+            map.put(name, value);
+        }
+
+        @Override
+        public boolean hasMember(final String name) {
+            return map.containsKey(name);
+        }
+
+        @Override
+        public void removeMember(final String name) {
+            map.remove(name);
+        }
+
+        @Override
+        public Set<String> keySet() {
+            return map.keySet();
+        }
+
+        @Override
+        public Collection<Object> values() {
+            return map.values();
+        }
+    }
+
+    @Test
+    // Named property access on a JSObject
+    public void namedAccessTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final MapWrapperObject obj = new MapWrapperObject();
+            e.put("obj", obj);
+            obj.getMap().put("foo", "bar");
+
+            // property-like access on MapWrapperObject objects
+            assertEquals(e.eval("obj.foo"), "bar");
+            e.eval("obj.foo = 'hello'");
+            assertEquals(e.eval("'foo' in obj"), Boolean.TRUE);
+            assertEquals(e.eval("obj.foo"), "hello");
+            assertEquals(obj.getMap().get("foo"), "hello");
+            e.eval("delete obj.foo");
+            assertFalse(obj.getMap().containsKey("foo"));
+            assertEquals(e.eval("'foo' in obj"), Boolean.FALSE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    // @bug 8062030: Nashorn bug retrieving array property after key string concatenation
+    @Test
+    // ConsString attribute access on a JSObject
+    public void consStringTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final MapWrapperObject obj = new MapWrapperObject();
+            e.put("obj", obj);
+            e.put("f", "f");
+            e.eval("obj[f + 'oo'] = 'bar';");
+
+            assertEquals(obj.getMap().get("foo"), "bar");
+            assertEquals(e.eval("obj[f + 'oo']"), "bar");
+            assertEquals(e.eval("obj['foo']"), "bar");
+            assertEquals(e.eval("f + 'oo' in obj"), Boolean.TRUE);
+            assertEquals(e.eval("'foo' in obj"), Boolean.TRUE);
+            e.eval("delete obj[f + 'oo']");
+            assertFalse(obj.getMap().containsKey("foo"));
+            assertEquals(e.eval("obj[f + 'oo']"), null);
+            assertEquals(e.eval("obj['foo']"), null);
+            assertEquals(e.eval("f + 'oo' in obj"), Boolean.FALSE);
+            assertEquals(e.eval("'foo' in obj"), Boolean.FALSE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    public static class BufferObject extends AbstractJSObject {
+        private final IntBuffer buf;
+
+        public BufferObject(final int size) {
+            buf = IntBuffer.allocate(size);
+        }
+
+        public IntBuffer getBuffer() {
+            return buf;
+        }
+
+        @Override
+        public Object getMember(final String name) {
+            return name.equals("length")? buf.capacity() : null;
+        }
+
+        @Override
+        public boolean hasSlot(final int i) {
+            return i > -1 && i < buf.capacity();
+        }
+
+        @Override
+        public Object getSlot(final int i) {
+            return buf.get(i);
+        }
+
+        @Override
+        public void setSlot(final int i, final Object value) {
+            buf.put(i, ((Number)value).intValue());
+        }
+
+        @Override
+        public boolean isArray() {
+            return true;
+        }
+    }
+
+    @Test
+    // array-like indexed access for a JSObject
+    public void indexedAccessTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final BufferObject buf = new BufferObject(2);
+            e.put("buf", buf);
+
+            // array-like access on BufferObject objects
+            assertEquals(e.eval("buf.length"), buf.getBuffer().capacity());
+            e.eval("buf[0] = 23");
+            assertEquals(buf.getBuffer().get(0), 23);
+            assertEquals(e.eval("buf[0]"), 23);
+            assertEquals(e.eval("buf[1]"), 0);
+            buf.getBuffer().put(1, 42);
+            assertEquals(e.eval("buf[1]"), 42);
+            assertEquals(e.eval("Array.isArray(buf)"), Boolean.TRUE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    public static class Adder extends AbstractJSObject {
+        @Override
+        public Object call(final Object thiz, final Object... args) {
+            double res = 0.0;
+            for (final Object arg : args) {
+                res += ((Number)arg).doubleValue();
+            }
+            return res;
+        }
+
+        @Override
+        public boolean isFunction() {
+            return true;
+        }
+    }
+
+    @Test
+    // a callable JSObject
+    public void callableJSObjectTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.put("sum", new Adder());
+            // check callability of Adder objects
+            assertEquals(e.eval("typeof sum"), "function");
+            assertEquals(((Number)e.eval("sum(1, 2, 3, 4, 5)")).intValue(), 15);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    public static class Factory extends AbstractJSObject {
+        @SuppressWarnings("unused")
+        @Override
+        public Object newObject(final Object... args) {
+            return new HashMap<Object, Object>();
+        }
+
+        @Override
+        public boolean isFunction() {
+            return true;
+        }
+    }
+
+    @Test
+    // a factory JSObject
+    public void factoryJSObjectTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.put("Factory", new Factory());
+
+            // check new on Factory
+            assertEquals(e.eval("typeof Factory"), "function");
+            assertEquals(e.eval("typeof new Factory()"), "object");
+            assertEquals(e.eval("(new Factory()) instanceof java.util.Map"), Boolean.TRUE);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    // iteration tests
+    public void iteratingJSObjectTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final MapWrapperObject obj = new MapWrapperObject();
+            obj.setMember("foo", "hello");
+            obj.setMember("bar", "world");
+            e.put("obj", obj);
+
+            // check for..in
+            Object val = e.eval("var str = ''; for (i in obj) str += i; str");
+            assertEquals(val.toString(), "foobar");
+
+            // check for..each..in
+            val = e.eval("var str = ''; for each (i in obj) str += i; str");
+            assertEquals(val.toString(), "helloworld");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScopeTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,781 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.api.scripting.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import javax.script.SimpleBindings;
+import javax.script.SimpleScriptContext;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import jdk.nashorn.api.scripting.URLReader;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for jsr223 Bindings "scope" (engine, global scopes)
+ */
+@SuppressWarnings("javadoc")
+public class ScopeTest {
+
+    @Test
+    public void createBindingsTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        b.put("foo", 42.0);
+        Object res = null;
+        try {
+            res = e.eval("foo == 42.0", b);
+        } catch (final ScriptException | NullPointerException se) {
+            se.printStackTrace();
+            fail(se.getMessage());
+        }
+
+        assertEquals(res, Boolean.TRUE);
+    }
+
+    @Test
+    public void engineScopeTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings engineScope = e.getBindings(ScriptContext.ENGINE_SCOPE);
+
+        // check few ECMA standard built-in global properties
+        assertNotNull(engineScope.get("Object"));
+        assertNotNull(engineScope.get("TypeError"));
+        assertNotNull(engineScope.get("eval"));
+
+        // can access via ScriptEngine.get as well
+        assertNotNull(e.get("Object"));
+        assertNotNull(e.get("TypeError"));
+        assertNotNull(e.get("eval"));
+
+        // Access by either way should return same object
+        assertEquals(engineScope.get("Array"), e.get("Array"));
+        assertEquals(engineScope.get("EvalError"), e.get("EvalError"));
+        assertEquals(engineScope.get("undefined"), e.get("undefined"));
+
+        // try exposing a new variable from scope
+        engineScope.put("myVar", "foo");
+        try {
+            assertEquals(e.eval("myVar"), "foo");
+        } catch (final ScriptException se) {
+            se.printStackTrace();
+            fail(se.getMessage());
+        }
+
+        // update "myVar" in script an check the value from scope
+        try {
+            e.eval("myVar = 'nashorn';");
+        } catch (final ScriptException se) {
+            se.printStackTrace();
+            fail(se.getMessage());
+        }
+
+        // now check modified value from scope and engine
+        assertEquals(engineScope.get("myVar"), "nashorn");
+        assertEquals(e.get("myVar"), "nashorn");
+    }
+
+    @Test
+    public void multiGlobalTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        try {
+            final Object obj1 = e.eval("Object");
+            final Object obj2 = e.eval("Object", newCtxt);
+            Assert.assertNotEquals(obj1, obj2);
+            Assert.assertNotNull(obj1);
+            Assert.assertNotNull(obj2);
+            Assert.assertEquals(obj1.toString(), obj2.toString());
+
+            e.eval("x = 'hello'");
+            e.eval("x = 'world'", newCtxt);
+            Object x1 = e.getContext().getAttribute("x");
+            Object x2 = newCtxt.getAttribute("x");
+            Assert.assertNotEquals(x1, x2);
+            Assert.assertEquals(x1, "hello");
+            Assert.assertEquals(x2, "world");
+
+            x1 = e.eval("x");
+            x2 = e.eval("x", newCtxt);
+            Assert.assertNotEquals(x1, x2);
+            Assert.assertEquals(x1, "hello");
+            Assert.assertEquals(x2, "world");
+
+            final ScriptContext origCtxt = e.getContext();
+            e.setContext(newCtxt);
+            e.eval("y = new Object()");
+            e.eval("y = new Object()", origCtxt);
+
+            final Object y1 = origCtxt.getAttribute("y");
+            final Object y2 = newCtxt.getAttribute("y");
+            Assert.assertNotEquals(y1, y2);
+            final Object yeval1 = e.eval("y");
+            final Object yeval2 = e.eval("y", origCtxt);
+            Assert.assertNotEquals(yeval1, yeval2);
+            Assert.assertEquals("[object Object]", y1.toString());
+            Assert.assertEquals("[object Object]", y2.toString());
+        } catch (final ScriptException se) {
+            se.printStackTrace();
+            fail(se.getMessage());
+        }
+    }
+
+    @Test
+    public void userEngineScopeBindingsTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.eval("function func() {}");
+
+        final ScriptContext newContext = new SimpleScriptContext();
+        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
+        // we are using a new bindings - so it should have 'func' defined
+        final Object value = e.eval("typeof func", newContext);
+        assertTrue(value.equals("undefined"));
+    }
+
+    @Test
+    public void userEngineScopeBindingsNoLeakTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptContext newContext = new SimpleScriptContext();
+        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
+        e.eval("function foo() {}", newContext);
+
+        // in the default context's ENGINE_SCOPE, 'foo' shouldn't exist
+        assertTrue(e.eval("typeof foo").equals("undefined"));
+    }
+
+    @Test
+    public void userEngineScopeBindingsRetentionTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptContext newContext = new SimpleScriptContext();
+        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
+        e.eval("function foo() {}", newContext);
+
+        // definition retained with user's ENGINE_SCOPE Binding
+        assertTrue(e.eval("typeof foo", newContext).equals("function"));
+
+        final Bindings oldBindings = newContext.getBindings(ScriptContext.ENGINE_SCOPE);
+        // but not in another ENGINE_SCOPE binding
+        newContext.setBindings(new SimpleBindings(), ScriptContext.ENGINE_SCOPE);
+        assertTrue(e.eval("typeof foo", newContext).equals("undefined"));
+
+        // restore ENGINE_SCOPE and check again
+        newContext.setBindings(oldBindings, ScriptContext.ENGINE_SCOPE);
+        assertTrue(e.eval("typeof foo", newContext).equals("function"));
+    }
+
+    @Test
+    // check that engine.js definitions are visible in all new global instances
+    public void checkBuiltinsInNewBindingsTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        // check default global instance has engine.js definitions
+        final Bindings g = (Bindings) e.eval("this");
+        Object value = g.get("__noSuchProperty__");
+        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
+        value = g.get("print");
+        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
+
+        // check new global instance created has engine.js definitions
+        final Bindings b = e.createBindings();
+        value = b.get("__noSuchProperty__");
+        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
+        value = b.get("print");
+        assertTrue(value instanceof ScriptObjectMirror && ((ScriptObjectMirror)value).isFunction());
+
+        // put a mapping into GLOBAL_SCOPE
+        final Bindings globalScope = e.getContext().getBindings(ScriptContext.GLOBAL_SCOPE);
+        globalScope.put("x", "hello");
+
+        // GLOBAL_SCOPE mapping should be visible from default ScriptContext eval
+        assertTrue(e.eval("x").equals("hello"));
+
+        final ScriptContext ctx = new SimpleScriptContext();
+        ctx.setBindings(globalScope, ScriptContext.GLOBAL_SCOPE);
+        ctx.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        // GLOBAL_SCOPE mapping should be visible from non-default ScriptContext eval
+        assertTrue(e.eval("x", ctx).equals("hello"));
+
+        // try some arbitray Bindings for ENGINE_SCOPE
+        final Bindings sb = new SimpleBindings();
+        ctx.setBindings(sb, ScriptContext.ENGINE_SCOPE);
+
+        // GLOBAL_SCOPE mapping should be visible from non-default ScriptContext eval
+        assertTrue(e.eval("x", ctx).equals("hello"));
+
+        // engine.js builtins are still defined even with arbitrary Bindings
+        assertTrue(e.eval("typeof print", ctx).equals("function"));
+        assertTrue(e.eval("typeof __noSuchProperty__", ctx).equals("function"));
+
+        // ENGINE_SCOPE definition should 'hide' GLOBAL_SCOPE definition
+        sb.put("x", "newX");
+        assertTrue(e.eval("x", ctx).equals("newX"));
+    }
+
+    /**
+     * Test multi-threaded access to defined global variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedVarTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "foo";
+
+        assertEquals(e.eval("var foo = 'original context';", origContext), null);
+        assertEquals(e.eval("var foo = 'new context';", newCtxt), null);
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval("var foo = 'newer context';", newCtxt), null);
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        assertEquals(e.eval(sharedScript), "original context");
+        assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+    /**
+     * Test multi-threaded access to undefined global variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedGlobalTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        assertEquals(e.eval("foo = 'original context';", origContext), "original context");
+        assertEquals(e.eval("foo = 'new context';", newCtxt), "new context");
+        final String sharedScript = "foo";
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        final Object obj3 = e.eval("delete foo; foo = 'newer context';", newCtxt);
+        assertEquals(obj3, "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        Assert.assertEquals(e.eval(sharedScript), "original context");
+        Assert.assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+    /**
+     * Test multi-threaded access using the postfix ++ operator for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedIncTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        assertEquals(e.eval("var x = 0;", origContext), null);
+        assertEquals(e.eval("var x = 2;", newCtxt), null);
+        final String sharedScript = "x++;";
+
+        final Thread t1 = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    for (int i = 0; i < 1000; i++) {
+                        assertEquals(e.eval(sharedScript, origContext), (double)i);
+                    }
+                } catch (final ScriptException se) {
+                    fail(se.toString());
+                }
+            }
+        });
+        final Thread t2 = new Thread(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    for (int i = 2; i < 1000; i++) {
+                        assertEquals(e.eval(sharedScript, newCtxt), (double)i);
+                    }
+                } catch (final ScriptException se) {
+                    fail(se.toString());
+                }
+            }
+        });
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+    }
+
+    /**
+     * Test multi-threaded access to primitive prototype properties for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedPrimitiveTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        final Object obj1 = e.eval("String.prototype.foo = 'original context';", origContext);
+        final Object obj2 = e.eval("String.prototype.foo = 'new context';", newCtxt);
+        assertEquals(obj1, "original context");
+        assertEquals(obj2, "new context");
+        final String sharedScript = "''.foo";
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        final Object obj3 = e.eval("delete String.prototype.foo; Object.prototype.foo = 'newer context';", newCtxt);
+        assertEquals(obj3, "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        Assert.assertEquals(e.eval(sharedScript), "original context");
+        Assert.assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+
+    /**
+     * Test multi-threaded access to prototype user accessor properties for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedAccessorTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        e.eval("Object.defineProperty(Object.prototype, 'foo', { get: function() 'original context' })", origContext);
+        e.eval("Object.defineProperty(Object.prototype, 'foo', { get: function() 'new context', configurable: true })", newCtxt);
+        final String sharedScript = "({}).foo";
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        final Object obj3 = e.eval("delete Object.prototype.foo; Object.prototype.foo = 'newer context';", newCtxt);
+        assertEquals(obj3, "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+    }
+
+    /**
+     * Test multi-threaded access to primitive prototype user accessor properties for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedPrimitiveAccessorTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        e.eval("Object.defineProperty(String.prototype, 'foo', { get: function() 'original context' })", origContext);
+        e.eval("Object.defineProperty(String.prototype, 'foo', { get: function() 'new context' })", newCtxt);
+        final String sharedScript = "''.foo";
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        final Object obj3 = e.eval("delete String.prototype.foo; Object.prototype.foo = 'newer context';", newCtxt);
+        assertEquals(obj3, "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+    }
+
+    /**
+     * Test multi-threaded scope function invocation for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedFunctionTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/func.js")), origContext);
+        assertEquals(origContext.getAttribute("scopeVar"), 1);
+        assertEquals(e.eval("scopeTest()"), 1);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/func.js")), newCtxt);
+        assertEquals(newCtxt.getAttribute("scopeVar"), 1);
+        assertEquals(e.eval("scopeTest();", newCtxt), 1);
+
+        assertEquals(e.eval("scopeVar = 3;", newCtxt), 3);
+        assertEquals(newCtxt.getAttribute("scopeVar"), 3);
+
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, "scopeTest()", 1, 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, "scopeTest()", 3, 1000));
+
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+    }
+
+    /**
+     * Test multi-threaded access to global getters and setters for shared script classes with multiple globals.
+     */
+    @Test
+    public static void getterSetterTest() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "accessor1";
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), origContext);
+        assertEquals(e.eval("accessor1 = 1;"), 1);
+        assertEquals(e.eval(sharedScript), 1);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), newCtxt);
+        assertEquals(e.eval("accessor1 = 2;", newCtxt), 2);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, 1, 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, 2, 1000));
+
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval(sharedScript), 1);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+        assertEquals(e.eval("v"), 1);
+        assertEquals(e.eval("v", newCtxt), 2);
+    }
+
+    /**
+     * Test multi-threaded access to global getters and setters for shared script classes with multiple globals.
+     */
+    @Test
+    public static void getterSetter2Test() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "accessor2";
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), origContext);
+        assertEquals(e.eval("accessor2 = 1;"), 1);
+        assertEquals(e.eval(sharedScript), 1);
+
+        e.eval(new URLReader(ScopeTest.class.getResource("resources/gettersetter.js")), newCtxt);
+        assertEquals(e.eval("accessor2 = 2;", newCtxt), 2);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, 1, 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, 2, 1000));
+
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval(sharedScript), 1);
+        assertEquals(e.eval(sharedScript, newCtxt), 2);
+        assertEquals(e.eval("x"), 1);
+        assertEquals(e.eval("x", newCtxt), 2);
+    }
+
+    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
+    @Test
+    public static void contextOverwriteTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = new SimpleBindings();
+        b.put("context", "hello");
+        b.put("foo", 32);
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        e.setContext(newCtxt);
+        assertEquals(e.eval("context"), "hello");
+        assertEquals(((Number)e.eval("foo")).intValue(), 32);
+    }
+
+    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
+    @Test
+    public static void contextOverwriteInScriptTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.put("foo", 32);
+
+        assertEquals(((Number)e.eval("foo")).intValue(), 32);
+        assertEquals(e.eval("context = 'bar'"), "bar");
+        assertEquals(((Number)e.eval("foo")).intValue(), 32);
+    }
+
+    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
+    @Test
+    public static void engineOverwriteTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Bindings b = new SimpleBindings();
+        b.put("engine", "hello");
+        b.put("foo", 32);
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        e.setContext(newCtxt);
+        assertEquals(e.eval("engine"), "hello");
+        assertEquals(((Number)e.eval("foo")).intValue(), 32);
+    }
+
+    // @bug 8058422: Users should be able to overwrite "context" and "engine" variables
+    @Test
+    public static void engineOverwriteInScriptTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.put("foo", 32);
+
+        assertEquals(((Number)e.eval("foo")).intValue(), 32);
+        assertEquals(e.eval("engine = 'bar'"), "bar");
+        assertEquals(((Number)e.eval("foo")).intValue(), 32);
+    }
+
+    // @bug 8044750: megamorphic getter for scope objects does not call __noSuchProperty__ hook
+    @Test
+    public static void testMegamorphicGetInGlobal() throws Exception {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine = m.getEngineByName("nashorn");
+        final String script = "foo";
+        // "foo" is megamorphic because of different global scopes.
+        // Make sure ScriptContext variable search works even after
+        // it becomes megamorphic.
+        for (int index = 0; index < 25; index++) {
+            final Bindings bindings = new SimpleBindings();
+            bindings.put("foo", index);
+            final Number value = (Number)engine.eval(script, bindings);
+            assertEquals(index, value.intValue());
+        }
+    }
+
+    /**
+     * Test "slow" scopes involving {@code with} and {@code eval} statements for shared script classes with multiple globals.
+     * @throws ScriptException
+     * @throws InterruptedException
+     */
+    @Test
+    public static void testSlowScope() throws ScriptException, InterruptedException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        for (int i = 0; i < 100; i++) {
+            final Bindings b = e.createBindings();
+            final ScriptContext ctxt = new SimpleScriptContext();
+            ctxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+
+            e.eval(new URLReader(ScopeTest.class.getResource("resources/witheval.js")), ctxt);
+            assertEquals(e.eval("a", ctxt), 1);
+            assertEquals(b.get("a"), 1);
+            assertEquals(e.eval("b", ctxt), 3);
+            assertEquals(b.get("b"), 3);
+            assertEquals(e.eval("c", ctxt), 10);
+            assertEquals(b.get("c"), 10);
+        }
+    }
+
+    private static class ScriptRunner implements Runnable {
+
+        final ScriptEngine engine;
+        final ScriptContext context;
+        final String source;
+        final Object expected;
+        final int iterations;
+
+        ScriptRunner(final ScriptEngine engine, final ScriptContext context, final String source, final Object expected, final int iterations) {
+            this.engine = engine;
+            this.context = context;
+            this.source = source;
+            this.expected = expected;
+            this.iterations = iterations;
+        }
+
+        @Override
+        public void run() {
+            try {
+                for (int i = 0; i < iterations; i++) {
+                    assertEquals(engine.eval(source, context), expected);
+                }
+            } catch (final ScriptException se) {
+                throw new RuntimeException(se);
+            }
+        }
+    }
+
+    // @bug 8071678: NashornScriptEngine returns javax.script.ScriptContext instance
+    // with get/setAttribute methods insonsistent for GLOBAL_SCOPE
+    @Test
+    public void testGlobalScopeSearch() throws Exception {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptContext c = e.getContext();
+        c.setAttribute("name1234", "value", ScriptContext.GLOBAL_SCOPE);
+        assertEquals(c.getAttribute("name1234"), "value");
+        assertEquals(c.getAttributesScope("name1234"),
+            ScriptContext.GLOBAL_SCOPE);
+    }
+
+    // @bug 8071594: NashornScriptEngine returns javax.script.ScriptContext instance
+    // which doesn't completely conform to the spec regarding exceptions throwing
+    @Test
+    public void testScriptContext_NPE_IAE() throws Exception {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptContext c = e.getContext();
+        try {
+            c.getAttribute("");
+            throw new AssertionError("should have thrown IAE");
+        } catch (IllegalArgumentException iae1) {}
+
+        try {
+            c.getAttribute(null);
+            throw new AssertionError("should have thrown NPE");
+        } catch (NullPointerException npe1) {}
+
+        try {
+            c.getAttribute("", ScriptContext.ENGINE_SCOPE);
+            throw new AssertionError("should have thrown IAE");
+        } catch (IllegalArgumentException iae2) {}
+
+        try {
+            c.getAttribute(null, ScriptContext.ENGINE_SCOPE);
+            throw new AssertionError("should have thrown NPE");
+        } catch (NullPointerException npe2) {}
+
+        try {
+            c.removeAttribute("", ScriptContext.ENGINE_SCOPE);
+            throw new AssertionError("should have thrown IAE");
+        } catch (IllegalArgumentException iae3) {}
+
+        try {
+            c.removeAttribute(null, ScriptContext.ENGINE_SCOPE);
+            throw new AssertionError("should have thrown NPE");
+        } catch (NullPointerException npe3) {}
+
+        try {
+            c.setAttribute("", "value", ScriptContext.ENGINE_SCOPE);
+            throw new AssertionError("should have thrown IAE");
+        } catch (IllegalArgumentException iae4) {}
+
+        try {
+            c.setAttribute(null, "value", ScriptContext.ENGINE_SCOPE);
+            throw new AssertionError("should have thrown NPE");
+        } catch (NullPointerException npe4) {}
+
+        try {
+            c.getAttributesScope("");
+            throw new AssertionError("should have thrown IAE");
+        } catch (IllegalArgumentException iae5) {}
+
+        try {
+            c.getAttributesScope(null);
+            throw new AssertionError("should have thrown NPE");
+        } catch (NullPointerException npe5) {}
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineSecurityTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,313 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import static org.testng.Assert.fail;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.ClassFilter;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import org.testng.annotations.Test;
+
+/**
+ * jsr223 tests for security access checks.
+ */
+@SuppressWarnings("javadoc")
+public class ScriptEngineSecurityTest {
+
+    private static void log(final String msg) {
+        org.testng.Reporter.log(msg, true);
+    }
+
+    @Test
+    public void securityPackagesTest() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("var v = Packages.sun.misc.Unsafe;");
+            fail("should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (exp instanceof SecurityException) {
+                log("got " + exp + " as expected");
+            } else {
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    public void securityJavaTypeTest() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("var v = Java.type('sun.misc.Unsafe');");
+            fail("should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (exp instanceof SecurityException) {
+                log("got " + exp + " as expected");
+            } else {
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    public void securityClassForNameTest() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("var v = java.lang.Class.forName('sun.misc.Unsafe');");
+            fail("should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (exp instanceof SecurityException) {
+                log("got " + exp + " as expected");
+            } else {
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    @Test
+    public void securitySystemExit() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("java.lang.System.exit(0);");
+            fail("should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (exp instanceof SecurityException) {
+                log("got " + exp + " as expected");
+            } else {
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+
+    @Test
+    public void securitySystemExitFromFinalizerThread() throws ScriptException {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.eval("var o = Java.extend(Java.type('javax.imageio.spi.ServiceRegistry'), { deregisterAll: this.exit.bind(null, 1234)});\n" +
+                "new o(new java.util.ArrayList().iterator())");
+        System.gc();
+        System.runFinalization();
+        // NOTE: this test just exits the VM if it fails.
+    }
+
+    @Test
+    public void securitySystemLoadLibrary() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("java.lang.System.loadLibrary('foo');");
+            fail("should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (exp instanceof SecurityException) {
+                log("got " + exp + " as expected");
+            } else {
+                fail(exp.getMessage());
+            }
+        }
+    }
+
+    // @bug 8032948: Nashorn linkages awry
+    @SuppressWarnings("serial")
+    public static class FakeProxy extends Proxy {
+        public FakeProxy(final InvocationHandler ih) {
+            super(ih);
+        }
+
+        public static Class<?> makeProxyClass(final ClassLoader cl, final Class<?>... ifaces) {
+            return Proxy.getProxyClass(cl, ifaces);
+        }
+    }
+
+    @Test
+    public void fakeProxySubclassAccessCheckTest() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        e.put("name", ScriptEngineSecurityTest.class.getName());
+        e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
+        e.put("intfs", new Class[] { Runnable.class });
+
+        final String getClass = "Java.type(name + '$FakeProxy').getProxyClass(cl, intfs);";
+
+        // Should not be able to call static methods of Proxy via fake subclass
+        try {
+            e.eval(getClass);
+            fail("should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof SecurityException)) {
+                fail("SecurityException expected, got " + exp);
+            }
+        }
+    }
+
+    @Test
+    public void fakeProxySubclassAccessCheckTest2() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        e.put("name", ScriptEngineSecurityTest.class.getName());
+        e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
+        e.put("intfs", new Class[] { Runnable.class });
+
+        final String getClass = "Java.type(name + '$FakeProxy').makeProxyClass(cl, intfs);";
+
+        // Should not be able to call static methods of Proxy via fake subclass
+        try {
+            e.eval(getClass);
+            fail("should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof SecurityException)) {
+                fail("SecurityException expected, got " + exp);
+            }
+        }
+    }
+
+    @Test
+    public static void proxyStaticAccessCheckTest() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Runnable r = (Runnable)Proxy.newProxyInstance(
+            ScriptEngineTest.class.getClassLoader(),
+            new Class[] { Runnable.class },
+            new InvocationHandler() {
+                @Override
+                public Object invoke(final Object p, final Method mtd, final Object[] a) {
+                    return null;
+                }
+            });
+
+        e.put("rc", r.getClass());
+        e.put("cl", ScriptEngineSecurityTest.class.getClassLoader());
+        e.put("intfs", new Class[] { Runnable.class });
+
+        // make sure static methods of Proxy is not accessible via subclass
+        try {
+            e.eval("rc.static.getProxyClass(cl, intfs)");
+            fail("Should have thrown SecurityException");
+        } catch (final Exception exp) {
+            if (! (exp instanceof SecurityException)) {
+                fail("SecurityException expected, got " + exp);
+            }
+        }
+    }
+
+
+    @Test
+    public void nashornConfigSecurityTest() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        try {
+            fac.getScriptEngine(new ClassFilter() {
+               @Override
+               public boolean exposeToScripts(final String name) {
+                   return true;
+               }
+            });
+            fail("SecurityException should have been thrown");
+        } catch (final SecurityException e) {
+            //empty
+        }
+    }
+
+    @Test
+    public void nashornConfigSecurityTest2() {
+        if (System.getSecurityManager() == null) {
+            // pass vacuously
+            return;
+        }
+
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        try {
+            fac.getScriptEngine(new String[0], null, new ClassFilter() {
+               @Override
+               public boolean exposeToScripts(final String name) {
+                   return true;
+               }
+            });
+            fail("SecurityException should have been thrown");
+        } catch (final SecurityException e) {
+            //empty
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptEngineTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,881 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.Collections;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import javax.script.Bindings;
+import javax.script.Compilable;
+import javax.script.CompiledScript;
+import javax.script.Invocable;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import javax.script.SimpleScriptContext;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for JSR-223 script engine for Nashorn.
+ *
+ * @test
+ * @build jdk.nashorn.api.scripting.Window jdk.nashorn.api.scripting.WindowEventHandler jdk.nashorn.api.scripting.VariableArityTestInterface jdk.nashorn.api.scripting.ScriptEngineTest
+ * @run testng/othervm jdk.nashorn.api.scripting.ScriptEngineTest
+ */
+@SuppressWarnings("javadoc")
+public class ScriptEngineTest {
+
+    private static void log(final String msg) {
+        org.testng.Reporter.log(msg, true);
+    }
+
+    @Test
+    public void argumentsTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        final String[] args = new String[] { "hello", "world" };
+        try {
+            e.put("arguments", args);
+            final Object arg0 = e.eval("arguments[0]");
+            final Object arg1 = e.eval("arguments[1]");
+            assertEquals(args[0], arg0);
+            assertEquals(args[1], arg1);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void argumentsWithTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        final String[] args = new String[] { "hello", "world" };
+        try {
+            e.put("arguments", args);
+            final Object arg0 = e.eval("var imports = new JavaImporter(java.io); " +
+                    " with(imports) { arguments[0] }");
+            final Object arg1 = e.eval("var imports = new JavaImporter(java.util, java.io); " +
+                    " with(imports) { arguments[1] }");
+            assertEquals(args[0], arg0);
+            assertEquals(args[1], arg1);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void argumentsEmptyTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            assertEquals(e.eval("arguments instanceof Array"), true);
+            assertEquals(e.eval("arguments.length == 0"), true);
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void factoryTests() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        assertNotNull(e);
+
+        final ScriptEngineFactory fac = e.getFactory();
+
+        assertEquals(fac.getLanguageName(), "ECMAScript");
+        assertEquals(fac.getParameter(ScriptEngine.NAME), "javascript");
+        assertEquals(fac.getLanguageVersion(), "ECMA - 262 Edition 5.1");
+        assertEquals(fac.getEngineName(), "Oracle Nashorn");
+        assertEquals(fac.getOutputStatement("context"), "print(context)");
+        assertEquals(fac.getProgram("print('hello')", "print('world')"), "print('hello');print('world');");
+        assertEquals(fac.getParameter(ScriptEngine.NAME), "javascript");
+
+        boolean seenJS = false;
+        for (final String ext : fac.getExtensions()) {
+            if (ext.equals("js")) {
+                seenJS = true;
+            }
+        }
+
+        assertEquals(seenJS, true);
+        final String str = fac.getMethodCallSyntax("obj", "foo", "x");
+        assertEquals(str, "obj.foo(x)");
+
+        boolean seenNashorn = false, seenJavaScript = false, seenECMAScript = false;
+        for (final String name : fac.getNames()) {
+            switch (name) {
+                case "nashorn": seenNashorn = true; break;
+                case "javascript": seenJavaScript = true; break;
+                case "ECMAScript": seenECMAScript = true; break;
+            default:
+                break;
+            }
+        }
+
+        assertTrue(seenNashorn);
+        assertTrue(seenJavaScript);
+        assertTrue(seenECMAScript);
+
+        boolean seenAppJS = false, seenAppECMA = false, seenTextJS = false, seenTextECMA = false;
+        for (final String mime : fac.getMimeTypes()) {
+            switch (mime) {
+                case "application/javascript": seenAppJS = true; break;
+                case "application/ecmascript": seenAppECMA = true; break;
+                case "text/javascript": seenTextJS = true; break;
+                case "text/ecmascript": seenTextECMA = true; break;
+            default:
+                break;
+            }
+        }
+
+        assertTrue(seenAppJS);
+        assertTrue(seenAppECMA);
+        assertTrue(seenTextJS);
+        assertTrue(seenTextECMA);
+    }
+
+    @Test
+    public void evalTests() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.put(ScriptEngine.FILENAME, "myfile.js");
+
+        try {
+            e.eval("print('hello')");
+        } catch (final ScriptException se) {
+            fail(se.getMessage());
+        }
+        try {
+            e.eval("print('hello)");
+            fail("script exception expected");
+        } catch (final ScriptException se) {
+            assertEquals(se.getLineNumber(), 1);
+            assertEquals(se.getColumnNumber(), 13);
+            assertEquals(se.getFileName(), "myfile.js");
+            // se.printStackTrace();
+        }
+
+        try {
+            Object obj = e.eval("34 + 41");
+            assertTrue(34.0 + 41.0 == ((Number)obj).doubleValue());
+            obj = e.eval("x = 5");
+            assertTrue(5.0 == ((Number)obj).doubleValue());
+        } catch (final ScriptException se) {
+            se.printStackTrace();
+            fail(se.getMessage());
+        }
+    }
+
+    @Test
+    public void compileTests() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        CompiledScript script = null;
+
+        try {
+            script = ((Compilable)e).compile("print('hello')");
+        } catch (final ScriptException se) {
+            fail(se.getMessage());
+        }
+
+        try {
+            script.eval();
+        } catch (final ScriptException | NullPointerException se) {
+            se.printStackTrace();
+            fail(se.getMessage());
+        }
+
+        // try to compile from a Reader
+        try {
+            script = ((Compilable)e).compile(new StringReader("print('world')"));
+        } catch (final ScriptException se) {
+            fail(se.getMessage());
+        }
+
+        try {
+            script.eval();
+        } catch (final ScriptException | NullPointerException se) {
+            se.printStackTrace();
+            fail(se.getMessage());
+        }
+    }
+
+    @Test
+    public void compileAndEvalInDiffContextTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine = m.getEngineByName("js");
+        final Compilable compilable = (Compilable) engine;
+        final CompiledScript compiledScript = compilable.compile("foo");
+        final ScriptContext ctxt = new SimpleScriptContext();
+        ctxt.setAttribute("foo", "hello", ScriptContext.ENGINE_SCOPE);
+        assertEquals(compiledScript.eval(ctxt), "hello");
+    }
+
+    @Test
+    public void accessGlobalTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            e.eval("var x = 'hello'");
+            assertEquals(e.get("x"), "hello");
+        } catch (final ScriptException exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void exposeGlobalTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            e.put("y", "foo");
+            e.eval("print(y)");
+        } catch (final ScriptException exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void putGlobalFunctionTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        e.put("callable", new Callable<String>() {
+            @Override
+            public String call() throws Exception {
+                return "callable was called";
+            }
+        });
+
+        try {
+            e.eval("print(callable.call())");
+        } catch (final ScriptException exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void windowAlertTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Window window = new Window();
+
+        try {
+            e.put("window", window);
+            e.eval("print(window.alert)");
+            e.eval("window.alert('calling window.alert...')");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void windowLocationTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Window window = new Window();
+
+        try {
+            e.put("window", window);
+            e.eval("print(window.location)");
+            final Object locationValue = e.eval("window.getLocation()");
+            assertEquals(locationValue, "http://localhost:8080/window");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void windowItemTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Window window = new Window();
+
+        try {
+            e.put("window", window);
+            final String item1 = (String)e.eval("window.item(65535)");
+            assertEquals(item1, "ffff");
+            final String item2 = (String)e.eval("window.item(255)");
+            assertEquals(item2, "ff");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void windowEventTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Window window = new Window();
+
+        try {
+            e.put("window", window);
+            e.eval("window.onload = function() { print('window load event fired'); return true }");
+            assertTrue((Boolean)e.eval("window.onload.loaded()"));
+            final WindowEventHandler handler = window.getOnload();
+            assertNotNull(handler);
+            assertTrue(handler.loaded());
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void throwTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.put(ScriptEngine.FILENAME, "throwtest.js");
+
+        try {
+            e.eval("throw 'foo'");
+        } catch (final ScriptException exp) {
+            log(exp.getMessage());
+            assertEquals(exp.getMessage(), "foo in throwtest.js at line number 1 at column number 0");
+            assertEquals(exp.getFileName(), "throwtest.js");
+            assertEquals(exp.getLineNumber(), 1);
+        }
+    }
+
+    @Test
+    public void setTimeoutTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final Window window = new Window();
+
+        try {
+            final Class<?> setTimeoutParamTypes[] = { Window.class, String.class, int.class };
+            final Method setTimeout = Window.class.getDeclaredMethod("setTimeout", setTimeoutParamTypes);
+            assertNotNull(setTimeout);
+            e.put("window", window);
+            e.eval("window.setTimeout('foo()', 100)");
+
+            // try to make setTimeout global
+            e.put("setTimeout", setTimeout);
+            // TODO: java.lang.ClassCastException: required class
+            // java.lang.Integer but encountered class java.lang.Double
+            // e.eval("setTimeout('foo2()', 200)");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void setWriterTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final StringWriter sw = new StringWriter();
+        e.getContext().setWriter(sw);
+
+        try {
+            e.eval("print('hello world')");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+        assertEquals(sw.toString(), println("hello world"));
+    }
+
+    @Test
+    public void redefineEchoTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        try {
+            e.eval("var echo = {}; if (typeof echo !== 'object') { throw 'echo is a '+typeof echo; }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+    @Test
+    public void noEnumerablePropertiesTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("for (i in this) { throw 'found property: ' + i }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void noRefErrorForGlobalThisAccessTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("this.foo");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void refErrorForUndeclaredAccessTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("try { print(foo); throw 'no ref error' } catch (e) { if (!(e instanceof ReferenceError)) throw e; }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void typeErrorForGlobalThisCallTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("try { this.foo() } catch(e) { if (! (e instanceof TypeError)) throw 'no type error' }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void refErrorForUndeclaredCallTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("try { foo() } catch(e) { if (! (e instanceof ReferenceError)) throw 'no ref error' }");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    // check that print function prints arg followed by newline char
+    public void printTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final StringWriter sw = new StringWriter();
+        e.getContext().setWriter(sw);
+        try {
+            e.eval("print('hello')");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+
+        assertEquals(sw.toString(), println("hello"));
+    }
+
+    @Test
+    // check that print prints all arguments (more than one)
+    public void printManyTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final StringWriter sw = new StringWriter();
+        e.getContext().setWriter(sw);
+        try {
+            e.eval("print(34, true, 'hello')");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+
+        assertEquals(sw.toString(), println("34 true hello"));
+    }
+
+    @Test
+    public void scriptObjectAutoConversionTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.eval("obj = { foo: 'hello' }");
+        e.put("Window", e.eval("Packages.jdk.nashorn.api.scripting.test.Window"));
+        assertEquals(e.eval("Window.funcJSObject(obj)"), "hello");
+        assertEquals(e.eval("Window.funcScriptObjectMirror(obj)"), "hello");
+        assertEquals(e.eval("Window.funcMap(obj)"), "hello");
+        assertEquals(e.eval("Window.funcJSObject(obj)"), "hello");
+    }
+
+    // @bug 8032948: Nashorn linkages awry
+    @Test
+    public void checkProxyAccess() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final boolean[] reached = new boolean[1];
+        final Runnable r = (Runnable)Proxy.newProxyInstance(
+            ScriptEngineTest.class.getClassLoader(),
+            new Class[] { Runnable.class },
+            new InvocationHandler() {
+                @Override
+                public Object invoke(final Object p, final Method mtd, final Object[] a) {
+                    reached[0] = true;
+                    return null;
+                }
+            });
+
+        e.put("r", r);
+        e.eval("r.run()");
+
+        assertTrue(reached[0]);
+    }
+
+    // properties that can be read by any code
+    private static String[] propNames = {
+        "java.version",
+        "java.vendor",
+        "java.vendor.url",
+        "java.class.version",
+        "os.name",
+        "os.version",
+        "os.arch",
+        "file.separator",
+        "path.separator",
+        "line.separator",
+        "java.specification.version",
+        "java.specification.vendor",
+        "java.specification.name",
+        "java.vm.specification.version",
+        "java.vm.specification.vendor",
+        "java.vm.specification.name",
+        "java.vm.version",
+        "java.vm.vendor",
+        "java.vm.name"
+    };
+
+    // @bug 8033924: Default permissions are not given for eval code
+    @Test
+    public void checkPropertyReadPermissions() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        for (final String name : propNames) {
+            checkProperty(e, name);
+        }
+    }
+
+    // @bug 8046013: TypeError: Cannot apply "with" to non script object
+    @Test
+    public void withOnMirrorTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        final Object obj = e.eval("({ foo: 'hello'})");
+        final Object[] arr = new Object[1];
+        arr[0] = obj;
+        e.put("arr", arr);
+        final Object res = e.eval("var res; with(arr[0]) { res = foo; }; res");
+        assertEquals(res, "hello");
+    }
+
+    // @bug 8054223: Nashorn: AssertionError when use __DIR__ and ScriptEngine.eval()
+    @Test
+    public void check__DIR__Test() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        e.eval("__DIR__");
+    }
+
+    // @bug 8050432:javax.script.filename variable should not be enumerable
+    // with nashorn engine's ENGINE_SCOPE bindings
+    @Test
+    public void enumerableGlobalsTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        e.put(ScriptEngine.FILENAME, "test");
+        final Object enumerable = e.eval(
+            "Object.getOwnPropertyDescriptor(this, " +
+            " 'javax.script.filename').enumerable");
+        assertEquals(enumerable, Boolean.FALSE);
+    }
+
+    public static class Context {
+        private Object myobj;
+
+        public void set(final Object o) {
+            myobj = o;
+        }
+
+        public Object get() {
+            return myobj;
+        }
+    }
+
+    // @bug 8050977: Java8 Javascript Nashorn exception:
+    // no current Global instance for nashorn
+    @Test
+    public void currentGlobalMissingTest() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+
+        final Context ctx = new Context();
+        e.put("ctx", ctx);
+        e.eval("var obj = { foo: function(str) { return str.toUpperCase() } }");
+        e.eval("ctx.set(obj)");
+        final Invocable inv = (Invocable)e;
+        assertEquals("HELLO", inv.invokeMethod(ctx.get(), "foo", "hello"));
+        // try object literal
+        e.eval("ctx.set({ bar: function(str) { return str.toLowerCase() } })");
+        assertEquals("hello", inv.invokeMethod(ctx.get(), "bar", "HELLO"));
+        // try array literal
+        e.eval("var arr = [ 'hello', 'world' ]");
+        e.eval("ctx.set(arr)");
+        assertEquals("helloworld", inv.invokeMethod(ctx.get(), "join", ""));
+    }
+
+    // @bug 8068524: NashornScriptEngineFactory.getParameter() throws IAE
+    // for an unknown key, doesn't conform to the general spec
+    @Test
+    public void getParameterInvalidKeyTest() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+        // no exception expected here!
+        Object value = e.getFactory().getParameter("no value assigned to this key");
+        assertNull(value);
+    }
+
+    // @bug JDK-8068889: ConsString arguments to a functional interface wasn't converted to string.
+    @Test
+    public void functionalInterfaceStringTest() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+        final AtomicBoolean invoked = new AtomicBoolean(false);
+        e.put("f", new Function<String, String>() {
+            @Override
+            public String apply(String t) {
+                invoked.set(true);
+                return t;
+            }
+        });
+        assertEquals(e.eval("var x = 'a'; x += 'b'; f(x)"), "ab");
+        assertTrue(invoked.get());
+    }
+
+    // @bug JDK-8068889: ScriptObject arguments to a functional interface wasn't converted to a mirror.
+    @Test
+    public void functionalInterfaceObjectTest() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+        final AtomicBoolean invoked = new AtomicBoolean(false);
+        e.put("c", new Consumer<Object>() {
+            @Override
+            public void accept(Object t) {
+                assertTrue(t instanceof ScriptObjectMirror);
+                assertEquals(((ScriptObjectMirror)t).get("a"), "xyz");
+                invoked.set(true);
+            }
+        });
+        e.eval("var x = 'xy'; x += 'z';c({a:x})");
+        assertTrue(invoked.get());
+    }
+
+    @Test
+    public void testLengthOnArrayLikeObjects() throws Exception {
+        final ScriptEngine e = new ScriptEngineManager().getEngineByName("nashorn");
+        final Object val = e.eval("var arr = { length: 1, 0: 1}; arr.length");
+
+        assertTrue(Number.class.isAssignableFrom(val.getClass()));
+        assertTrue(((Number)val).intValue() == 1);
+    }
+
+    // @bug JDK-8068603: NashornScriptEngine.put/get() impls don't conform to NPE, IAE spec assertions
+    @Test
+    public void illegalBindingsValuesTest() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+
+        try {
+            e.put(null, "null-value");
+            fail();
+        } catch (NullPointerException x) {
+            // expected
+        }
+
+        try {
+            e.put("", "empty-value");
+            fail();
+        } catch (IllegalArgumentException x) {
+            // expected
+        }
+
+        final Bindings b = e.getBindings(ScriptContext.ENGINE_SCOPE);
+        assertTrue(b instanceof ScriptObjectMirror);
+
+        try {
+            b.put(null, "null-value");
+            fail();
+        } catch (NullPointerException x) {
+            // expected
+        }
+
+        try {
+            b.put("", "empty-value");
+            fail();
+        } catch (IllegalArgumentException x) {
+            // expected
+        }
+
+        try {
+            b.get(null);
+            fail();
+        } catch (NullPointerException x) {
+            // expected
+        }
+
+        try {
+            b.get("");
+            fail();
+        } catch (IllegalArgumentException x) {
+            // expected
+        }
+
+        try {
+            b.get(1);
+            fail();
+        } catch (ClassCastException x) {
+            // expected
+        }
+
+        try {
+            b.remove(null);
+            fail();
+        } catch (NullPointerException x) {
+            // expected
+        }
+
+        try {
+            b.remove("");
+            fail();
+        } catch (IllegalArgumentException x) {
+            // expected
+        }
+
+        try {
+            b.remove(1);
+            fail();
+        } catch (ClassCastException x) {
+            // expected
+        }
+
+        try {
+            b.containsKey(null);
+            fail();
+        } catch (NullPointerException x) {
+            // expected
+        }
+
+        try {
+            b.containsKey("");
+            fail();
+        } catch (IllegalArgumentException x) {
+            // expected
+        }
+
+        try {
+            b.containsKey(1);
+            fail();
+        } catch (ClassCastException x) {
+            // expected
+        }
+
+        try {
+            b.putAll(null);
+            fail();
+        } catch (NullPointerException x) {
+            // expected
+        }
+
+        try {
+            b.putAll(Collections.singletonMap((String)null, "null-value"));
+            fail();
+        } catch (NullPointerException x) {
+            // expected
+        }
+
+        try {
+            b.putAll(Collections.singletonMap("", "empty-value"));
+            fail();
+        } catch (IllegalArgumentException x) {
+            // expected
+        }
+    }
+
+    // @bug 8071989: NashornScriptEngine returns javax.script.ScriptContext instance
+    // with insonsistent get/remove methods behavior for undefined attributes
+    @Test
+    public void testScriptContextGetRemoveUndefined() throws Exception {
+        final ScriptEngineManager manager = new ScriptEngineManager();
+        final ScriptEngine e = manager.getEngineByName("nashorn");
+        final ScriptContext ctx = e.getContext();
+        assertNull(ctx.getAttribute("undefinedname", ScriptContext.ENGINE_SCOPE));
+        assertNull(ctx.removeAttribute("undefinedname", ScriptContext.ENGINE_SCOPE));
+    }
+
+    private static void checkProperty(final ScriptEngine e, final String name)
+        throws ScriptException {
+        final String value = System.getProperty(name);
+        e.put("name", name);
+        assertEquals(value, e.eval("java.lang.System.getProperty(name)"));
+    }
+
+    private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+    // Returns String that would be the result of calling PrintWriter.println
+    // of the given String. (This is to handle platform specific newline).
+    private static String println(final String str) {
+        return str + LINE_SEPARATOR;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/ScriptObjectMirrorTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,389 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Function;
+import javax.script.Bindings;
+import javax.script.Invocable;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
+import org.testng.annotations.Test;
+
+/**
+ * Tests to check jdk.nashorn.api.scripting.ScriptObjectMirror API.
+ */
+@SuppressWarnings("javadoc")
+public class ScriptObjectMirrorTest {
+
+    @SuppressWarnings("unchecked")
+    @Test
+    public void reflectionTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+
+        e.eval("var obj = { x: 344, y: 'nashorn' }");
+
+        int count = 0;
+        Map<Object, Object> map = (Map<Object, Object>) e.get("obj");
+        assertFalse(map.isEmpty());
+        assertTrue(map.keySet().contains("x"));
+        assertTrue(map.containsKey("x"));
+        assertTrue(map.values().contains("nashorn"));
+        assertTrue(map.containsValue("nashorn"));
+        for (final Map.Entry<?, ?> ex : map.entrySet()) {
+            final Object key = ex.getKey();
+            if (key.equals("x")) {
+                assertTrue(344 == ((Number) ex.getValue()).doubleValue());
+                count++;
+            } else if (key.equals("y")) {
+                assertEquals(ex.getValue(), "nashorn");
+                count++;
+            }
+        }
+        assertEquals(2, count);
+        assertEquals(2, map.size());
+
+        // add property
+        map.put("z", "hello");
+        assertEquals(e.eval("obj.z"), "hello");
+        assertEquals(map.get("z"), "hello");
+        assertTrue(map.keySet().contains("z"));
+        assertTrue(map.containsKey("z"));
+        assertTrue(map.values().contains("hello"));
+        assertTrue(map.containsValue("hello"));
+        assertEquals(map.size(), 3);
+
+        final Map<Object, Object> newMap = new HashMap<>();
+        newMap.put("foo", 23.0);
+        newMap.put("bar", true);
+        map.putAll(newMap);
+
+        assertEquals(e.eval("obj.foo"), 23.0);
+        assertEquals(e.eval("obj.bar"), true);
+
+        // remove using map method
+        map.remove("foo");
+        assertEquals(e.eval("typeof obj.foo"), "undefined");
+
+        count = 0;
+        e.eval("var arr = [ true, 'hello' ]");
+        map = (Map<Object, Object>) e.get("arr");
+        assertFalse(map.isEmpty());
+        assertTrue(map.containsKey("length"));
+        assertTrue(map.containsValue("hello"));
+        for (final Map.Entry<?, ?> ex : map.entrySet()) {
+            final Object key = ex.getKey();
+            if (key.equals("0")) {
+                assertEquals(ex.getValue(), Boolean.TRUE);
+                count++;
+            } else if (key.equals("1")) {
+                assertEquals(ex.getValue(), "hello");
+                count++;
+            }
+        }
+        assertEquals(count, 2);
+        assertEquals(map.size(), 2);
+
+        // add element
+        map.put("2", "world");
+        assertEquals(map.get("2"), "world");
+        assertEquals(map.size(), 3);
+
+        // remove all
+        map.clear();
+        assertTrue(map.isEmpty());
+        assertEquals(e.eval("typeof arr[0]"), "undefined");
+        assertEquals(e.eval("typeof arr[1]"), "undefined");
+        assertEquals(e.eval("typeof arr[2]"), "undefined");
+    }
+
+    @Test
+    public void jsobjectTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            e.eval("var obj = { '1': 'world', func: function() { return this.bar; }, bar: 'hello' }");
+            final ScriptObjectMirror obj = (ScriptObjectMirror) e.get("obj");
+
+            // try basic get on existing properties
+            if (!obj.getMember("bar").equals("hello")) {
+                fail("obj.bar != 'hello'");
+            }
+
+            if (!obj.getSlot(1).equals("world")) {
+                fail("obj[1] != 'world'");
+            }
+
+            if (!obj.callMember("func", new Object[0]).equals("hello")) {
+                fail("obj.func() != 'hello'");
+            }
+
+            // try setting properties
+            obj.setMember("bar", "new-bar");
+            obj.setSlot(1, "new-element-1");
+            if (!obj.getMember("bar").equals("new-bar")) {
+                fail("obj.bar != 'new-bar'");
+            }
+
+            if (!obj.getSlot(1).equals("new-element-1")) {
+                fail("obj[1] != 'new-element-1'");
+            }
+
+            // try adding properties
+            obj.setMember("prop", "prop-value");
+            obj.setSlot(12, "element-12");
+            if (!obj.getMember("prop").equals("prop-value")) {
+                fail("obj.prop != 'prop-value'");
+            }
+
+            if (!obj.getSlot(12).equals("element-12")) {
+                fail("obj[12] != 'element-12'");
+            }
+
+            // delete properties
+            obj.removeMember("prop");
+            if ("prop-value".equals(obj.getMember("prop"))) {
+                fail("obj.prop is not deleted!");
+            }
+
+            // Simple eval tests
+            assertEquals(obj.eval("typeof Object"), "function");
+            assertEquals(obj.eval("'nashorn'.substring(3)"), "horn");
+        } catch (final Exception exp) {
+            exp.printStackTrace();
+            fail(exp.getMessage());
+        }
+    }
+
+    @Test
+    public void scriptObjectMirrorToStringTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        try {
+            final Object obj = e.eval("new TypeError('wrong type')");
+            assertEquals(obj.toString(), "TypeError: wrong type", "toString returns wrong value");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+
+        try {
+            final Object obj = e.eval("function func() { print('hello'); }");
+            assertEquals(obj.toString(), "function func() { print('hello'); }", "toString returns wrong value");
+        } catch (final Throwable t) {
+            t.printStackTrace();
+            fail(t.getMessage());
+        }
+    }
+
+    @Test
+    public void mirrorNewObjectGlobalFunctionTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptEngine e2 = m.getEngineByName("nashorn");
+
+        e.eval("function func() {}");
+        e2.put("foo", e.get("func"));
+        final ScriptObjectMirror e2global = (ScriptObjectMirror)e2.eval("this");
+        final Object newObj = ((ScriptObjectMirror)e2global.getMember("foo")).newObject();
+        assertTrue(newObj instanceof ScriptObjectMirror);
+    }
+
+    @Test
+    public void mirrorNewObjectInstanceFunctionTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptEngine e2 = m.getEngineByName("nashorn");
+
+        e.eval("function func() {}");
+        e2.put("func", e.get("func"));
+        final ScriptObjectMirror e2obj = (ScriptObjectMirror)e2.eval("({ foo: func })");
+        final Object newObj = ((ScriptObjectMirror)e2obj.getMember("foo")).newObject();
+        assertTrue(newObj instanceof ScriptObjectMirror);
+    }
+
+    @Test
+    public void indexPropertiesExternalBufferTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptObjectMirror obj = (ScriptObjectMirror)e.eval("var obj = {}; obj");
+        final ByteBuffer buf = ByteBuffer.allocate(5);
+        int i;
+        for (i = 0; i < 5; i++) {
+            buf.put(i, (byte)(i+10));
+        }
+        obj.setIndexedPropertiesToExternalArrayData(buf);
+
+        for (i = 0; i < 5; i++) {
+            assertEquals((byte)(i+10), ((Number)e.eval("obj[" + i + "]")).byteValue());
+        }
+
+        e.eval("for (i = 0; i < 5; i++) obj[i] = 0");
+        for (i = 0; i < 5; i++) {
+            assertEquals((byte)0, ((Number)e.eval("obj[" + i + "]")).byteValue());
+            assertEquals((byte)0, buf.get(i));
+        }
+    }
+
+    @Test
+    public void conversionTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        final ScriptObjectMirror arr = (ScriptObjectMirror)e.eval("[33, 45, 23]");
+        final int[] intArr = arr.to(int[].class);
+        assertEquals(intArr[0], 33);
+        assertEquals(intArr[1], 45);
+        assertEquals(intArr[2], 23);
+
+        final List<?> list = arr.to(List.class);
+        assertEquals(list.get(0), 33);
+        assertEquals(list.get(1), 45);
+        assertEquals(list.get(2), 23);
+
+        ScriptObjectMirror obj = (ScriptObjectMirror)e.eval(
+            "({ valueOf: function() { return 42 } })");
+        assertEquals(Double.valueOf(42.0), obj.to(Double.class));
+
+        obj = (ScriptObjectMirror)e.eval(
+            "({ toString: function() { return 'foo' } })");
+        assertEquals("foo", obj.to(String.class));
+    }
+
+    // @bug 8044000: Access to undefined property yields "null" instead of "undefined"
+    @Test
+    public void mapScriptObjectMirrorCallsiteTest() throws ScriptException {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine engine = m.getEngineByName("nashorn");
+        final String TEST_SCRIPT = "typeof obj.foo";
+
+        final Bindings global = engine.getContext().getBindings(ScriptContext.ENGINE_SCOPE);
+        engine.eval("var obj = java.util.Collections.emptyMap()");
+        // this will drive callsite "obj.foo" of TEST_SCRIPT
+        // to use "obj instanceof Map" as it's guard
+        engine.eval(TEST_SCRIPT, global);
+        // redefine 'obj' to be a script object
+        engine.eval("obj = {}");
+
+        final Bindings newGlobal = engine.createBindings();
+        // transfer 'obj' from default global to new global
+        // new global will get a ScriptObjectMirror wrapping 'obj'
+        newGlobal.put("obj", global.get("obj"));
+
+        // Every ScriptObjectMirror is a Map! If callsite "obj.foo"
+        // does not see the new 'obj' is a ScriptObjectMirror, it'll
+        // continue to use Map's get("obj.foo") instead of ScriptObjectMirror's
+        // getMember("obj.foo") - thereby getting null instead of undefined
+        assertEquals("undefined", engine.eval(TEST_SCRIPT, newGlobal));
+    }
+
+    public interface MirrorCheckExample {
+        Object test1(Object arg);
+        Object test2(Object arg);
+        boolean compare(Object o1, Object o2);
+    }
+
+    // @bug 8053910: ScriptObjectMirror causing havoc with Invocation interface
+    @Test
+    public void checkMirrorToObject() throws Exception {
+        final ScriptEngineManager engineManager = new ScriptEngineManager();
+        final ScriptEngine engine = engineManager.getEngineByName("nashorn");
+        final Invocable invocable = (Invocable)engine;
+
+        engine.eval("function test1(arg) { return { arg: arg }; }");
+        engine.eval("function test2(arg) { return arg; }");
+        engine.eval("function compare(arg1, arg2) { return arg1 == arg2; }");
+
+        final Map<String, Object> map = new HashMap<>();
+        map.put("option", true);
+
+        final MirrorCheckExample example = invocable.getInterface(MirrorCheckExample.class);
+
+        final Object value1 = invocable.invokeFunction("test1", map);
+        final Object value2 = example.test1(map);
+        final Object value3 = invocable.invokeFunction("test2", value2);
+        final Object value4 = example.test2(value2);
+
+        // check that Object type argument receives a ScriptObjectMirror
+        // when ScriptObject is passed
+        assertEquals(ScriptObjectMirror.class, value1.getClass());
+        assertEquals(ScriptObjectMirror.class, value2.getClass());
+        assertEquals(ScriptObjectMirror.class, value3.getClass());
+        assertEquals(ScriptObjectMirror.class, value4.getClass());
+        assertTrue((boolean)invocable.invokeFunction("compare", value1, value1));
+        assertTrue(example.compare(value1, value1));
+        assertTrue((boolean)invocable.invokeFunction("compare", value3, value4));
+        assertTrue(example.compare(value3, value4));
+    }
+
+    // @bug 8053910: ScriptObjectMirror causing havoc with Invocation interface
+    @Test
+    public void mirrorUnwrapInterfaceMethod() throws Exception {
+        final ScriptEngineManager engineManager = new ScriptEngineManager();
+        final ScriptEngine engine = engineManager.getEngineByName("nashorn");
+        final Invocable invocable = (Invocable)engine;
+        engine.eval("function apply(obj) { " +
+            " return obj instanceof Packages.jdk.nashorn.api.scripting.ScriptObjectMirror; " +
+            "}");
+        @SuppressWarnings("unchecked")
+        final Function<Object,Object> func = invocable.getInterface(Function.class);
+        assertFalse((boolean)func.apply(engine.eval("({ x: 2 })")));
+    }
+
+    // @bug 8055687: Wrong "this" passed to JSObject.eval call
+    @Test
+    public void checkThisForJSObjectEval() throws Exception {
+        final ScriptEngineManager engineManager = new ScriptEngineManager();
+        final ScriptEngine e = engineManager.getEngineByName("nashorn");
+        final JSObject jsobj = (JSObject)e.eval("({foo: 23, bar: 'hello' })");
+        assertEquals(((Number)jsobj.eval("this.foo")).intValue(), 23);
+        assertEquals(jsobj.eval("this.bar"), "hello");
+        assertEquals(jsobj.eval("String(this)"), "[object Object]");
+        final Object global = e.eval("this");
+        assertFalse(global.equals(jsobj.eval("this")));
+    }
+
+    @Test
+    public void topLevelAnonFuncStatement() throws Exception {
+        final ScriptEngineManager engineManager = new ScriptEngineManager();
+        final ScriptEngine e = engineManager.getEngineByName("nashorn");
+        final JSObject func = (JSObject)e.eval("function(x) { return x + ' world' }");
+        assertTrue(func.isFunction());
+        assertEquals(func.call(e.eval("this"), "hello"), "hello world");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/VariableArityTestInterface.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+@SuppressWarnings("javadoc")
+public interface VariableArityTestInterface {
+    public String test1(int i, String... strings);
+    public String test2(int i, String... strings);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/Window.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+import java.util.Map;
+import javax.script.Bindings;
+import jdk.nashorn.api.scripting.JSObject;
+import jdk.nashorn.api.scripting.ScriptObjectMirror;
+
+@SuppressWarnings("javadoc")
+public class Window {
+
+    private String location = "http://localhost:8080/window";
+
+    private WindowEventHandler onload   = null;
+
+    public void alert(final String message) {
+        System.out.println("alert: " + message);
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(final String location) {
+        this.location = location;
+    }
+
+    public String item(final int index) {
+        return Integer.toHexString(index);
+    }
+
+    public WindowEventHandler getOnload() {
+        return onload;
+    }
+
+    public void setOnload(final WindowEventHandler onload) {
+        this.onload = onload;
+    }
+
+    public static int setTimeout(final Window self, final String code, final int delay) {
+        return self.setTimeout(code, delay);
+    }
+
+    public int setTimeout(final String code, final int delay) {
+        System.out.println("window.setTimeout: " + delay + ", code: " + code);
+        return 0;
+    }
+
+    public static Object funcJSObject(final JSObject jsobj) {
+        return jsobj.getMember("foo");
+    }
+
+    public static Object funcScriptObjectMirror(final ScriptObjectMirror sobj) {
+        return sobj.get("foo");
+    }
+
+    public static Object funcMap(final Map<?,?> map) {
+        return map.get("foo");
+    }
+
+    public static Object funcBindings(final Bindings bindings) {
+        return bindings.get("foo");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/WindowEventHandler.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.scripting.test;
+
+@SuppressWarnings("javadoc")
+public interface WindowEventHandler {
+    public boolean loaded();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/resources/func.js	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
+
+var scopeVar = 1;
+var global = this;
+undefGlobal = this;
+
+function scopeTest() {
+    if (this !== global) {
+        throw new Error("this !== global");
+    }
+    if (this !== undefGlobal) {
+        throw new Error("this !== undefinedGlobal")
+    }
+    return scopeVar;
+}
+
+scopeTest();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/resources/gettersetter.js	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
+
+var v;
+
+Object.defineProperty(this, "accessor1", {
+    get: function() { return v; },
+    set: function(n) { v = n; }
+});
+
+Object.defineProperty(this, "accessor2", {
+    get: function() { return x; },
+    set: function(n) { x = n; }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/scripting/test/resources/witheval.js	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// This script is loaded from jdk.nashorn.api.scripting.ScopeTest to test script class sharing and reuse.
+
+var a;
+
+function outer(p, e) {
+    eval(e);
+    with(p) {
+        function inner() {
+            a = 1;
+            c = 10;
+            if (a !== 1) {
+                throw new Error("a !== 1");
+            }
+            if (b !== 3) {
+                throw new Error("b !== 3");
+            }
+            if (c !== 10) {
+                throw new Error("c !== 10");
+            }
+        }
+        inner();
+    }
+}
+
+outer({}, "b = 3;");
+
+if (a !== 1) {
+    throw new Error("a !== 1");
+}
+if (b !== 3) {
+    throw new Error("b !== 3");
+}
+if (c !== 10) {
+    throw new Error("c !== 10");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/test/NashornSQLDriver.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.api.test;
+
+import java.sql.Connection;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.sql.DriverPropertyInfo;
+import java.sql.SQLException;
+import java.sql.SQLFeatureNotSupportedException;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+/**
+ * A dummy SQL driver for testing purpose.
+ */
+public final class NashornSQLDriver implements Driver {
+    static {
+        try {
+            DriverManager.registerDriver(new NashornSQLDriver(), null);
+        } catch (final SQLException se) {
+            throw new RuntimeException(se);
+        }
+    }
+
+    @Override
+    public boolean acceptsURL(final String url) {
+        return url.startsWith("jdbc:nashorn:");
+    }
+
+    @Override
+    public Connection connect(final String url, final Properties info) {
+        throw new UnsupportedOperationException("I am a dummy!!");
+    }
+
+    @Override
+    public int getMajorVersion() {
+        return -1;
+    }
+
+    @Override
+    public int getMinorVersion() {
+        return -1;
+    }
+
+    @Override
+    public DriverPropertyInfo[] getPropertyInfo(final String url, final Properties info) {
+        return new DriverPropertyInfo[0];
+    }
+
+    @Override
+    public boolean jdbcCompliant() {
+        // no way!
+        return false;
+    }
+
+    @Override
+    public Logger getParentLogger() throws SQLFeatureNotSupportedException {
+        throw new SQLFeatureNotSupportedException();
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/api/tree/ParseAPITest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.nashorn.api.tree;
-
-import java.io.File;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.nio.file.Files;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-/**
- * Test for nashorn Parser API (jdk.nashorn.api.tree.*)
- */
-public class ParseAPITest {
-
-    private static final boolean VERBOSE   = Boolean.valueOf(System.getProperty("parserapitest.verbose"));
-    private static final boolean TEST262   = Boolean.valueOf(System.getProperty("parserapitest.test262"));
-
-    private static final String TEST_BASIC_DIR     = System.getProperty("test.basic.dir");
-    private static final String TEST_MAPTESTS_DIR  = System.getProperty("test.maptests.dir");
-    private static final String TEST_SANDBOX_DIR   = System.getProperty("test.sandbox.dir");
-    private static final String TEST_TRUSTED_DIR   = System.getProperty("test.trusted.dir");
-    private static final String TEST262_SUITE_DIR  = System.getProperty("test262.suite.dir");
-
-    interface TestFilter {
-        public boolean exclude(File file, String content);
-    }
-
-    private void log(String msg) {
-        org.testng.Reporter.log(msg, true);
-    }
-
-    private static final String[] options = new String[] {
-        "-scripting", "--const-as-var"
-    };
-
-    @Test
-    public void parseAllTests() {
-        if (TEST262) {
-            parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
-                @Override
-                public boolean exclude(final File file, final String content) {
-                    return content.indexOf("@negative") != -1;
-                }
-            });
-        }
-        parseTestSet(TEST_BASIC_DIR, new TestFilter() {
-            @Override
-            public boolean exclude(final File file, final String content) {
-                return file.getParentFile().getName().equals("es6");
-            }
-        });
-        parseTestSet(TEST_MAPTESTS_DIR, null);
-        parseTestSet(TEST_SANDBOX_DIR, null);
-        parseTestSet(TEST_TRUSTED_DIR, null);
-    }
-
-    private void parseTestSet(final String testSet, final TestFilter filter) {
-        passed  = 0;
-        failed  = 0;
-        skipped = 0;
-
-        final File testSetDir = new File(testSet);
-        if (! testSetDir.isDirectory()) {
-            log("WARNING: " + testSetDir + " not found or not a directory");
-            return;
-        }
-        log(testSetDir.getAbsolutePath());
-        parseJSDirectory(testSetDir, filter);
-
-        log(testSet + " parse API done!");
-        log("parse API ok: " + passed);
-        log("parse API failed: " + failed);
-        log("parse API skipped: " + skipped);
-        if (failed != 0) {
-            Assert.fail(failed + " tests failed to parse in " + testSetDir.getAbsolutePath());
-        }
-    }
-
-    // number of scripts that parsed fine
-    private int passed;
-    // number of scripts resulting in parse failure
-    private int failed;
-    // scripts that were skipped - all tests with @negative are
-    // skipped for now.
-    private int skipped;
-
-    private void parseJSDirectory(final File dir, final TestFilter filter) {
-        for (final File f : dir.listFiles()) {
-            if (f.isDirectory()) {
-                parseJSDirectory(f, filter);
-            } else if (f.getName().endsWith(".js")) {
-                parseJSFile(f, filter);
-            }
-        }
-    }
-
-    private void parseJSFile(final File file, final TestFilter filter) {
-        if (VERBOSE) {
-            log("Begin parsing " + file.getAbsolutePath());
-        }
-
-        try {
-            final char[] buffer = readFully(file);
-            final String content = new String(buffer);
-            boolean excluded = false;
-            if (filter != null) {
-                excluded = filter.exclude(file, content);
-            }
-
-            if (excluded) {
-                if (VERBOSE) {
-                    log("Skipping " + file.getAbsolutePath());
-                }
-                skipped++;
-                return;
-            }
-
-            final Parser parser = Parser.create(options);
-            final Tree tree = parser.parse(file.getAbsolutePath(), content, null);
-            tree.accept(new SimpleTreeVisitorES5_1<Void, Void>(), null);
-            passed++;
-        } catch (final Throwable exp) {
-            log("Parse API failed: " + file.getAbsolutePath() + " : " + exp);
-            //if (VERBOSE) {
-                exp.printStackTrace(System.out);
-            //}
-            failed++;
-        }
-
-        if (VERBOSE) {
-            log("Done parsing via parser API " + file.getAbsolutePath());
-        }
-    }
-
-    private static char[] byteToCharArray(final byte[] bytes) {
-        Charset cs = StandardCharsets.UTF_8;
-        int start = 0;
-        // BOM detection.
-        if (bytes.length > 1 && bytes[0] == (byte) 0xFE && bytes[1] == (byte) 0xFF) {
-            start = 2;
-            cs = StandardCharsets.UTF_16BE;
-        } else if (bytes.length > 1 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE) {
-            start = 2;
-            cs = StandardCharsets.UTF_16LE;
-        } else if (bytes.length > 2 && bytes[0] == (byte) 0xEF && bytes[1] == (byte) 0xBB && bytes[2] == (byte) 0xBF) {
-            start = 3;
-            cs = StandardCharsets.UTF_8;
-        } else if (bytes.length > 3 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE && bytes[2] == 0 && bytes[3] == 0) {
-            start = 4;
-            cs = Charset.forName("UTF-32LE");
-        } else if (bytes.length > 3 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == (byte) 0xFE && bytes[3] == (byte) 0xFF) {
-            start = 4;
-            cs = Charset.forName("UTF-32BE");
-        }
-
-        return new String(bytes, start, bytes.length - start, cs).toCharArray();
-    }
-
-    private static char[] readFully(final File file) throws IOException {
-        final byte[] buf = Files.readAllBytes(file.toPath());
-        return byteToCharArray(buf);
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/api/tree/test/ParseAPITest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.api.tree.test;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import jdk.nashorn.api.tree.Parser;
+import jdk.nashorn.api.tree.SimpleTreeVisitorES5_1;
+import jdk.nashorn.api.tree.Tree;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/**
+ * Test for nashorn Parser API (jdk.nashorn.api.tree.*)
+ */
+public class ParseAPITest {
+
+    private static final boolean VERBOSE   = Boolean.valueOf(System.getProperty("parserapitest.verbose"));
+    private static final boolean TEST262   = Boolean.valueOf(System.getProperty("parserapitest.test262"));
+
+    private static final String TEST_BASIC_DIR     = System.getProperty("test.basic.dir");
+    private static final String TEST_MAPTESTS_DIR  = System.getProperty("test.maptests.dir");
+    private static final String TEST_SANDBOX_DIR   = System.getProperty("test.sandbox.dir");
+    private static final String TEST_TRUSTED_DIR   = System.getProperty("test.trusted.dir");
+    private static final String TEST262_SUITE_DIR  = System.getProperty("test262.suite.dir");
+
+    interface TestFilter {
+        public boolean exclude(File file, String content);
+    }
+
+    private void log(String msg) {
+        org.testng.Reporter.log(msg, true);
+    }
+
+    private static final String[] options = new String[] {
+        "-scripting", "--const-as-var"
+    };
+
+    @Test
+    public void parseAllTests() {
+        if (TEST262) {
+            parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
+                @Override
+                public boolean exclude(final File file, final String content) {
+                    return content.indexOf("@negative") != -1;
+                }
+            });
+        }
+        parseTestSet(TEST_BASIC_DIR, new TestFilter() {
+            @Override
+            public boolean exclude(final File file, final String content) {
+                return file.getParentFile().getName().equals("es6");
+            }
+        });
+        parseTestSet(TEST_MAPTESTS_DIR, null);
+        parseTestSet(TEST_SANDBOX_DIR, null);
+        parseTestSet(TEST_TRUSTED_DIR, null);
+    }
+
+    private void parseTestSet(final String testSet, final TestFilter filter) {
+        passed  = 0;
+        failed  = 0;
+        skipped = 0;
+
+        final File testSetDir = new File(testSet);
+        if (! testSetDir.isDirectory()) {
+            log("WARNING: " + testSetDir + " not found or not a directory");
+            return;
+        }
+        log(testSetDir.getAbsolutePath());
+        parseJSDirectory(testSetDir, filter);
+
+        log(testSet + " parse API done!");
+        log("parse API ok: " + passed);
+        log("parse API failed: " + failed);
+        log("parse API skipped: " + skipped);
+        if (failed != 0) {
+            Assert.fail(failed + " tests failed to parse in " + testSetDir.getAbsolutePath());
+        }
+    }
+
+    // number of scripts that parsed fine
+    private int passed;
+    // number of scripts resulting in parse failure
+    private int failed;
+    // scripts that were skipped - all tests with @negative are
+    // skipped for now.
+    private int skipped;
+
+    private void parseJSDirectory(final File dir, final TestFilter filter) {
+        for (final File f : dir.listFiles()) {
+            if (f.isDirectory()) {
+                parseJSDirectory(f, filter);
+            } else if (f.getName().endsWith(".js")) {
+                parseJSFile(f, filter);
+            }
+        }
+    }
+
+    private void parseJSFile(final File file, final TestFilter filter) {
+        if (VERBOSE) {
+            log("Begin parsing " + file.getAbsolutePath());
+        }
+
+        try {
+            final char[] buffer = readFully(file);
+            final String content = new String(buffer);
+            boolean excluded = false;
+            if (filter != null) {
+                excluded = filter.exclude(file, content);
+            }
+
+            if (excluded) {
+                if (VERBOSE) {
+                    log("Skipping " + file.getAbsolutePath());
+                }
+                skipped++;
+                return;
+            }
+
+            final Parser parser = Parser.create(options);
+            final Tree tree = parser.parse(file.getAbsolutePath(), content, null);
+            tree.accept(new SimpleTreeVisitorES5_1<Void, Void>(), null);
+            passed++;
+        } catch (final Throwable exp) {
+            log("Parse API failed: " + file.getAbsolutePath() + " : " + exp);
+            //if (VERBOSE) {
+                exp.printStackTrace(System.out);
+            //}
+            failed++;
+        }
+
+        if (VERBOSE) {
+            log("Done parsing via parser API " + file.getAbsolutePath());
+        }
+    }
+
+    private static char[] byteToCharArray(final byte[] bytes) {
+        Charset cs = StandardCharsets.UTF_8;
+        int start = 0;
+        // BOM detection.
+        if (bytes.length > 1 && bytes[0] == (byte) 0xFE && bytes[1] == (byte) 0xFF) {
+            start = 2;
+            cs = StandardCharsets.UTF_16BE;
+        } else if (bytes.length > 1 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE) {
+            start = 2;
+            cs = StandardCharsets.UTF_16LE;
+        } else if (bytes.length > 2 && bytes[0] == (byte) 0xEF && bytes[1] == (byte) 0xBB && bytes[2] == (byte) 0xBF) {
+            start = 3;
+            cs = StandardCharsets.UTF_8;
+        } else if (bytes.length > 3 && bytes[0] == (byte) 0xFF && bytes[1] == (byte) 0xFE && bytes[2] == 0 && bytes[3] == 0) {
+            start = 4;
+            cs = Charset.forName("UTF-32LE");
+        } else if (bytes.length > 3 && bytes[0] == 0 && bytes[1] == 0 && bytes[2] == (byte) 0xFE && bytes[3] == (byte) 0xFF) {
+            start = 4;
+            cs = Charset.forName("UTF-32BE");
+        }
+
+        return new String(bytes, start, bytes.length - start, cs).toCharArray();
+    }
+
+    private static char[] readFully(final File file) throws IOException {
+        final byte[] buf = Files.readAllBytes(file.toPath());
+        return byteToCharArray(buf);
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/internal/codegen/CompilerTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.codegen;
-
-import static jdk.nashorn.internal.runtime.Source.readFully;
-import static jdk.nashorn.internal.runtime.Source.sourceFor;
-import java.io.File;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import jdk.nashorn.internal.objects.Global;
-import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.ErrorManager;
-import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.Source;
-import jdk.nashorn.internal.runtime.options.Options;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * Tests to check Nashorn JS compiler - just compiler and not execution of scripts.
- */
-@SuppressWarnings("javadoc")
-public class CompilerTest {
-    private static final boolean VERBOSE  = Boolean.valueOf(System.getProperty("compilertest.verbose"));
-    private static final boolean TEST262  = Boolean.valueOf(System.getProperty("compilertest.test262"));
-    private static final String TEST_BASIC_DIR  = System.getProperty("test.basic.dir");
-    private static final String TEST_NODE_DIR  = System.getProperty("test.node.dir");
-    private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
-
-    interface TestFilter {
-        public boolean exclude(File file, String content);
-    }
-
-    private static void log(final String msg) {
-        org.testng.Reporter.log(msg, true);
-    }
-
-    private Context context;
-    private Global  global;
-
-    @BeforeClass
-    public void setupTest() {
-        final Options options = new Options("nashorn");
-        options.set("compile.only", true);
-        options.set("print.ast", true);
-        options.set("print.parse", true);
-        options.set("scripting", true);
-        options.set("const.as.var", true);
-        options.set("verify.code", true);
-
-        final ErrorManager errors = new ErrorManager() {
-            @Override
-            public void error(final String msg) {
-                log(msg);
-            }
-        };
-
-        final StringWriter sw = new StringWriter();
-        final PrintWriter pw = new PrintWriter(sw);
-        this.context = new Context(options, errors, pw, pw, Thread.currentThread().getContextClassLoader());
-        this.global = context.createGlobal();
-    }
-
-    @AfterClass
-    public void tearDownTest() {
-        this.context = null;
-        this.global = null;
-    }
-
-    @Test
-    public void compileAllTests() {
-        if (TEST262) {
-            compileTestSet(new File(TEST262_SUITE_DIR), new TestFilter() {
-                @Override
-                public boolean exclude(final File file, final String content) {
-                    return content != null && content.contains("@negative");
-                }
-            });
-        }
-        compileTestSet(new File(TEST_BASIC_DIR), new TestFilter() {
-            @Override
-            public boolean exclude(final File file, final String content) {
-                return file.getName().equals("es6");
-            }
-        });
-        compileTestSet(new File(TEST_NODE_DIR, "node"), null);
-        compileTestSet(new File(TEST_NODE_DIR, "src"), null);
-    }
-
-    private void compileTestSet(final File testSetDir, final TestFilter filter) {
-        passed = 0;
-        failed = 0;
-        skipped = 0;
-        if (! testSetDir.isDirectory()) {
-            log("WARNING: " + testSetDir + " not found or not a directory");
-            return;
-        }
-        log(testSetDir.getAbsolutePath());
-        compileJSDirectory(testSetDir, filter);
-
-        log(testSetDir + " compile done!");
-        log("compile ok: " + passed);
-        log("compile failed: " + failed);
-        log("compile skipped: " + skipped);
-        if (failed != 0) {
-            Assert.fail(failed + " tests failed to compile in " + testSetDir.getAbsolutePath());
-        }
-    }
-
-    // number of scripts that compiled fine
-    private int passed;
-    // number of scripts resulting in compile failure
-    private int failed;
-    // scripts that were skipped - all tests with @negative are
-    // skipped for now.
-    private int skipped;
-
-    private void compileJSDirectory(final File dir, final TestFilter filter) {
-        if (filter != null && filter.exclude(dir, null)) {
-            return;
-        }
-        for (final File f : dir.listFiles()) {
-            if (f.isDirectory()) {
-                compileJSDirectory(f, filter);
-            } else if (f.getName().endsWith(".js")) {
-                compileJSFile(f, filter);
-            }
-        }
-    }
-
-    private void compileJSFile(final File file, final TestFilter filter) {
-        if (VERBOSE) {
-            log("Begin compiling " + file.getAbsolutePath());
-        }
-
-        final Global oldGlobal = Context.getGlobal();
-        final boolean globalChanged = (oldGlobal != global);
-
-        try {
-            final char[] buffer = readFully(file);
-            boolean excluded = false;
-
-            if (filter != null) {
-                final String content = new String(buffer);
-                excluded = filter.exclude(file, content);
-            }
-
-            if (excluded) {
-                if (VERBOSE) {
-                    log("Skipping " + file.getAbsolutePath());
-                }
-                skipped++;
-                return;
-            }
-
-            if (globalChanged) {
-                Context.setGlobal(global);
-            }
-            final Source source = sourceFor(file.getAbsolutePath(), buffer);
-            final ScriptFunction script = context.compileScript(source, global);
-            if (script == null || context.getErrorManager().getNumberOfErrors() > 0) {
-                log("Compile failed: " + file.getAbsolutePath());
-                failed++;
-            } else {
-                passed++;
-            }
-        } catch (final Throwable t) {
-            log("Compile failed: " + file.getAbsolutePath() + " : " + t);
-            if (VERBOSE) {
-                t.printStackTrace(System.out);
-            }
-            failed++;
-        } finally {
-            if (globalChanged) {
-                Context.setGlobal(oldGlobal);
-            }
-        }
-
-        if (VERBOSE) {
-            log("Done compiling " + file.getAbsolutePath());
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/codegen/test/CompilerTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.codegen.test;
+
+import static jdk.nashorn.internal.runtime.Source.readFully;
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+import java.io.File;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import jdk.nashorn.internal.objects.Global;
+import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ErrorManager;
+import jdk.nashorn.internal.runtime.ScriptFunction;
+import jdk.nashorn.internal.runtime.Source;
+import jdk.nashorn.internal.runtime.options.Options;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Tests to check Nashorn JS compiler - just compiler and not execution of scripts.
+ */
+@SuppressWarnings("javadoc")
+public class CompilerTest {
+    private static final boolean VERBOSE  = Boolean.valueOf(System.getProperty("compilertest.verbose"));
+    private static final boolean TEST262  = Boolean.valueOf(System.getProperty("compilertest.test262"));
+    private static final String TEST_BASIC_DIR  = System.getProperty("test.basic.dir");
+    private static final String TEST_NODE_DIR  = System.getProperty("test.node.dir");
+    private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
+
+    interface TestFilter {
+        public boolean exclude(File file, String content);
+    }
+
+    private static void log(final String msg) {
+        org.testng.Reporter.log(msg, true);
+    }
+
+    private Context context;
+    private Global  global;
+
+    @BeforeClass
+    public void setupTest() {
+        final Options options = new Options("nashorn");
+        options.set("compile.only", true);
+        options.set("print.ast", true);
+        options.set("print.parse", true);
+        options.set("scripting", true);
+        options.set("const.as.var", true);
+        options.set("verify.code", true);
+
+        final ErrorManager errors = new ErrorManager() {
+            @Override
+            public void error(final String msg) {
+                log(msg);
+            }
+        };
+
+        final StringWriter sw = new StringWriter();
+        final PrintWriter pw = new PrintWriter(sw);
+        this.context = new Context(options, errors, pw, pw, Thread.currentThread().getContextClassLoader());
+        this.global = context.createGlobal();
+    }
+
+    @AfterClass
+    public void tearDownTest() {
+        this.context = null;
+        this.global = null;
+    }
+
+    @Test
+    public void compileAllTests() {
+        if (TEST262) {
+            compileTestSet(new File(TEST262_SUITE_DIR), new TestFilter() {
+                @Override
+                public boolean exclude(final File file, final String content) {
+                    return content != null && content.contains("@negative");
+                }
+            });
+        }
+        compileTestSet(new File(TEST_BASIC_DIR), new TestFilter() {
+            @Override
+            public boolean exclude(final File file, final String content) {
+                return file.getName().equals("es6");
+            }
+        });
+        compileTestSet(new File(TEST_NODE_DIR, "node"), null);
+        compileTestSet(new File(TEST_NODE_DIR, "src"), null);
+    }
+
+    private void compileTestSet(final File testSetDir, final TestFilter filter) {
+        passed = 0;
+        failed = 0;
+        skipped = 0;
+        if (! testSetDir.isDirectory()) {
+            log("WARNING: " + testSetDir + " not found or not a directory");
+            return;
+        }
+        log(testSetDir.getAbsolutePath());
+        compileJSDirectory(testSetDir, filter);
+
+        log(testSetDir + " compile done!");
+        log("compile ok: " + passed);
+        log("compile failed: " + failed);
+        log("compile skipped: " + skipped);
+        if (failed != 0) {
+            Assert.fail(failed + " tests failed to compile in " + testSetDir.getAbsolutePath());
+        }
+    }
+
+    // number of scripts that compiled fine
+    private int passed;
+    // number of scripts resulting in compile failure
+    private int failed;
+    // scripts that were skipped - all tests with @negative are
+    // skipped for now.
+    private int skipped;
+
+    private void compileJSDirectory(final File dir, final TestFilter filter) {
+        if (filter != null && filter.exclude(dir, null)) {
+            return;
+        }
+        for (final File f : dir.listFiles()) {
+            if (f.isDirectory()) {
+                compileJSDirectory(f, filter);
+            } else if (f.getName().endsWith(".js")) {
+                compileJSFile(f, filter);
+            }
+        }
+    }
+
+    private void compileJSFile(final File file, final TestFilter filter) {
+        if (VERBOSE) {
+            log("Begin compiling " + file.getAbsolutePath());
+        }
+
+        final Global oldGlobal = Context.getGlobal();
+        final boolean globalChanged = (oldGlobal != global);
+
+        try {
+            final char[] buffer = readFully(file);
+            boolean excluded = false;
+
+            if (filter != null) {
+                final String content = new String(buffer);
+                excluded = filter.exclude(file, content);
+            }
+
+            if (excluded) {
+                if (VERBOSE) {
+                    log("Skipping " + file.getAbsolutePath());
+                }
+                skipped++;
+                return;
+            }
+
+            if (globalChanged) {
+                Context.setGlobal(global);
+            }
+            final Source source = sourceFor(file.getAbsolutePath(), buffer);
+            final ScriptFunction script = context.compileScript(source, global);
+            if (script == null || context.getErrorManager().getNumberOfErrors() > 0) {
+                log("Compile failed: " + file.getAbsolutePath());
+                failed++;
+            } else {
+                passed++;
+            }
+        } catch (final Throwable t) {
+            log("Compile failed: " + file.getAbsolutePath() + " : " + t);
+            if (VERBOSE) {
+                t.printStackTrace(System.out);
+            }
+            failed++;
+        } finally {
+            if (globalChanged) {
+                Context.setGlobal(oldGlobal);
+            }
+        }
+
+        if (VERBOSE) {
+            log("Done compiling " + file.getAbsolutePath());
+        }
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/internal/parser/ParserTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.parser;
-
-import static jdk.nashorn.internal.runtime.Source.readFully;
-import static jdk.nashorn.internal.runtime.Source.sourceFor;
-import java.io.File;
-import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.ErrorManager;
-import jdk.nashorn.internal.runtime.Source;
-import jdk.nashorn.internal.runtime.options.Options;
-import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-/**
- * Run tests to check Nashorn's parser.
- */
-@SuppressWarnings("javadoc")
-public class ParserTest {
-    private static final boolean VERBOSE   = Boolean.valueOf(System.getProperty("parsertest.verbose"));
-    private static final boolean TEST262   = Boolean.valueOf(System.getProperty("parsertest.test262"));
-
-    private static final String TEST_BASIC_DIR  = System.getProperty("test.basic.dir");
-    private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
-
-
-    interface TestFilter {
-        public boolean exclude(File file, String content);
-    }
-
-    private static void log(final String msg) {
-        org.testng.Reporter.log(msg, true);
-    }
-
-    private Context context;
-
-    @BeforeClass
-    public void setupTest() {
-        final Options options = new Options("nashorn");
-        options.set("parse.only", true);
-        options.set("scripting", true);
-        options.set("const.as.var", true);
-
-        final ErrorManager errors = new ErrorManager();
-        this.context = new Context(options, errors, Thread.currentThread().getContextClassLoader());
-    }
-
-    @AfterClass
-    public void tearDownTest() {
-        this.context = null;
-    }
-
-    @Test
-    public void parseAllTests() {
-        if (TEST262) {
-            parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
-                @Override
-                public boolean exclude(final File file, final String content) {
-                    return content != null && content.contains("@negative");
-                }
-            });
-        }
-        parseTestSet(TEST_BASIC_DIR,  new TestFilter() {
-            @Override
-            public boolean exclude(final File file, final String content) {
-                return file.getName().equals("es6");
-            }
-        });
-    }
-
-    private void parseTestSet(final String testSet, final TestFilter filter) {
-        passed  = 0;
-        failed  = 0;
-        skipped = 0;
-
-        final File testSetDir = new File(testSet);
-        if (! testSetDir.isDirectory()) {
-            log("WARNING: " + testSetDir + " not found or not a directory");
-            return;
-        }
-        log(testSetDir.getAbsolutePath());
-        parseJSDirectory(testSetDir, filter);
-
-        log(testSet + " parse done!");
-        log("parse ok: " + passed);
-        log("parse failed: " + failed);
-        log("parse skipped: " + skipped);
-        if (failed != 0) {
-            Assert.fail(failed + " tests failed to compile in " + testSetDir.getAbsolutePath());
-        }
-    }
-
-    // number of scripts that parsed fine
-    private int passed;
-    // number of scripts resulting in parse failure
-    private int failed;
-    // scripts that were skipped - all tests with @negative are
-    // skipped for now.
-    private int skipped;
-
-    private void parseJSDirectory(final File dir, final TestFilter filter) {
-        if (filter != null && filter.exclude(dir, null)) {
-            return;
-        }
-        for (final File f : dir.listFiles()) {
-            if (f.isDirectory()) {
-                parseJSDirectory(f, filter);
-            } else if (f.getName().endsWith(".js")) {
-                parseJSFile(f, filter);
-            }
-        }
-    }
-
-    private void parseJSFile(final File file, final TestFilter filter) {
-        if (VERBOSE) {
-            log("Begin parsing " + file.getAbsolutePath());
-        }
-
-        try {
-            final char[] buffer = readFully(file);
-            boolean excluded = false;
-            if (filter != null) {
-                final String content = new String(buffer);
-                excluded = filter.exclude(file, content);
-            }
-
-            if (excluded) {
-                if (VERBOSE) {
-                    log("Skipping " + file.getAbsolutePath());
-                }
-                skipped++;
-                return;
-            }
-
-            final ErrorManager errors = new ErrorManager() {
-                @Override
-                public void error(final String msg) {
-                    log(msg);
-                }
-            };
-            errors.setLimit(0);
-            final Source source = sourceFor(file.getAbsolutePath(), buffer);
-            new Parser(context.getEnv(), source, errors, context.getEnv()._strict, null).parse();
-            if (errors.getNumberOfErrors() > 0) {
-                log("Parse failed: " + file.getAbsolutePath());
-                failed++;
-            } else {
-                passed++;
-            }
-        } catch (final Throwable exp) {
-            exp.printStackTrace();
-            log("Parse failed: " + file.getAbsolutePath() + " : " + exp);
-            if (VERBOSE) {
-                exp.printStackTrace(System.out);
-            }
-            failed++;
-        }
-
-        if (VERBOSE) {
-            log("Done parsing " + file.getAbsolutePath());
-        }
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/parser/test/ParserTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.parser.test;
+
+import static jdk.nashorn.internal.runtime.Source.readFully;
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+import java.io.File;
+import jdk.nashorn.internal.parser.Parser;
+import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ErrorManager;
+import jdk.nashorn.internal.runtime.Source;
+import jdk.nashorn.internal.runtime.options.Options;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/**
+ * Run tests to check Nashorn's parser.
+ */
+@SuppressWarnings("javadoc")
+public class ParserTest {
+    private static final boolean VERBOSE   = Boolean.valueOf(System.getProperty("parsertest.verbose"));
+    private static final boolean TEST262   = Boolean.valueOf(System.getProperty("parsertest.test262"));
+
+    private static final String TEST_BASIC_DIR  = System.getProperty("test.basic.dir");
+    private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
+
+
+    interface TestFilter {
+        public boolean exclude(File file, String content);
+    }
+
+    private static void log(final String msg) {
+        org.testng.Reporter.log(msg, true);
+    }
+
+    private Context context;
+
+    @BeforeClass
+    public void setupTest() {
+        final Options options = new Options("nashorn");
+        options.set("parse.only", true);
+        options.set("scripting", true);
+        options.set("const.as.var", true);
+
+        final ErrorManager errors = new ErrorManager();
+        this.context = new Context(options, errors, Thread.currentThread().getContextClassLoader());
+    }
+
+    @AfterClass
+    public void tearDownTest() {
+        this.context = null;
+    }
+
+    @Test
+    public void parseAllTests() {
+        if (TEST262) {
+            parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
+                @Override
+                public boolean exclude(final File file, final String content) {
+                    return content != null && content.contains("@negative");
+                }
+            });
+        }
+        parseTestSet(TEST_BASIC_DIR,  new TestFilter() {
+            @Override
+            public boolean exclude(final File file, final String content) {
+                return file.getName().equals("es6");
+            }
+        });
+    }
+
+    private void parseTestSet(final String testSet, final TestFilter filter) {
+        passed  = 0;
+        failed  = 0;
+        skipped = 0;
+
+        final File testSetDir = new File(testSet);
+        if (! testSetDir.isDirectory()) {
+            log("WARNING: " + testSetDir + " not found or not a directory");
+            return;
+        }
+        log(testSetDir.getAbsolutePath());
+        parseJSDirectory(testSetDir, filter);
+
+        log(testSet + " parse done!");
+        log("parse ok: " + passed);
+        log("parse failed: " + failed);
+        log("parse skipped: " + skipped);
+        if (failed != 0) {
+            Assert.fail(failed + " tests failed to compile in " + testSetDir.getAbsolutePath());
+        }
+    }
+
+    // number of scripts that parsed fine
+    private int passed;
+    // number of scripts resulting in parse failure
+    private int failed;
+    // scripts that were skipped - all tests with @negative are
+    // skipped for now.
+    private int skipped;
+
+    private void parseJSDirectory(final File dir, final TestFilter filter) {
+        if (filter != null && filter.exclude(dir, null)) {
+            return;
+        }
+        for (final File f : dir.listFiles()) {
+            if (f.isDirectory()) {
+                parseJSDirectory(f, filter);
+            } else if (f.getName().endsWith(".js")) {
+                parseJSFile(f, filter);
+            }
+        }
+    }
+
+    private void parseJSFile(final File file, final TestFilter filter) {
+        if (VERBOSE) {
+            log("Begin parsing " + file.getAbsolutePath());
+        }
+
+        try {
+            final char[] buffer = readFully(file);
+            boolean excluded = false;
+            if (filter != null) {
+                final String content = new String(buffer);
+                excluded = filter.exclude(file, content);
+            }
+
+            if (excluded) {
+                if (VERBOSE) {
+                    log("Skipping " + file.getAbsolutePath());
+                }
+                skipped++;
+                return;
+            }
+
+            final ErrorManager errors = new ErrorManager() {
+                @Override
+                public void error(final String msg) {
+                    log(msg);
+                }
+            };
+            errors.setLimit(0);
+            final Source source = sourceFor(file.getAbsolutePath(), buffer);
+            new Parser(context.getEnv(), source, errors, context.getEnv()._strict, null).parse();
+            if (errors.getNumberOfErrors() > 0) {
+                log("Parse failed: " + file.getAbsolutePath());
+                failed++;
+            } else {
+                passed++;
+            }
+        } catch (final Throwable exp) {
+            exp.printStackTrace();
+            log("Parse failed: " + file.getAbsolutePath() + " : " + exp);
+            if (VERBOSE) {
+                exp.printStackTrace(System.out);
+            }
+            failed++;
+        }
+
+        if (VERBOSE) {
+            log("Done parsing " + file.getAbsolutePath());
+        }
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ClassFilterTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,185 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import static org.testng.Assert.fail;
-import java.io.File;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import jdk.nashorn.api.scripting.ClassFilter;
-import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
-import jdk.nashorn.api.scripting.URLReader;
-import jdk.nashorn.internal.test.framework.TestFinder;
-import org.testng.annotations.Test;
-
-@SuppressWarnings("javadoc")
-public class ClassFilterTest {
-    private static final String NASHORN_CODE_CACHE = "nashorn.persistent.code.cache";
-    private static final String CLASSFILTER_CODE_CACHE = "build/classfilter_nashorn_code_cache";
-
-    // @Test
-    // This test takes too much time for basic "ant clean test" run.
-    // Given that "allow-all-java-classes" is equivalent to no java class
-    // filter and external tests don't access any java, not sure if this
-    // test contributes much. We need faster "ant clean test" cycle for
-    // developers.
-    public void runExternalJsTest() {
-        final String[] paths = new String[]{
-                "test/script/basic/compile-octane.js",
-                "test/script/basic/jquery.js",
-                "test/script/basic/prototype.js",
-                "test/script/basic/runsunspider.js",
-                "test/script/basic/underscore.js",
-                "test/script/basic/yui.js",
-                "test/script/basic/run-octane.js"
-        };
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        for (final String path : paths) {
-            final ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter());
-            try {
-                engine.eval(new URLReader(new File(path).toURI().toURL()));
-            } catch (final Exception e) {
-                fail("Script " + path + " fails with exception :" + e.getMessage());
-            }
-        }
-    }
-
-    @Test
-    public void noJavaOptionTest() {
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter());
-        try {
-            engine.eval("var str = Java.type('java.lang.String');");
-            fail("TypeError should have been thrown");
-        } catch (final ScriptException e) {
-            //emtpy
-        }
-    }
-
-    @Test
-    public void securityTest() {
-        if (System.getSecurityManager() == null) {
-            return;
-        }
-
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine engine = factory.getScriptEngine(getClassFilter());
-        try {
-            engine.eval("var thread = Java.type('sun.misc.Unsafe')");
-            fail("SecurityException should have been thrown");
-        } catch (final Exception e) {
-            //empty
-        }
-        try {
-            engine.eval("var thread = new sun.misc.Unsafe()");
-            fail("SecurityException should have been thrown");
-        } catch (final Exception e) {
-            //empty
-        }
-        try {
-            engine.eval("var thread = Java.extend(sun.misc.Unsafe, {})");
-            fail("TypeError should have been thrown");
-        } catch (final Exception e) {
-            //empty
-        }
-        try {
-            engine.eval("java.lang.System.exit(0)");
-            fail("SecurityException should have been thrown");
-        } catch (final Exception e) {
-            //empty
-        }
-
-    }
-
-    @Test
-    public void persistentCacheTest() {
-        final String oldCodeCache = System.getProperty(NASHORN_CODE_CACHE);
-        System.setProperty(NASHORN_CODE_CACHE, CLASSFILTER_CODE_CACHE);
-        try {
-            persistentCacheTestImpl();
-        } finally {
-            if (oldCodeCache != null) {
-                System.setProperty(NASHORN_CODE_CACHE, oldCodeCache);
-            }
-        }
-    }
-
-    private void persistentCacheTestImpl() {
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine engine = factory.getScriptEngine(
-              TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}),
-                  getClass().getClassLoader(),
-                  getClassFilter()
-        );
-        final String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore();
-        try {
-            engine.eval(testScript);
-        } catch (final ScriptException exc) {
-            fail(exc.getMessage());
-        }
-        final ScriptEngine engineSafe = factory.getScriptEngine(
-                TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}),
-                getClass().getClassLoader(),
-                new ClassFilter() {
-                    @Override
-                    public boolean exposeToScripts(final String s) {
-                        return false;
-                    }
-                }
-        );
-        try {
-            engineSafe.eval(testScript);
-            fail("ClassNotFoundException should have been thrown");
-        } catch (final Exception exc) {
-            if (!(exc.getCause() instanceof ClassNotFoundException)) {
-                fail("ClassNotFoundException expected, got " + exc.getClass());
-            }
-        }
-    }
-
-    private static String generateCodeForPersistentStore() {
-        final StringBuilder stringBuilder = new StringBuilder();
-        for (int i=0; i < 100; i++) {
-            stringBuilder.append("function i")
-                    .append(i)
-                    .append("(y, z) { var x")
-                    .append(i)
-                    .append(" = ")
-                    .append(i)
-                    .append(";}");
-        }
-        return stringBuilder.toString();
-    }
-
-    private static ClassFilter getClassFilter() {
-        return new ClassFilter() {
-            @Override
-            public boolean exposeToScripts(final String s) {
-                return true;
-            }
-        };
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/CodeStoreAndPathTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.nashorn.internal.runtime;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.DirectoryStream;
-import java.nio.file.FileSystems;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @bug 8039185 8039403
- * @summary  Test for persistent code cache and path handling
- * @run testng jdk.nashorn.internal.runtime.CodeStoreAndPathTest
- */
-@SuppressWarnings("javadoc")
-public class CodeStoreAndPathTest {
-
-    final String code1 = "var code1; var x = 'Hello Script'; var x1 = 'Hello Script'; "
-                + "var x2 = 'Hello Script'; var x3 = 'Hello Script'; "
-                + "var x4 = 'Hello Script'; var x5 = 'Hello Script';"
-                + "var x6 = 'Hello Script'; var x7 = 'Hello Script'; "
-                + "var x8 = 'Hello Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';"
-                + "function f() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}"
-                + "function g() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}"
-                + "function h() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}"
-                + "function i() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}";
-    final String code2 = "var code2; var x = 'Hello Script'; var x1 = 'Hello Script'; "
-                + "var x2 = 'Hello Script'; var x3 = 'Hello Script'; "
-                + "var x4 = 'Hello Script'; var x5 = 'Hello Script';"
-                + "var x6 = 'Hello Script'; var x7 = 'Hello Script'; "
-                + "var x8 = 'Hello Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';"
-                + "function f() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}"
-                + "function g() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}"
-                + "function h() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}"
-                + "function i() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
-                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
-                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
-                + "var x10 = 'Hello Script';}";
-    // Script size < Default minimum size for storing a compiled script class
-    final String code3 = "var code3; var x = 'Hello Script'; var x1 = 'Hello Script'; ";
-    final String codeCache = "build/nashorn_code_cache";
-    final String oldUserDir = System.getProperty("user.dir");
-
-    private static final String[] ENGINE_OPTIONS_OPT   = new String[]{"--persistent-code-cache", "--optimistic-types=true"};
-    private static final String[] ENGINE_OPTIONS_NOOPT = new String[]{"--persistent-code-cache", "--optimistic-types=false"};
-
-    @Test
-    public void pathHandlingTest() {
-        System.setProperty("nashorn.persistent.code.cache", codeCache);
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-
-        fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
-
-        final Path expectedCodeCachePath = FileSystems.getDefault().getPath(oldUserDir + File.separator + codeCache);
-        final Path actualCodeCachePath = FileSystems.getDefault().getPath(System.getProperty(
-                            "nashorn.persistent.code.cache")).toAbsolutePath();
-        // Check that nashorn code cache is created in current working directory
-        assertEquals(actualCodeCachePath, expectedCodeCachePath);
-        // Check that code cache dir exists and it's not empty
-        final File file = new File(actualCodeCachePath.toUri());
-        assertFalse(!file.isDirectory(), "No code cache directory was created!");
-        assertFalse(file.list().length == 0, "Code cache directory is empty!");
-    }
-
-    @Test
-    public void changeUserDirTest() throws ScriptException, IOException {
-        System.setProperty("nashorn.persistent.code.cache", codeCache);
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
-        final Path codeCachePath = getCodeCachePath(false);
-        final String newUserDir = "build/newUserDir";
-        // Now changing current working directory
-        System.setProperty("user.dir", System.getProperty("user.dir") + File.separator + newUserDir);
-        try {
-            // Check that a new compiled script is stored in existing code cache
-            e.eval(code1);
-            final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
-            checkCompiledScripts(stream, 1);
-            // Setting to default current working dir
-        } finally {
-            System.setProperty("user.dir", oldUserDir);
-        }
-    }
-
-    @Test
-    public void codeCacheTest() throws ScriptException, IOException {
-        System.setProperty("nashorn.persistent.code.cache", codeCache);
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
-        final Path codeCachePath = getCodeCachePath(false);
-        e.eval(code1);
-        e.eval(code2);
-        e.eval(code3);// less than minimum size for storing
-        // adding code1 and code2.
-        final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
-        checkCompiledScripts(stream, 2);
-    }
-
-    @Test
-    public void codeCacheTestOpt() throws ScriptException, IOException {
-        System.setProperty("nashorn.persistent.code.cache", codeCache);
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_OPT);
-        final Path codeCachePath = getCodeCachePath(true);
-        e.eval(code1);
-        e.eval(code2);
-        e.eval(code3);// less than minimum size for storing
-        // adding code1 and code2.
-        final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
-        checkCompiledScripts(stream, 2);
-    }
-
-    private static Path getCodeCachePath(final boolean optimistic) {
-        final String codeCache = System.getProperty("nashorn.persistent.code.cache");
-        final Path codeCachePath = FileSystems.getDefault().getPath(codeCache).toAbsolutePath();
-        final String[] files = codeCachePath.toFile().list();
-        for (final String file : files) {
-            if (file.endsWith("_opt") == optimistic) {
-                return codeCachePath.resolve(file);
-            }
-        }
-        throw new AssertionError("Code cache path not found");
-    }
-
-    private static void checkCompiledScripts(final DirectoryStream<Path> stream, final int numberOfScripts) throws IOException {
-        int n = numberOfScripts;
-        for (@SuppressWarnings("unused") final Path file : stream) {
-            n--;
-        }
-        stream.close();
-        assertEquals(n, 0);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ConsStringTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import static org.testng.Assert.assertEquals;
-
-import org.testng.annotations.Test;
-
-/**
- * Tests for JSType methods.
- *
- * @test
- * @run testng jdk.nashorn.internal.runtime.ConsStringTest
- */
-public class ConsStringTest {
-
-    /**
-     * Test toString conversion
-     */
-    @Test
-    public void testConsStringToString() {
-        final ConsString cs1 = new ConsString("b", "c");
-        final ConsString cs2 = new ConsString("d", "e");
-        final ConsString cs3 = new ConsString(cs1, cs2);
-        final ConsString cs4 = new ConsString(cs3, "f");
-        final ConsString cs5 = new ConsString("a", cs4);
-        assertEquals(cs5.toString(), "abcdef");
-        assertEquals(cs4.toString(), "bcdef");
-        assertEquals(cs3.toString(), "bcde");
-        assertEquals(cs2.toString(), "de");
-        assertEquals(cs1.toString(), "bc");
-        // ConsStrings should be flattened now
-        assertEquals(cs1.getComponents()[0], "bc");
-        assertEquals(cs1.getComponents()[1], "");
-        assertEquals(cs2.getComponents()[0], "de");
-        assertEquals(cs2.getComponents()[1], "");
-        assertEquals(cs3.getComponents()[0], "bcde");
-        assertEquals(cs3.getComponents()[1], "");
-        assertEquals(cs4.getComponents()[0], "bcdef");
-        assertEquals(cs4.getComponents()[1], "");
-        assertEquals(cs5.getComponents()[0], "abcdef");
-        assertEquals(cs5.getComponents()[1], "");
-    }
-
-    /**
-     * Test charAt
-     */
-    @Test
-    public void testConsStringCharAt() {
-        final ConsString cs1 = new ConsString("b", "c");
-        final ConsString cs2 = new ConsString("d", "e");
-        final ConsString cs3 = new ConsString(cs1, cs2);
-        final ConsString cs4 = new ConsString(cs3, "f");
-        final ConsString cs5 = new ConsString("a", cs4);
-        assertEquals(cs1.charAt(1), 'c');
-        assertEquals(cs2.charAt(0), 'd');
-        assertEquals(cs3.charAt(3), 'e');
-        assertEquals(cs4.charAt(1), 'c');
-        assertEquals(cs5.charAt(2), 'c');
-        // ConsStrings should be flattened now
-        assertEquals(cs1.getComponents()[0], "bc");
-        assertEquals(cs1.getComponents()[1], "");
-        assertEquals(cs2.getComponents()[0], "de");
-        assertEquals(cs2.getComponents()[1], "");
-        assertEquals(cs3.getComponents()[0], "bcde");
-        assertEquals(cs3.getComponents()[1], "");
-        assertEquals(cs4.getComponents()[0], "bcdef");
-        assertEquals(cs4.getComponents()[1], "");
-        assertEquals(cs5.getComponents()[0], "abcdef");
-        assertEquals(cs5.getComponents()[1], "");
-    }
-
-
-    /**
-     * Test flattening of top-level and internal ConsStrings
-     */
-    @Test
-    public void testConsStringFlattening() {
-        final ConsString cs1 = new ConsString("b", "c");
-        final ConsString cs2 = new ConsString("d", "e");
-        final ConsString cs3 = new ConsString(cs1, cs2);
-        final ConsString cs4 = new ConsString(cs3, "f");
-
-        final ConsString cs5 = new ConsString("a", cs4);
-        // top-level ConsString should not yet be flattened
-        assert(cs5.getComponents()[0] == "a");
-        assert(cs5.getComponents()[1] == cs4);
-        assertEquals(cs5.toString(), "abcdef");
-        // top-level ConsString should be flattened
-        assertEquals(cs5.getComponents()[0], "abcdef");
-        assertEquals(cs5.getComponents()[1], "");
-        // internal ConsString should not yet be flattened after first traversal
-        assertEquals(cs4.getComponents()[0], cs3);
-        assertEquals(cs4.getComponents()[1], "f");
-
-        final ConsString cs6 = new ConsString("a", cs4);
-        // top-level ConsString should not yet be flattened
-        assertEquals(cs6.getComponents()[0], "a");
-        assertEquals(cs6.getComponents()[1], cs4);
-        assertEquals(cs6.toString(), "abcdef");
-        // top-level ConsString should be flattened
-        assertEquals(cs6.getComponents()[0], "abcdef");
-        assertEquals(cs6.getComponents()[1], "");
-        // internal ConsString should have been flattened after second traversal
-        assertEquals(cs4.getComponents()[0], "bcdef");
-        assertEquals(cs4.getComponents()[1], "");
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ContextTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import static jdk.nashorn.internal.runtime.Source.sourceFor;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import java.util.Map;
-import jdk.nashorn.internal.objects.Global;
-import jdk.nashorn.internal.runtime.options.Options;
-import org.testng.annotations.Test;
-
-/**
- * Basic Context API tests.
- *
- * @test
- * @run testng jdk.nashorn.internal.runtime.ContextTest
- */
-@SuppressWarnings("javadoc")
-public class ContextTest {
-    // basic context eval test
-    @Test
-    public void evalTest() {
-        final Options options = new Options("");
-        final ErrorManager errors = new ErrorManager();
-        final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
-        final Global oldGlobal = Context.getGlobal();
-        Context.setGlobal(cx.createGlobal());
-        try {
-            String code = "22 + 10";
-            assertTrue(32.0 == ((Number)(eval(cx, "<evalTest>", code))).doubleValue());
-
-            code = "obj = { js: 'nashorn' }; obj.js";
-            assertEquals(eval(cx, "<evalTest2>", code), "nashorn");
-        } finally {
-            Context.setGlobal(oldGlobal);
-        }
-    }
-
-    // Make sure trying to compile an invalid script returns null - see JDK-8046215.
-    @Test
-    public void compileErrorTest() {
-        final Options options = new Options("");
-        final ErrorManager errors = new ErrorManager();
-        final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
-        final Global oldGlobal = Context.getGlobal();
-        Context.setGlobal(cx.createGlobal());
-        try {
-            final ScriptFunction script = cx.compileScript(sourceFor("<evalCompileErrorTest>", "*/"), Context.getGlobal());
-            if (script != null) {
-                fail("Invalid script compiled without errors");
-            }
-            if (errors.getNumberOfErrors() != 1) {
-                fail("Wrong number of errors: " + errors.getNumberOfErrors());
-            }
-        } finally {
-            Context.setGlobal(oldGlobal);
-        }
-    }
-
-    // basic check for JS reflection access - java.util.Map-like access on ScriptObject
-    @Test
-    public void reflectionTest() {
-        final Options options = new Options("");
-        final ErrorManager errors = new ErrorManager();
-        final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
-        final boolean strict = cx.getEnv()._strict;
-        final Global oldGlobal = Context.getGlobal();
-        Context.setGlobal(cx.createGlobal());
-
-        try {
-            final String code = "var obj = { x: 344, y: 42 }";
-            eval(cx, "<reflectionTest>", code);
-
-            final Object obj = Context.getGlobal().get("obj");
-
-            assertTrue(obj instanceof ScriptObject);
-
-            final ScriptObject sobj = (ScriptObject)obj;
-            int count = 0;
-            for (final Map.Entry<?, ?> ex : sobj.entrySet()) {
-                final Object key = ex.getKey();
-                if (key.equals("x")) {
-                    assertTrue(ex.getValue() instanceof Number);
-                    assertTrue(344.0 == ((Number)ex.getValue()).doubleValue());
-
-                    count++;
-                } else if (key.equals("y")) {
-                    assertTrue(ex.getValue() instanceof Number);
-                    assertTrue(42.0 == ((Number)ex.getValue()).doubleValue());
-
-                    count++;
-                }
-            }
-            assertEquals(count, 2);
-            assertEquals(sobj.size(), 2);
-
-            // add property
-            sobj.put("zee", "hello", strict);
-            assertEquals(sobj.get("zee"), "hello");
-            assertEquals(sobj.size(), 3);
-
-        } finally {
-            Context.setGlobal(oldGlobal);
-        }
-    }
-
-    private static Object eval(final Context cx, final String name, final String code) {
-        final Source source = sourceFor(name, code);
-        final ScriptObject global = Context.getGlobal();
-        final ScriptFunction func = cx.compileScript(source, global);
-        return func != null ? ScriptRuntime.apply(func, global) : null;
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/ExceptionsNotSerializable.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.NotSerializableException;
-import java.io.ObjectOutputStream;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
-import org.testng.annotations.Test;
-
-/**
- * JDK-8044518: Ensure exceptions related to optimistic recompilation are not serializable
- *
- * @test
- * @run testng jdk.nashorn.internal.runtime.ExceptionsNotSerializable
- */
-@SuppressWarnings("javadoc")
-public class ExceptionsNotSerializable {
-    @Test
-    public void rewriteExceptionNotSerializable() throws ScriptException {
-        // NOTE: we must create a RewriteException in a context of a Nashorn engine, as it uses Global.newIntance()
-        // internally.
-        final ScriptEngine e = new NashornScriptEngineFactory().getScriptEngine();
-        e.put("f", new Runnable() {
-            @Override
-            public void run() {
-                tryToSerialize(RewriteException.create(null, new Object[0], new String[0]));
-            }
-        });
-        e.eval("f()");
-    }
-
-    @Test
-    public void unwarrantedOptimismExceptionNotSerializable() {
-        tryToSerialize(new UnwarrantedOptimismException(new Double(1.0), 128));
-    }
-
-    private static void tryToSerialize(final Object obj) {
-        try {
-            new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(obj);
-            fail();
-        } catch (final NotSerializableException e) {
-            assertEquals(e.getMessage(), obj.getClass().getName());
-        } catch (final IOException e) {
-            fail("", e);
-        }
-
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/JSTypeTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,193 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import org.testng.annotations.Test;
-
-/**
- * Tests for JSType methods.
- *
- * @test
- * @run testng jdk.nashorn.internal.runtime.JSTypeTest
- */
-public class JSTypeTest {
-    /**
-     * Test of isPrimitive method, of class Runtime.
-     */
-    @Test
-    public void testIsPrimitive() {
-        assertTrue(JSType.isPrimitive(null));
-        assertTrue(JSType.isPrimitive(ScriptRuntime.UNDEFINED));
-        assertTrue(JSType.isPrimitive(Double.NaN));
-        assertTrue(JSType.isPrimitive(Double.NEGATIVE_INFINITY));
-        assertTrue(JSType.isPrimitive(Double.POSITIVE_INFINITY));
-        assertTrue(JSType.isPrimitive(0.0));
-        assertTrue(JSType.isPrimitive(3.14));
-        assertTrue(JSType.isPrimitive("hello"));
-        assertTrue(JSType.isPrimitive(""));
-        assertFalse(JSType.isPrimitive(new Object()));
-    }
-
-    /**
-     * Test of toBoolean method, of class Runtime.
-     */
-    @Test
-    public void testToBoolean() {
-        assertFalse(JSType.toBoolean(ScriptRuntime.UNDEFINED));
-        assertFalse(JSType.toBoolean(null));
-        assertFalse(JSType.toBoolean(Boolean.FALSE));
-        assertTrue(JSType.toBoolean(Boolean.TRUE));
-        assertFalse(JSType.toBoolean(-0.0));
-        assertFalse(JSType.toBoolean(0.0));
-        assertFalse(JSType.toBoolean(Double.NaN));
-        assertTrue(JSType.toBoolean(3.14));
-        assertFalse(JSType.toBoolean(""));
-        assertTrue(JSType.toBoolean("javascript"));
-        assertTrue(JSType.toBoolean(new Object()));
-    }
-
-    /**
-     * Test of toNumber method, of class Runtime.
-     */
-    @Test
-    public void testToNumber_Object() {
-        assertTrue(Double.isNaN(JSType.toNumber(ScriptRuntime.UNDEFINED)));
-        assertEquals(JSType.toNumber((Object)null), 0.0, 0.0);
-        assertEquals(JSType.toNumber(Boolean.TRUE), 1.0, 0.0);
-        assertEquals(JSType.toNumber(Boolean.FALSE), 0.0, 0.0);
-        assertEquals(JSType.toNumber(3.14), 3.14, 0.0);
-        // FIXME: add more assertions for specific String to number cases
-        // FIXME: add case for Object type (JSObject with getDefaultValue)
-    }
-
-    /**
-     * Test of toString method, of class Runtime.
-     */
-    @Test
-    public void testToString_Object() {
-        assertEquals(JSType.toString(ScriptRuntime.UNDEFINED), "undefined");
-        assertEquals(JSType.toString(null), "null");
-        assertEquals(JSType.toString(Boolean.TRUE), "true");
-        assertEquals(JSType.toString(Boolean.FALSE), "false");
-        assertEquals(JSType.toString(""), "");
-        assertEquals(JSType.toString("nashorn"), "nashorn");
-        assertEquals(JSType.toString(Double.NaN), "NaN");
-        assertEquals(JSType.toString(Double.POSITIVE_INFINITY), "Infinity");
-        assertEquals(JSType.toString(Double.NEGATIVE_INFINITY), "-Infinity");
-        assertEquals(JSType.toString(0.0), "0");
-        // FIXME: add more number-to-string test cases
-        // FIXME: add case for Object type (JSObject with getDefaultValue)
-    }
-
-    /**
-     * Test of JSType.toUint32(double)
-     */
-    @Test
-    public void testToUint32() {
-        assertEquals(JSType.toUint32(+0.0), 0);
-        assertEquals(JSType.toUint32(-0.0), 0);
-        assertEquals(JSType.toUint32(Double.NaN), 0);
-        assertEquals(JSType.toUint32(Double.POSITIVE_INFINITY), 0);
-        assertEquals(JSType.toUint32(Double.NEGATIVE_INFINITY), 0);
-        assertEquals(JSType.toUint32(9223372036854775807.0d), 0);
-        assertEquals(JSType.toUint32(-9223372036854775807.0d), 0);
-        assertEquals(JSType.toUint32(1099511627776.0d), 0);
-        assertEquals(JSType.toUint32(-1099511627776.0d), 0);
-        assertEquals(JSType.toUint32(4294967295.0d), 4294967295l);
-        assertEquals(JSType.toUint32(4294967296.0d), 0);
-        assertEquals(JSType.toUint32(4294967297.0d), 1);
-        assertEquals(JSType.toUint32(-4294967295.0d), 1);
-        assertEquals(JSType.toUint32(-4294967296.0d), 0);
-        assertEquals(JSType.toUint32(-4294967297.0d), 4294967295l);
-        assertEquals(JSType.toUint32(4294967295.6d), 4294967295l);
-        assertEquals(JSType.toUint32(4294967296.6d), 0);
-        assertEquals(JSType.toUint32(4294967297.6d), 1);
-        assertEquals(JSType.toUint32(-4294967295.6d), 1);
-        assertEquals(JSType.toUint32(-4294967296.6d), 0);
-        assertEquals(JSType.toUint32(-4294967297.6d), 4294967295l);
-    }
-
-    /**
-     * Test of JSType.toInt32(double)
-     */
-    @Test
-    public void testToInt32() {
-        assertEquals(JSType.toInt32(+0.0), 0);
-        assertEquals(JSType.toInt32(-0.0), 0);
-        assertEquals(JSType.toInt32(Double.NaN), 0);
-        assertEquals(JSType.toInt32(Double.POSITIVE_INFINITY), 0);
-        assertEquals(JSType.toInt32(Double.NEGATIVE_INFINITY), 0);
-        assertEquals(JSType.toInt32(9223372036854775807.0d), 0);
-        assertEquals(JSType.toInt32(-9223372036854775807.0d), 0);
-        assertEquals(JSType.toInt32(1099511627776.0d), 0);
-        assertEquals(JSType.toInt32(-1099511627776.0d), 0);
-        assertEquals(JSType.toInt32(4294967295.0d), -1);
-        assertEquals(JSType.toInt32(4294967296.0d), 0);
-        assertEquals(JSType.toInt32(4294967297.0d), 1);
-        assertEquals(JSType.toInt32(-4294967295.0d), 1);
-        assertEquals(JSType.toInt32(-4294967296.0d), 0);
-        assertEquals(JSType.toInt32(-4294967297.d), -1);
-        assertEquals(JSType.toInt32(4294967295.6d), -1);
-        assertEquals(JSType.toInt32(4294967296.6d), 0);
-        assertEquals(JSType.toInt32(4294967297.6d), 1);
-        assertEquals(JSType.toInt32(-4294967295.6d), 1);
-        assertEquals(JSType.toInt32(-4294967296.6d), 0);
-        assertEquals(JSType.toInt32(-4294967297.6d), -1);
-    }
-
-    /**
-     * Test of JSType.toUint16(double)
-     */
-    @Test
-    public void testToUint16() {
-        assertEquals(JSType.toUint16(+0.0), 0);
-        assertEquals(JSType.toUint16(-0.0), 0);
-        assertEquals(JSType.toUint16(Double.NaN), 0);
-        assertEquals(JSType.toUint16(Double.POSITIVE_INFINITY), 0);
-        assertEquals(JSType.toUint16(Double.NEGATIVE_INFINITY), 0);
-        assertEquals(JSType.toUint16(9223372036854775807.0d), 0);
-        assertEquals(JSType.toUint16(-9223372036854775807.0d), 0);
-        assertEquals(JSType.toUint16(1099511627776.0d), 0);
-        assertEquals(JSType.toUint16(-1099511627776.0d), 0);
-        assertEquals(JSType.toUint16(4294967295.0d), 65535);
-        assertEquals(JSType.toUint16(4294967296.0d), 0);
-        assertEquals(JSType.toUint16(4294967297.0d), 1);
-        assertEquals(JSType.toUint16(-4294967295.0d), 1);
-        assertEquals(JSType.toUint16(-4294967296.0d), 0);
-        assertEquals(JSType.toUint16(-4294967297.0d), 65535);
-        assertEquals(JSType.toUint16(4294967295.6d), 65535);
-        assertEquals(JSType.toUint16(4294967296.6d), 0);
-        assertEquals(JSType.toUint16(4294967297.6d), 1);
-        assertEquals(JSType.toUint16(-4294967295.6d), 1);
-        assertEquals(JSType.toUint16(-4294967296.6d), 0);
-        assertEquals(JSType.toUint16(-4294967297.6d), 65535);
-    }
-
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,212 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
-import org.testng.annotations.Test;
-
-import javax.script.Bindings;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptException;
-import javax.script.SimpleScriptContext;
-
-import static org.testng.Assert.assertEquals;
-
-/**
- * Top-level lexical binding tests.
- *
- * @test
- * @run testng jdk.nashorn.internal.runtime.LexicalBindingTest
- */
-@SuppressWarnings("javadoc")
-public class LexicalBindingTest {
-
-    final static String LANGUAGE_ES6 = "--language=es6";
-    final static int NUMBER_OF_CONTEXTS = 20;
-    final static int MEGAMORPHIC_LOOP_COUNT = 20;
-
-    /**
-     * Test access to global var-declared variables for shared script classes with multiple globals.
-     */
-    @Test
-    public static void megamorphicVarTest() throws ScriptException, InterruptedException {
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine e = factory.getScriptEngine();
-        final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
-        final String sharedScript = "foo";
-
-
-        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
-            final ScriptContext context = contexts[i] = new SimpleScriptContext();
-            final Bindings b = e.createBindings();
-            context.setBindings(b, ScriptContext.ENGINE_SCOPE);
-            assertEquals(e.eval("var foo = '" + i + "';", context), null);
-        }
-
-        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
-            final ScriptContext context = contexts[i];
-            assertEquals(e.eval(sharedScript, context), String.valueOf(i));
-        }
-    }
-
-    /**
-     * Test access to global lexically declared variables for shared script classes with multiple globals.
-     */
-    @Test
-    public static void megamorphicMultiGlobalLetTest() throws ScriptException, InterruptedException {
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
-        final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
-        final String sharedScript = "foo";
-
-
-        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
-            final ScriptContext context = contexts[i] = new SimpleScriptContext();
-            final Bindings b = e.createBindings();
-            context.setBindings(b, ScriptContext.ENGINE_SCOPE);
-            assertEquals(e.eval("let foo = '" + i + "';", context), null);
-        }
-
-        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
-            final ScriptContext context = contexts[i];
-            assertEquals(e.eval(sharedScript, context), String.valueOf(i));
-        }
-    }
-
-
-    /**
-     * Test access to global lexically declared variables for shared script classes with single global.
-     */
-    @Test
-    public static void megamorphicSingleGlobalLetTest() throws ScriptException, InterruptedException {
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
-        final String sharedGetterScript = "foo";
-        final String sharedSetterScript = "foo = 1";
-
-        for (int i = 0; i < MEGAMORPHIC_LOOP_COUNT; i++) {
-            assertEquals(e.eval(sharedSetterScript), 1);
-            assertEquals(e.eval(sharedGetterScript), 1);
-            assertEquals(e.eval("delete foo; a" + i + " = 1; foo = " + i + ";"), i);
-            assertEquals(e.eval(sharedGetterScript), i);
-        }
-
-        assertEquals(e.eval("let foo = 'foo';"), null);
-        assertEquals(e.eval(sharedGetterScript), "foo");
-        assertEquals(e.eval(sharedSetterScript), 1);
-        assertEquals(e.eval(sharedGetterScript), 1);
-        assertEquals(e.eval("this.foo"), MEGAMORPHIC_LOOP_COUNT - 1);
-    }
-
-    /**
-     * Test access to global lexically declared variables for shared script classes with single global.
-     */
-    @Test
-    public static void megamorphicInheritedGlobalLetTest() throws ScriptException, InterruptedException {
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
-        final String sharedGetterScript = "foo";
-        final String sharedSetterScript = "foo = 1";
-
-        for (int i = 0; i < MEGAMORPHIC_LOOP_COUNT; i++) {
-            assertEquals(e.eval(sharedSetterScript), 1);
-            assertEquals(e.eval(sharedGetterScript), 1);
-            assertEquals(e.eval("delete foo; a" + i + " = 1; Object.prototype.foo = " + i + ";"), i);
-            assertEquals(e.eval(sharedGetterScript), i);
-        }
-
-        assertEquals(e.eval("let foo = 'foo';"), null);
-        assertEquals(e.eval(sharedGetterScript), "foo");
-        assertEquals(e.eval(sharedSetterScript), 1);
-        assertEquals(e.eval(sharedGetterScript), 1);
-        assertEquals(e.eval("this.foo"), MEGAMORPHIC_LOOP_COUNT - 1);
-    }
-
-    /**
-     * Test multi-threaded access to global lexically declared variables for shared script classes with multiple globals.
-     */
-    @Test
-    public static void multiThreadedLetTest() throws ScriptException, InterruptedException {
-        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
-        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
-        final Bindings b = e.createBindings();
-        final ScriptContext origContext = e.getContext();
-        final ScriptContext newCtxt = new SimpleScriptContext();
-        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
-        final String sharedScript = "foo";
-
-        assertEquals(e.eval("let foo = 'original context';", origContext), null);
-        assertEquals(e.eval("let foo = 'new context';", newCtxt), null);
-
-        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
-        t1.start();
-        t2.start();
-        t1.join();
-        t2.join();
-
-        assertEquals(e.eval("foo = 'newer context';", newCtxt), "newer context");
-        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
-        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
-
-        t3.start();
-        t4.start();
-        t3.join();
-        t4.join();
-
-        assertEquals(e.eval(sharedScript), "original context");
-        assertEquals(e.eval(sharedScript, newCtxt), "newer context");
-    }
-
-    private static class ScriptRunner implements Runnable {
-
-        final ScriptEngine engine;
-        final ScriptContext context;
-        final String source;
-        final Object expected;
-        final int iterations;
-
-        ScriptRunner(final ScriptEngine engine, final ScriptContext context, final String source, final Object expected, final int iterations) {
-            this.engine = engine;
-            this.context = context;
-            this.source = source;
-            this.expected = expected;
-            this.iterations = iterations;
-        }
-
-        @Override
-        public void run() {
-            try {
-                for (int i = 0; i < iterations; i++) {
-                    assertEquals(engine.eval(source, context), expected);
-                }
-            } catch (final ScriptException se) {
-                throw new RuntimeException(se);
-            }
-        }
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/NoPersistenceCachingTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-package jdk.nashorn.internal.runtime;
-
-import static org.testng.Assert.fail;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptEngineManager;
-import javax.script.SimpleScriptContext;
-import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
-import org.testng.annotations.AfterTest;
-import org.testng.annotations.BeforeTest;
-import org.testng.annotations.Test;
-
-/**
- * @test
- * @bug 8037378
- * @summary Sanity tests for no persistence caching
- * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest
- */
-@SuppressWarnings("javadoc")
-public class NoPersistenceCachingTest {
-
-   private ScriptEngine engine;
-   private ScriptContext context1, context2, context3;
-   private ByteArrayOutputStream stderr;
-   private PrintStream prevStderr;
-
-   @BeforeTest
-   public void setupTest() {
-      stderr = new ByteArrayOutputStream();
-      prevStderr = System.err;
-      System.setErr(new PrintStream(stderr));
-      NashornScriptEngineFactory nashornFactory = null;
-      final ScriptEngineManager sm = new ScriptEngineManager();
-      for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
-         if (fac instanceof NashornScriptEngineFactory) {
-            nashornFactory = (NashornScriptEngineFactory) fac;
-            break;
-         }
-      }
-      if (nashornFactory == null) {
-         fail("Cannot find nashorn factory!");
-      }
-      // fine is enough for cache hits, finest produces way too much information
-      // TODO this should be ported to use the RuntimeEvents instead of screen scraping
-      // logs, as obviously this is very brittle
-      final String[] options = new String[]{"--log=compiler:fine"};
-      engine = nashornFactory.getScriptEngine(options);
-      context1 = engine.getContext();
-      context2 = new SimpleScriptContext();
-      context2.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
-      context3 = new SimpleScriptContext();
-      context3.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
-   }
-
-   @AfterTest
-   public void setErrTest() {
-      System.setErr(prevStderr);
-   }
-
-   public void runTest(final int numberOfContext, final String expectedOutputPattern,
-                       final int expectedPatternOccurrence) {
-
-      try {
-         switch (numberOfContext) {
-         case 2:
-            final String scriptTwoContexts = "print('HelloTwoContexts')";
-            engine.eval(scriptTwoContexts, context1);
-            engine.eval(scriptTwoContexts, context2);
-            break;
-         case 3:
-            final String scriptThreeContexts = "print('HelloThreeContexts')";
-            engine.eval(scriptThreeContexts, context1);
-            engine.eval(scriptThreeContexts, context2);
-            engine.eval(scriptThreeContexts, context3);
-            break;
-        default:
-            break;
-         }
-      } catch (final Exception se) {
-         se.printStackTrace();
-         fail(se.getMessage());
-      }
-      final Pattern deoptimizing = Pattern.compile(expectedOutputPattern);
-      final Matcher matcher = deoptimizing.matcher(stderr.toString());
-      int matches = 0;
-      while (matcher.find()) {
-         matches++;
-      }
-      if (matches != expectedPatternOccurrence) {
-         fail("Number of cache hit is not correct, expected: "
-                    + expectedPatternOccurrence + " and found: " + matches + "\n"
-              + stderr);
-      }
-      stderr.reset();
-   }
-
-   private static String getCodeCachePattern() {
-      return ("\\[compiler\\]\\sCode\\scache\\shit\\sfor\\s<eval>\\savoiding\\srecompile.");
-   }
-
-    @Test
-    public void twoContextTest() {
-       runTest(2, getCodeCachePattern(), 1);
-
-    }
-
-    @Test
-    public void threeContextTest() {
-       runTest(3, getCodeCachePattern(), 2);
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/SourceTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,124 +0,0 @@
-/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import static jdk.nashorn.internal.runtime.Source.sourceFor;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.Reader;
-import java.net.URL;
-import java.util.Arrays;
-import jdk.nashorn.api.scripting.URLReader;
-import org.testng.annotations.Test;
-
-/**
- * Tests different Source representations.
- */
-@SuppressWarnings("javadoc")
-public class SourceTest {
-
-    final private static String SOURCE_NAME = "source.js";
-    final private static String SOURCE_STRING = "var x = 1;";
-    final private static char[] SOURCE_CHARS = SOURCE_STRING.toCharArray();
-    final private static String RESOURCE_PATH = "resources/load_test.js";
-    final private static File SOURCE_FILE = new File("build/test/classes/jdk/nashorn/internal/runtime/" + RESOURCE_PATH);
-    final private static URL  SOURCE_URL = SourceTest.class.getResource(RESOURCE_PATH);
-
-
-    @Test
-    public void testStringSource() {
-        testSources(sourceFor(SOURCE_NAME, SOURCE_STRING), sourceFor(SOURCE_NAME, SOURCE_STRING));
-        testSources(sourceFor(SOURCE_NAME, SOURCE_STRING), sourceFor(SOURCE_NAME, SOURCE_CHARS));
-    }
-
-    @Test
-    public void testCharArraySource() {
-        testSources(sourceFor(SOURCE_NAME, SOURCE_CHARS), sourceFor(SOURCE_NAME, SOURCE_CHARS));
-        testSources(sourceFor(SOURCE_NAME, SOURCE_CHARS), sourceFor(SOURCE_NAME, SOURCE_STRING));
-    }
-
-    @Test
-    public void testURLSource() {
-        try {
-            testSources(sourceFor(SOURCE_NAME, SOURCE_URL), sourceFor(SOURCE_NAME, SOURCE_URL));
-            testSources(sourceFor(SOURCE_NAME, SOURCE_URL), sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)));
-
-        } catch (final IOException e) {
-            fail(e.toString());
-        }
-    }
-
-    @Test
-    public void testURLReaderSource() {
-        try {
-            System.err.println(SourceTest.class.getResource(""));
-            testSources(sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)), sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)));
-            testSources(sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)), sourceFor(SOURCE_NAME, SOURCE_URL));
-        } catch (final IOException e) {
-            fail(e.toString());
-        }
-    }
-
-    @Test
-    public void testReaderSource() {
-        try {
-            testSources(sourceFor(SOURCE_NAME, getReader(RESOURCE_PATH)), sourceFor(SOURCE_NAME, getReader(RESOURCE_PATH)));
-        } catch (final IOException e) {
-            fail(e.toString());
-        }
-    }
-
-    @Test
-    public void testFileSource() {
-        try {
-            testSources(sourceFor(SOURCE_NAME, SOURCE_FILE), sourceFor(SOURCE_NAME, SOURCE_FILE));
-        } catch (final IOException e) {
-            fail(e.toString());
-        }
-    }
-
-    private static Reader getReader(final String path) {
-        return new InputStreamReader(SourceTest.class.getResourceAsStream(path));
-    }
-
-    private static void testSources(final Source source1, final Source source2) {
-        final char[] chars1 = source1.getContent();
-        final char[] chars2 = source2.getContent();
-        final String str1 = source1.getString();
-        final String str2 = source2.getString();
-        assertTrue(Arrays.equals(chars1, chars2));
-        assertEquals(str1, str2);
-        assertEquals(source1.hashCode(), source2.hashCode());
-        assertTrue(source1.equals(source2));
-        assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray()));
-        assertTrue(Arrays.equals(source1.getContent(), chars1));
-        assertTrue(Arrays.equals(source1.getContent(), source2.getContent()));
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/TrustedScriptEngineTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,362 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-import javax.script.ScriptContext;
-import javax.script.ScriptEngine;
-import javax.script.ScriptEngineFactory;
-import javax.script.ScriptEngineManager;
-import javax.script.ScriptException;
-import javax.script.SimpleScriptContext;
-import jdk.nashorn.api.scripting.ClassFilter;
-import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
-import org.testng.annotations.Test;
-
-/**
- * Tests for trusted client usage of nashorn script engine factory extension API
- */
-@SuppressWarnings("javadoc")
-public class TrustedScriptEngineTest {
-    @Test
-    public void versionTest() {
-        final ScriptEngineManager m = new ScriptEngineManager();
-        final ScriptEngine e = m.getEngineByName("nashorn");
-        assertEquals(e.getFactory().getEngineVersion(), Version.version());
-    }
-
-    private static class MyClassLoader extends ClassLoader {
-        // to check if script engine uses the specified class loader
-        private final boolean[] reached = new boolean[1];
-
-        @Override
-        protected Class<?> findClass(final String name) throws ClassNotFoundException {
-            // flag that it reached here
-            reached[0] = true;
-            return super.findClass(name);
-        }
-
-        public boolean reached() {
-            return reached[0];
-        }
-    }
-
-    // These are for "private" extension API of NashornScriptEngineFactory that
-    // accepts a ClassLoader and/or command line options.
-
-    @Test
-    public void factoryClassLoaderTest() {
-        final ScriptEngineManager sm = new ScriptEngineManager();
-        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
-            if (fac instanceof NashornScriptEngineFactory) {
-                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
-                final MyClassLoader loader = new MyClassLoader();
-                // set the classloader as app class loader
-                final ScriptEngine e = nfac.getScriptEngine(loader);
-                try {
-                    e.eval("Packages.foo");
-                    // check that the class loader was attempted
-                    assertTrue(loader.reached(), "did not reach class loader!");
-                } catch (final ScriptException se) {
-                    se.printStackTrace();
-                    fail(se.getMessage());
-                }
-                return;
-            }
-        }
-
-        fail("Cannot find nashorn factory!");
-    }
-
-    @Test
-    public void factoryClassLoaderAndOptionsTest() {
-        final ScriptEngineManager sm = new ScriptEngineManager();
-        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
-            if (fac instanceof NashornScriptEngineFactory) {
-                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
-                final String[] options = new String[] { "-strict" };
-                final MyClassLoader loader = new MyClassLoader();
-                // set the classloader as app class loader
-                final ScriptEngine e = nfac.getScriptEngine(options, loader);
-                try {
-                    e.eval("Packages.foo");
-                    // check that the class loader was attempted
-                    assertTrue(loader.reached(), "did not reach class loader!");
-                } catch (final ScriptException se) {
-                    se.printStackTrace();
-                    fail(se.getMessage());
-                }
-
-                try {
-                    // strict mode - delete of a var should throw SyntaxError
-                    e.eval("var d = 2; delete d;");
-                } catch (final ScriptException se) {
-                    // check that the error message contains "SyntaxError"
-                    assertTrue(se.getMessage().contains("SyntaxError"));
-                }
-
-                return;
-            }
-        }
-
-        fail("Cannot find nashorn factory!");
-    }
-
-    @Test
-    public void factoryOptionsTest() {
-        final ScriptEngineManager sm = new ScriptEngineManager();
-        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
-            if (fac instanceof NashornScriptEngineFactory) {
-                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
-                // specify --no-syntax-extensions flag
-                final String[] options = new String[] { "--no-syntax-extensions" };
-                final ScriptEngine e = nfac.getScriptEngine(options);
-                try {
-                    // try nashorn specific extension
-                    e.eval("var f = funtion(x) 2*x;");
-                    fail("should have thrown exception!");
-                } catch (final Exception ex) {
-                    //empty
-                }
-                return;
-            }
-        }
-
-        fail("Cannot find nashorn factory!");
-    }
-
-    @Test
-    /**
-     * Test repeated evals with --loader-per-compile=false
-     * We used to get "class redefinition error".
-     */
-    public void noLoaderPerCompilerTest() {
-        final ScriptEngineManager sm = new ScriptEngineManager();
-        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
-            if (fac instanceof NashornScriptEngineFactory) {
-                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
-                final String[] options = new String[] { "--loader-per-compile=false" };
-                final ScriptEngine e = nfac.getScriptEngine(options);
-                try {
-                    e.eval("2 + 3");
-                    e.eval("4 + 4");
-                } catch (final ScriptException se) {
-                    se.printStackTrace();
-                    fail(se.getMessage());
-                }
-                return;
-            }
-        }
-        fail("Cannot find nashorn factory!");
-    }
-
-    @Test
-    /**
-     * Test that we can use same script name in repeated evals with --loader-per-compile=false
-     * We used to get "class redefinition error" as name was derived from script name.
-     */
-    public void noLoaderPerCompilerWithSameNameTest() {
-        final ScriptEngineManager sm = new ScriptEngineManager();
-        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
-            if (fac instanceof NashornScriptEngineFactory) {
-                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
-                final String[] options = new String[] { "--loader-per-compile=false" };
-                final ScriptEngine e = nfac.getScriptEngine(options);
-                e.put(ScriptEngine.FILENAME, "test.js");
-                try {
-                    e.eval("2 + 3");
-                    e.eval("4 + 4");
-                } catch (final ScriptException se) {
-                    se.printStackTrace();
-                    fail(se.getMessage());
-                }
-                return;
-            }
-        }
-        fail("Cannot find nashorn factory!");
-    }
-
-    @Test
-    public void globalPerEngineTest() throws ScriptException {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final String[] options = new String[] { "--global-per-engine" };
-        final ScriptEngine e = fac.getScriptEngine(options);
-
-        e.eval("function foo() {}");
-
-        final ScriptContext newCtx = new SimpleScriptContext();
-        newCtx.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
-
-        // all global definitions shared and so 'foo' should be
-        // visible in new Bindings as well.
-        assertTrue(e.eval("typeof foo", newCtx).equals("function"));
-
-        e.eval("function bar() {}", newCtx);
-
-        // bar should be visible in default context
-        assertTrue(e.eval("typeof bar").equals("function"));
-    }
-
-    @Test
-    public void classFilterTest() throws ScriptException {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(new ClassFilter() {
-            @Override
-            public boolean exposeToScripts(final String fullName) {
-                // don't allow anything that is not "java."
-                return fullName.startsWith("java.");
-            }
-        });
-
-        assertEquals(e.eval("typeof javax.script.ScriptEngine"), "object");
-        assertEquals(e.eval("typeof java.util.Vector"), "function");
-
-        try {
-            e.eval("Java.type('javax.script.ScriptContext')");
-            fail("should not reach here");
-        } catch (final ScriptException | RuntimeException se) {
-            if (! (se.getCause() instanceof ClassNotFoundException)) {
-                fail("ClassNotFoundException expected");
-            }
-        }
-    }
-
-    @Test
-    public void classFilterTest2() throws ScriptException {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine e = fac.getScriptEngine(new String[0], Thread.currentThread().getContextClassLoader(),
-            new ClassFilter() {
-                @Override
-                public boolean exposeToScripts(final String fullName) {
-                    // don't allow anything that is not "java."
-                    return fullName.startsWith("java.");
-                }
-            });
-
-        assertEquals(e.eval("typeof javax.script.ScriptEngine"), "object");
-        assertEquals(e.eval("typeof java.util.Vector"), "function");
-
-        try {
-            e.eval("Java.type('javax.script.ScriptContext')");
-            fail("should not reach here");
-        } catch (final ScriptException | RuntimeException se) {
-            if (! (se.getCause() instanceof ClassNotFoundException)) {
-                fail("ClassNotFoundException expected");
-            }
-        }
-    }
-
-    @Test
-    public void nullClassFilterTest() {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        try {
-            fac.getScriptEngine((ClassFilter)null);
-            fail("should have thrown NPE");
-        } catch (final NullPointerException e) {
-            //empty
-        }
-    }
-
-    @Test
-    public void nullClassFilterTest2() {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        try {
-            fac.getScriptEngine(new String[0], null, null);
-            fail("should have thrown NPE");
-        } catch (final NullPointerException e) {
-            //empty
-        }
-    }
-
-    @Test
-    public void nullArgsTest() {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        try {
-            fac.getScriptEngine((String[])null);
-            fail("should have thrown NPE");
-        } catch (final NullPointerException e) {
-            //empty
-        }
-    }
-
-    @Test
-    public void nullArgsTest2() {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        try {
-            fac.getScriptEngine(null, null, new ClassFilter() {
-                @Override
-                public boolean exposeToScripts(final String name) {
-                    return true;
-                }
-            });
-            fail("should have thrown NPE");
-        } catch (final NullPointerException e) {
-            //empty
-        }
-    }
-
-    @Test
-    public void nashornSwallowsConstKeyword() throws Exception {
-        final NashornScriptEngineFactory f = new NashornScriptEngineFactory();
-        final String[] args = new String[] { "--const-as-var" };
-        final ScriptEngine engine = f.getScriptEngine(args);
-
-        final Object ret = engine.eval(""
-            + "(function() {\n"
-            + "  const x = 10;\n"
-            + "  return x;\n"
-            + "})();"
-        );
-        assertEquals(ret, 10, "Parsed and executed OK");
-    }
-
-    @Test
-    public void evalDefaultFileNameTest() throws ScriptException {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine engine = fac.getScriptEngine(new String[] { "--verify-code=true" });
-        // default FILENAME being "<eval>" make sure generated code bytecode verifies.
-        engine.eval("var a = 3;");
-    }
-
-    @Test
-    public void evalFileNameWithSpecialCharsTest() throws ScriptException {
-        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
-        final ScriptEngine engine = fac.getScriptEngine(new String[] { "--verify-code=true" });
-        final ScriptContext ctxt = new SimpleScriptContext();
-        // use file name with "dangerous" chars.
-        ctxt.setAttribute(ScriptEngine.FILENAME, "<myscript>", ScriptContext.ENGINE_SCOPE);
-        engine.eval("var a = 3;");
-        ctxt.setAttribute(ScriptEngine.FILENAME, "[myscript]", ScriptContext.ENGINE_SCOPE);
-        engine.eval("var h = 'hello';");
-        ctxt.setAttribute(ScriptEngine.FILENAME, ";/\\$.", ScriptContext.ENGINE_SCOPE);
-        engine.eval("var foo = 'world';");
-        // name used by jjs shell tool for the interactive mode
-        ctxt.setAttribute(ScriptEngine.FILENAME, "<shell>", ScriptContext.ENGINE_SCOPE);
-        engine.eval("var foo = 'world';");
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/JdkRegExpTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime.regexp;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-
-import org.testng.annotations.Test;
-
-/**
- * Basic tests for the JDK based RegExp implementation.
- *
- * @test
- * @run testng jdk.nashorn.internal.runtime.regexp.JdkRegExpTest
- */
-public class JdkRegExpTest {
-
-    /**
-     * Compile a regular expression using the JDK implementation
-     */
-    @Test
-    public void testMatcher() {
-        final RegExp regexp = new RegExpFactory().compile("f(o)o", "");
-        final RegExpMatcher matcher = regexp.match("foo");
-        assertNotNull(matcher);
-        assertTrue(matcher.search(0));
-        assertEquals(matcher.getInput(), "foo");
-        assertEquals(matcher.groupCount(), 1);
-        assertEquals(matcher.group(), "foo");
-        assertEquals(matcher.start(), 0);
-        assertEquals(matcher.end(), 3);
-        assertEquals(matcher.group(1), "o");
-        assertEquals(matcher.start(1), 1);
-        assertEquals(matcher.end(1), 2);
-    }
-}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/JoniTest.java	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime.regexp.joni;
-
-import org.testng.annotations.Test;
-
-/**
- * Joni coverage tests
- *
- * @test
- * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest
- */
-@SuppressWarnings("javadoc")
-public class JoniTest {
-
-    @Test
-    public void testDump() {
-        new Regex("^a{3,}(.*)[z]++\\s\\1x$").dumpTree();
-        new Regex("^a{3,}(.*)[z]++\\s\\1x$").dumpByteCode();
-        new Regex("(abc){4,}{2,5}").dumpTree();
-        new Regex("(abc){4,}{2,5}").dumpByteCode();
-        new Regex("aaa|aa|bbbb|ccc").dumpTree();
-        new Regex("aaa|aa|bbbb|ccc").dumpByteCode();
-        new Regex("(?:ZFVR.(\\d+\\.\\d+))|(?:(?:Sversbk|TenaCnenqvfb|Vprjrnfry).(\\d+\\.\\d+))|(?:Bcren.(\\d+\\.\\d+))|(?:NccyrJroXvg.(\\d+(?:\\.\\d+)?))").dumpTree();
-        new Regex("(?:ZFVR.(\\d+\\.\\d+))|(?:(?:Sversbk|TenaCnenqvfb|Vprjrnfry).(\\d+\\.\\d+))|(?:Bcren.(\\d+\\.\\d+))|(?:NccyrJroXvg.(\\d+(?:\\.\\d+)?))").dumpByteCode();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/joni/test/JoniTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.regexp.joni.test;
+
+import jdk.nashorn.internal.runtime.regexp.joni.Regex;
+import org.testng.annotations.Test;
+
+/**
+ * Joni coverage tests
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.regexp.joni.JoniTest
+ */
+@SuppressWarnings("javadoc")
+public class JoniTest {
+
+    @Test
+    public void testDump() {
+        new Regex("^a{3,}(.*)[z]++\\s\\1x$").dumpTree();
+        new Regex("^a{3,}(.*)[z]++\\s\\1x$").dumpByteCode();
+        new Regex("(abc){4,}{2,5}").dumpTree();
+        new Regex("(abc){4,}{2,5}").dumpByteCode();
+        new Regex("aaa|aa|bbbb|ccc").dumpTree();
+        new Regex("aaa|aa|bbbb|ccc").dumpByteCode();
+        new Regex("(?:ZFVR.(\\d+\\.\\d+))|(?:(?:Sversbk|TenaCnenqvfb|Vprjrnfry).(\\d+\\.\\d+))|(?:Bcren.(\\d+\\.\\d+))|(?:NccyrJroXvg.(\\d+(?:\\.\\d+)?))").dumpTree();
+        new Regex("(?:ZFVR.(\\d+\\.\\d+))|(?:(?:Sversbk|TenaCnenqvfb|Vprjrnfry).(\\d+\\.\\d+))|(?:Bcren.(\\d+\\.\\d+))|(?:NccyrJroXvg.(\\d+(?:\\.\\d+)?))").dumpByteCode();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/regexp/test/JdkRegExpTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.regexp.test;
+
+import jdk.nashorn.internal.runtime.regexp.RegExp;
+import jdk.nashorn.internal.runtime.regexp.RegExpFactory;
+import jdk.nashorn.internal.runtime.regexp.RegExpMatcher;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+
+/**
+ * Basic tests for the JDK based RegExp implementation.
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.regexp.JdkRegExpTest
+ */
+public class JdkRegExpTest {
+
+    /**
+     * Compile a regular expression using the JDK implementation
+     */
+    @Test
+    public void testMatcher() {
+        final RegExp regexp = new RegExpFactory().compile("f(o)o", "");
+        final RegExpMatcher matcher = regexp.match("foo");
+        assertNotNull(matcher);
+        assertTrue(matcher.search(0));
+        assertEquals(matcher.getInput(), "foo");
+        assertEquals(matcher.groupCount(), 1);
+        assertEquals(matcher.group(), "foo");
+        assertEquals(matcher.start(), 0);
+        assertEquals(matcher.end(), 3);
+        assertEquals(matcher.group(1), "o");
+        assertEquals(matcher.start(1), 1);
+        assertEquals(matcher.end(1), 2);
+    }
+}
--- a/nashorn/test/src/jdk/nashorn/internal/runtime/resources/load_test.js	Wed Apr 08 13:12:48 2015 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-function loadedFunc(arg) {
-    return arg.toUpperCase();
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ClassFilterTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import static org.testng.Assert.fail;
+import java.io.File;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.ClassFilter;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import jdk.nashorn.api.scripting.URLReader;
+import jdk.nashorn.internal.test.framework.TestFinder;
+import org.testng.annotations.Test;
+
+@SuppressWarnings("javadoc")
+public class ClassFilterTest {
+    private static final String NASHORN_CODE_CACHE = "nashorn.persistent.code.cache";
+    private static final String CLASSFILTER_CODE_CACHE = "build/classfilter_nashorn_code_cache";
+
+    // @Test
+    // This test takes too much time for basic "ant clean test" run.
+    // Given that "allow-all-java-classes" is equivalent to no java class
+    // filter and external tests don't access any java, not sure if this
+    // test contributes much. We need faster "ant clean test" cycle for
+    // developers.
+    public void runExternalJsTest() {
+        final String[] paths = new String[]{
+                "test/script/basic/compile-octane.js",
+                "test/script/basic/jquery.js",
+                "test/script/basic/prototype.js",
+                "test/script/basic/runsunspider.js",
+                "test/script/basic/underscore.js",
+                "test/script/basic/yui.js",
+                "test/script/basic/run-octane.js"
+        };
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        for (final String path : paths) {
+            final ScriptEngine engine = factory.getScriptEngine(new String[]{"-scripting"}, getClass().getClassLoader(), getClassFilter());
+            try {
+                engine.eval(new URLReader(new File(path).toURI().toURL()));
+            } catch (final Exception e) {
+                fail("Script " + path + " fails with exception :" + e.getMessage());
+            }
+        }
+    }
+
+    @Test
+    public void noJavaOptionTest() {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine engine = factory.getScriptEngine(new String[]{"--no-java"}, getClass().getClassLoader(), getClassFilter());
+        try {
+            engine.eval("var str = Java.type('java.lang.String');");
+            fail("TypeError should have been thrown");
+        } catch (final ScriptException e) {
+            //emtpy
+        }
+    }
+
+    @Test
+    public void securityTest() {
+        if (System.getSecurityManager() == null) {
+            return;
+        }
+
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine engine = factory.getScriptEngine(getClassFilter());
+        try {
+            engine.eval("var thread = Java.type('sun.misc.Unsafe')");
+            fail("SecurityException should have been thrown");
+        } catch (final Exception e) {
+            //empty
+        }
+        try {
+            engine.eval("var thread = new sun.misc.Unsafe()");
+            fail("SecurityException should have been thrown");
+        } catch (final Exception e) {
+            //empty
+        }
+        try {
+            engine.eval("var thread = Java.extend(sun.misc.Unsafe, {})");
+            fail("TypeError should have been thrown");
+        } catch (final Exception e) {
+            //empty
+        }
+        try {
+            engine.eval("java.lang.System.exit(0)");
+            fail("SecurityException should have been thrown");
+        } catch (final Exception e) {
+            //empty
+        }
+
+    }
+
+    @Test
+    public void persistentCacheTest() {
+        final String oldCodeCache = System.getProperty(NASHORN_CODE_CACHE);
+        System.setProperty(NASHORN_CODE_CACHE, CLASSFILTER_CODE_CACHE);
+        try {
+            persistentCacheTestImpl();
+        } finally {
+            if (oldCodeCache != null) {
+                System.setProperty(NASHORN_CODE_CACHE, oldCodeCache);
+            }
+        }
+    }
+
+    private void persistentCacheTestImpl() {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine engine = factory.getScriptEngine(
+              TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}),
+                  getClass().getClassLoader(),
+                  getClassFilter()
+        );
+        final String testScript = "var a = Java.type('java.lang.String');" + generateCodeForPersistentStore();
+        try {
+            engine.eval(testScript);
+        } catch (final ScriptException exc) {
+            fail(exc.getMessage());
+        }
+        final ScriptEngine engineSafe = factory.getScriptEngine(
+                TestFinder.addExplicitOptimisticTypes(new String[]{"--persistent-code-cache", "--optimistic-types=true"}),
+                getClass().getClassLoader(),
+                new ClassFilter() {
+                    @Override
+                    public boolean exposeToScripts(final String s) {
+                        return false;
+                    }
+                }
+        );
+        try {
+            engineSafe.eval(testScript);
+            fail("ClassNotFoundException should have been thrown");
+        } catch (final Exception exc) {
+            if (!(exc.getCause() instanceof ClassNotFoundException)) {
+                fail("ClassNotFoundException expected, got " + exc.getClass());
+            }
+        }
+    }
+
+    private static String generateCodeForPersistentStore() {
+        final StringBuilder stringBuilder = new StringBuilder();
+        for (int i=0; i < 100; i++) {
+            stringBuilder.append("function i")
+                    .append(i)
+                    .append("(y, z) { var x")
+                    .append(i)
+                    .append(" = ")
+                    .append(i)
+                    .append(";}");
+        }
+        return stringBuilder.toString();
+    }
+
+    private static ClassFilter getClassFilter() {
+        return new ClassFilter() {
+            @Override
+            public boolean exposeToScripts(final String s) {
+                return true;
+            }
+        };
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/CodeStoreAndPathTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.internal.runtime.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @bug 8039185 8039403
+ * @summary  Test for persistent code cache and path handling
+ * @run testng jdk.nashorn.internal.runtime.CodeStoreAndPathTest
+ */
+@SuppressWarnings("javadoc")
+public class CodeStoreAndPathTest {
+
+    final String code1 = "var code1; var x = 'Hello Script'; var x1 = 'Hello Script'; "
+                + "var x2 = 'Hello Script'; var x3 = 'Hello Script'; "
+                + "var x4 = 'Hello Script'; var x5 = 'Hello Script';"
+                + "var x6 = 'Hello Script'; var x7 = 'Hello Script'; "
+                + "var x8 = 'Hello Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';"
+                + "function f() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}"
+                + "function g() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}"
+                + "function h() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}"
+                + "function i() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}";
+    final String code2 = "var code2; var x = 'Hello Script'; var x1 = 'Hello Script'; "
+                + "var x2 = 'Hello Script'; var x3 = 'Hello Script'; "
+                + "var x4 = 'Hello Script'; var x5 = 'Hello Script';"
+                + "var x6 = 'Hello Script'; var x7 = 'Hello Script'; "
+                + "var x8 = 'Hello Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';"
+                + "function f() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}"
+                + "function g() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}"
+                + "function h() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}"
+                + "function i() {x ='Bye Script'; x1 ='Bye Script'; x2='Bye Script';"
+                + "x3='Bye Script'; x4='Bye Script'; x5='Bye Script'; x6='Bye Script';"
+                + "x7='Bye Script'; x8='Bye Script'; var x9 = 'Hello Script'; "
+                + "var x10 = 'Hello Script';}";
+    // Script size < Default minimum size for storing a compiled script class
+    final String code3 = "var code3; var x = 'Hello Script'; var x1 = 'Hello Script'; ";
+    final String codeCache = "build/nashorn_code_cache";
+    final String oldUserDir = System.getProperty("user.dir");
+
+    private static final String[] ENGINE_OPTIONS_OPT   = new String[]{"--persistent-code-cache", "--optimistic-types=true"};
+    private static final String[] ENGINE_OPTIONS_NOOPT = new String[]{"--persistent-code-cache", "--optimistic-types=false"};
+
+    @Test
+    public void pathHandlingTest() {
+        System.setProperty("nashorn.persistent.code.cache", codeCache);
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+
+        fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
+
+        final Path expectedCodeCachePath = FileSystems.getDefault().getPath(oldUserDir + File.separator + codeCache);
+        final Path actualCodeCachePath = FileSystems.getDefault().getPath(System.getProperty(
+                            "nashorn.persistent.code.cache")).toAbsolutePath();
+        // Check that nashorn code cache is created in current working directory
+        assertEquals(actualCodeCachePath, expectedCodeCachePath);
+        // Check that code cache dir exists and it's not empty
+        final File file = new File(actualCodeCachePath.toUri());
+        assertFalse(!file.isDirectory(), "No code cache directory was created!");
+        assertFalse(file.list().length == 0, "Code cache directory is empty!");
+    }
+
+    @Test
+    public void changeUserDirTest() throws ScriptException, IOException {
+        System.setProperty("nashorn.persistent.code.cache", codeCache);
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
+        final Path codeCachePath = getCodeCachePath(false);
+        final String newUserDir = "build/newUserDir";
+        // Now changing current working directory
+        System.setProperty("user.dir", System.getProperty("user.dir") + File.separator + newUserDir);
+        try {
+            // Check that a new compiled script is stored in existing code cache
+            e.eval(code1);
+            final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
+            checkCompiledScripts(stream, 1);
+            // Setting to default current working dir
+        } finally {
+            System.setProperty("user.dir", oldUserDir);
+        }
+    }
+
+    @Test
+    public void codeCacheTest() throws ScriptException, IOException {
+        System.setProperty("nashorn.persistent.code.cache", codeCache);
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_NOOPT);
+        final Path codeCachePath = getCodeCachePath(false);
+        e.eval(code1);
+        e.eval(code2);
+        e.eval(code3);// less than minimum size for storing
+        // adding code1 and code2.
+        final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
+        checkCompiledScripts(stream, 2);
+    }
+
+    @Test
+    public void codeCacheTestOpt() throws ScriptException, IOException {
+        System.setProperty("nashorn.persistent.code.cache", codeCache);
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine e = fac.getScriptEngine(ENGINE_OPTIONS_OPT);
+        final Path codeCachePath = getCodeCachePath(true);
+        e.eval(code1);
+        e.eval(code2);
+        e.eval(code3);// less than minimum size for storing
+        // adding code1 and code2.
+        final DirectoryStream<Path> stream = Files.newDirectoryStream(codeCachePath);
+        checkCompiledScripts(stream, 2);
+    }
+
+    private static Path getCodeCachePath(final boolean optimistic) {
+        final String codeCache = System.getProperty("nashorn.persistent.code.cache");
+        final Path codeCachePath = FileSystems.getDefault().getPath(codeCache).toAbsolutePath();
+        final String[] files = codeCachePath.toFile().list();
+        for (final String file : files) {
+            if (file.endsWith("_opt") == optimistic) {
+                return codeCachePath.resolve(file);
+            }
+        }
+        throw new AssertionError("Code cache path not found");
+    }
+
+    private static void checkCompiledScripts(final DirectoryStream<Path> stream, final int numberOfScripts) throws IOException {
+        int n = numberOfScripts;
+        for (@SuppressWarnings("unused") final Path file : stream) {
+            n--;
+        }
+        stream.close();
+        assertEquals(n, 0);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ConsStringTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import jdk.nashorn.internal.runtime.ConsString;
+import static org.testng.Assert.assertEquals;
+
+import org.testng.annotations.Test;
+
+/**
+ * Tests for JSType methods.
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.ConsStringTest
+ */
+public class ConsStringTest {
+
+    /**
+     * Test toString conversion
+     */
+    @Test
+    public void testConsStringToString() {
+        final ConsString cs1 = new ConsString("b", "c");
+        final ConsString cs2 = new ConsString("d", "e");
+        final ConsString cs3 = new ConsString(cs1, cs2);
+        final ConsString cs4 = new ConsString(cs3, "f");
+        final ConsString cs5 = new ConsString("a", cs4);
+        assertEquals(cs5.toString(), "abcdef");
+        assertEquals(cs4.toString(), "bcdef");
+        assertEquals(cs3.toString(), "bcde");
+        assertEquals(cs2.toString(), "de");
+        assertEquals(cs1.toString(), "bc");
+        // ConsStrings should be flattened now
+        assertEquals(cs1.getComponents()[0], "bc");
+        assertEquals(cs1.getComponents()[1], "");
+        assertEquals(cs2.getComponents()[0], "de");
+        assertEquals(cs2.getComponents()[1], "");
+        assertEquals(cs3.getComponents()[0], "bcde");
+        assertEquals(cs3.getComponents()[1], "");
+        assertEquals(cs4.getComponents()[0], "bcdef");
+        assertEquals(cs4.getComponents()[1], "");
+        assertEquals(cs5.getComponents()[0], "abcdef");
+        assertEquals(cs5.getComponents()[1], "");
+    }
+
+    /**
+     * Test charAt
+     */
+    @Test
+    public void testConsStringCharAt() {
+        final ConsString cs1 = new ConsString("b", "c");
+        final ConsString cs2 = new ConsString("d", "e");
+        final ConsString cs3 = new ConsString(cs1, cs2);
+        final ConsString cs4 = new ConsString(cs3, "f");
+        final ConsString cs5 = new ConsString("a", cs4);
+        assertEquals(cs1.charAt(1), 'c');
+        assertEquals(cs2.charAt(0), 'd');
+        assertEquals(cs3.charAt(3), 'e');
+        assertEquals(cs4.charAt(1), 'c');
+        assertEquals(cs5.charAt(2), 'c');
+        // ConsStrings should be flattened now
+        assertEquals(cs1.getComponents()[0], "bc");
+        assertEquals(cs1.getComponents()[1], "");
+        assertEquals(cs2.getComponents()[0], "de");
+        assertEquals(cs2.getComponents()[1], "");
+        assertEquals(cs3.getComponents()[0], "bcde");
+        assertEquals(cs3.getComponents()[1], "");
+        assertEquals(cs4.getComponents()[0], "bcdef");
+        assertEquals(cs4.getComponents()[1], "");
+        assertEquals(cs5.getComponents()[0], "abcdef");
+        assertEquals(cs5.getComponents()[1], "");
+    }
+
+
+    /**
+     * Test flattening of top-level and internal ConsStrings
+     */
+    @Test
+    public void testConsStringFlattening() {
+        final ConsString cs1 = new ConsString("b", "c");
+        final ConsString cs2 = new ConsString("d", "e");
+        final ConsString cs3 = new ConsString(cs1, cs2);
+        final ConsString cs4 = new ConsString(cs3, "f");
+
+        final ConsString cs5 = new ConsString("a", cs4);
+        // top-level ConsString should not yet be flattened
+        assert(cs5.getComponents()[0] == "a");
+        assert(cs5.getComponents()[1] == cs4);
+        assertEquals(cs5.toString(), "abcdef");
+        // top-level ConsString should be flattened
+        assertEquals(cs5.getComponents()[0], "abcdef");
+        assertEquals(cs5.getComponents()[1], "");
+        // internal ConsString should not yet be flattened after first traversal
+        assertEquals(cs4.getComponents()[0], cs3);
+        assertEquals(cs4.getComponents()[1], "f");
+
+        final ConsString cs6 = new ConsString("a", cs4);
+        // top-level ConsString should not yet be flattened
+        assertEquals(cs6.getComponents()[0], "a");
+        assertEquals(cs6.getComponents()[1], cs4);
+        assertEquals(cs6.toString(), "abcdef");
+        // top-level ConsString should be flattened
+        assertEquals(cs6.getComponents()[0], "abcdef");
+        assertEquals(cs6.getComponents()[1], "");
+        // internal ConsString should have been flattened after second traversal
+        assertEquals(cs4.getComponents()[0], "bcdef");
+        assertEquals(cs4.getComponents()[1], "");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ContextTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import java.util.Map;
+import jdk.nashorn.internal.objects.Global;
+import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ErrorManager;
+import jdk.nashorn.internal.runtime.ScriptFunction;
+import jdk.nashorn.internal.runtime.ScriptObject;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.Source;
+import jdk.nashorn.internal.runtime.options.Options;
+import org.testng.annotations.Test;
+
+/**
+ * Basic Context API tests.
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.ContextTest
+ */
+@SuppressWarnings("javadoc")
+public class ContextTest {
+    // basic context eval test
+    @Test
+    public void evalTest() {
+        final Options options = new Options("");
+        final ErrorManager errors = new ErrorManager();
+        final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
+        final Global oldGlobal = Context.getGlobal();
+        Context.setGlobal(cx.createGlobal());
+        try {
+            String code = "22 + 10";
+            assertTrue(32.0 == ((Number)(eval(cx, "<evalTest>", code))).doubleValue());
+
+            code = "obj = { js: 'nashorn' }; obj.js";
+            assertEquals(eval(cx, "<evalTest2>", code), "nashorn");
+        } finally {
+            Context.setGlobal(oldGlobal);
+        }
+    }
+
+    // Make sure trying to compile an invalid script returns null - see JDK-8046215.
+    @Test
+    public void compileErrorTest() {
+        final Options options = new Options("");
+        final ErrorManager errors = new ErrorManager();
+        final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
+        final Global oldGlobal = Context.getGlobal();
+        Context.setGlobal(cx.createGlobal());
+        try {
+            final ScriptFunction script = cx.compileScript(sourceFor("<evalCompileErrorTest>", "*/"), Context.getGlobal());
+            if (script != null) {
+                fail("Invalid script compiled without errors");
+            }
+            if (errors.getNumberOfErrors() != 1) {
+                fail("Wrong number of errors: " + errors.getNumberOfErrors());
+            }
+        } finally {
+            Context.setGlobal(oldGlobal);
+        }
+    }
+
+    // basic check for JS reflection access - java.util.Map-like access on ScriptObject
+    @Test
+    public void reflectionTest() {
+        final Options options = new Options("");
+        final ErrorManager errors = new ErrorManager();
+        final Context cx = new Context(options, errors, Thread.currentThread().getContextClassLoader());
+        final boolean strict = cx.getEnv()._strict;
+        final Global oldGlobal = Context.getGlobal();
+        Context.setGlobal(cx.createGlobal());
+
+        try {
+            final String code = "var obj = { x: 344, y: 42 }";
+            eval(cx, "<reflectionTest>", code);
+
+            final Object obj = Context.getGlobal().get("obj");
+
+            assertTrue(obj instanceof ScriptObject);
+
+            final ScriptObject sobj = (ScriptObject)obj;
+            int count = 0;
+            for (final Map.Entry<?, ?> ex : sobj.entrySet()) {
+                final Object key = ex.getKey();
+                if (key.equals("x")) {
+                    assertTrue(ex.getValue() instanceof Number);
+                    assertTrue(344.0 == ((Number)ex.getValue()).doubleValue());
+
+                    count++;
+                } else if (key.equals("y")) {
+                    assertTrue(ex.getValue() instanceof Number);
+                    assertTrue(42.0 == ((Number)ex.getValue()).doubleValue());
+
+                    count++;
+                }
+            }
+            assertEquals(count, 2);
+            assertEquals(sobj.size(), 2);
+
+            // add property
+            sobj.put("zee", "hello", strict);
+            assertEquals(sobj.get("zee"), "hello");
+            assertEquals(sobj.size(), 3);
+
+        } finally {
+            Context.setGlobal(oldGlobal);
+        }
+    }
+
+    private static Object eval(final Context cx, final String name, final String code) {
+        final Source source = sourceFor(name, code);
+        final ScriptObject global = Context.getGlobal();
+        final ScriptFunction func = cx.compileScript(source, global);
+        return func != null ? ScriptRuntime.apply(func, global) : null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/ExceptionsNotSerializable.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.NotSerializableException;
+import java.io.ObjectOutputStream;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import jdk.nashorn.internal.runtime.RewriteException;
+import jdk.nashorn.internal.runtime.UnwarrantedOptimismException;
+import org.testng.annotations.Test;
+
+/**
+ * JDK-8044518: Ensure exceptions related to optimistic recompilation are not serializable
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.ExceptionsNotSerializable
+ */
+@SuppressWarnings("javadoc")
+public class ExceptionsNotSerializable {
+    @Test
+    public void rewriteExceptionNotSerializable() throws ScriptException {
+        // NOTE: we must create a RewriteException in a context of a Nashorn engine, as it uses Global.newIntance()
+        // internally.
+        final ScriptEngine e = new NashornScriptEngineFactory().getScriptEngine();
+        e.put("f", new Runnable() {
+            @Override
+            public void run() {
+                tryToSerialize(RewriteException.create(null, new Object[0], new String[0]));
+            }
+        });
+        e.eval("f()");
+    }
+
+    @Test
+    public void unwarrantedOptimismExceptionNotSerializable() {
+        tryToSerialize(new UnwarrantedOptimismException(new Double(1.0), 128));
+    }
+
+    private static void tryToSerialize(final Object obj) {
+        try {
+            new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(obj);
+            fail();
+        } catch (final NotSerializableException e) {
+            assertEquals(e.getMessage(), obj.getClass().getName());
+        } catch (final IOException e) {
+            fail("", e);
+        }
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/JSTypeTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import jdk.nashorn.internal.runtime.JSType;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+
+/**
+ * Tests for JSType methods.
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.JSTypeTest
+ */
+public class JSTypeTest {
+    /**
+     * Test of isPrimitive method, of class Runtime.
+     */
+    @Test
+    public void testIsPrimitive() {
+        assertTrue(JSType.isPrimitive(null));
+        assertTrue(JSType.isPrimitive(ScriptRuntime.UNDEFINED));
+        assertTrue(JSType.isPrimitive(Double.NaN));
+        assertTrue(JSType.isPrimitive(Double.NEGATIVE_INFINITY));
+        assertTrue(JSType.isPrimitive(Double.POSITIVE_INFINITY));
+        assertTrue(JSType.isPrimitive(0.0));
+        assertTrue(JSType.isPrimitive(3.14));
+        assertTrue(JSType.isPrimitive("hello"));
+        assertTrue(JSType.isPrimitive(""));
+        assertFalse(JSType.isPrimitive(new Object()));
+    }
+
+    /**
+     * Test of toBoolean method, of class Runtime.
+     */
+    @Test
+    public void testToBoolean() {
+        assertFalse(JSType.toBoolean(ScriptRuntime.UNDEFINED));
+        assertFalse(JSType.toBoolean(null));
+        assertFalse(JSType.toBoolean(Boolean.FALSE));
+        assertTrue(JSType.toBoolean(Boolean.TRUE));
+        assertFalse(JSType.toBoolean(-0.0));
+        assertFalse(JSType.toBoolean(0.0));
+        assertFalse(JSType.toBoolean(Double.NaN));
+        assertTrue(JSType.toBoolean(3.14));
+        assertFalse(JSType.toBoolean(""));
+        assertTrue(JSType.toBoolean("javascript"));
+        assertTrue(JSType.toBoolean(new Object()));
+    }
+
+    /**
+     * Test of toNumber method, of class Runtime.
+     */
+    @Test
+    public void testToNumber_Object() {
+        assertTrue(Double.isNaN(JSType.toNumber(ScriptRuntime.UNDEFINED)));
+        assertEquals(JSType.toNumber((Object)null), 0.0, 0.0);
+        assertEquals(JSType.toNumber(Boolean.TRUE), 1.0, 0.0);
+        assertEquals(JSType.toNumber(Boolean.FALSE), 0.0, 0.0);
+        assertEquals(JSType.toNumber(3.14), 3.14, 0.0);
+        // FIXME: add more assertions for specific String to number cases
+        // FIXME: add case for Object type (JSObject with getDefaultValue)
+    }
+
+    /**
+     * Test of toString method, of class Runtime.
+     */
+    @Test
+    public void testToString_Object() {
+        assertEquals(JSType.toString(ScriptRuntime.UNDEFINED), "undefined");
+        assertEquals(JSType.toString(null), "null");
+        assertEquals(JSType.toString(Boolean.TRUE), "true");
+        assertEquals(JSType.toString(Boolean.FALSE), "false");
+        assertEquals(JSType.toString(""), "");
+        assertEquals(JSType.toString("nashorn"), "nashorn");
+        assertEquals(JSType.toString(Double.NaN), "NaN");
+        assertEquals(JSType.toString(Double.POSITIVE_INFINITY), "Infinity");
+        assertEquals(JSType.toString(Double.NEGATIVE_INFINITY), "-Infinity");
+        assertEquals(JSType.toString(0.0), "0");
+        // FIXME: add more number-to-string test cases
+        // FIXME: add case for Object type (JSObject with getDefaultValue)
+    }
+
+    /**
+     * Test of JSType.toUint32(double)
+     */
+    @Test
+    public void testToUint32() {
+        assertEquals(JSType.toUint32(+0.0), 0);
+        assertEquals(JSType.toUint32(-0.0), 0);
+        assertEquals(JSType.toUint32(Double.NaN), 0);
+        assertEquals(JSType.toUint32(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toUint32(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toUint32(9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint32(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint32(1099511627776.0d), 0);
+        assertEquals(JSType.toUint32(-1099511627776.0d), 0);
+        assertEquals(JSType.toUint32(4294967295.0d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967296.0d), 0);
+        assertEquals(JSType.toUint32(4294967297.0d), 1);
+        assertEquals(JSType.toUint32(-4294967295.0d), 1);
+        assertEquals(JSType.toUint32(-4294967296.0d), 0);
+        assertEquals(JSType.toUint32(-4294967297.0d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967295.6d), 4294967295l);
+        assertEquals(JSType.toUint32(4294967296.6d), 0);
+        assertEquals(JSType.toUint32(4294967297.6d), 1);
+        assertEquals(JSType.toUint32(-4294967295.6d), 1);
+        assertEquals(JSType.toUint32(-4294967296.6d), 0);
+        assertEquals(JSType.toUint32(-4294967297.6d), 4294967295l);
+    }
+
+    /**
+     * Test of JSType.toInt32(double)
+     */
+    @Test
+    public void testToInt32() {
+        assertEquals(JSType.toInt32(+0.0), 0);
+        assertEquals(JSType.toInt32(-0.0), 0);
+        assertEquals(JSType.toInt32(Double.NaN), 0);
+        assertEquals(JSType.toInt32(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toInt32(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toInt32(9223372036854775807.0d), 0);
+        assertEquals(JSType.toInt32(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toInt32(1099511627776.0d), 0);
+        assertEquals(JSType.toInt32(-1099511627776.0d), 0);
+        assertEquals(JSType.toInt32(4294967295.0d), -1);
+        assertEquals(JSType.toInt32(4294967296.0d), 0);
+        assertEquals(JSType.toInt32(4294967297.0d), 1);
+        assertEquals(JSType.toInt32(-4294967295.0d), 1);
+        assertEquals(JSType.toInt32(-4294967296.0d), 0);
+        assertEquals(JSType.toInt32(-4294967297.d), -1);
+        assertEquals(JSType.toInt32(4294967295.6d), -1);
+        assertEquals(JSType.toInt32(4294967296.6d), 0);
+        assertEquals(JSType.toInt32(4294967297.6d), 1);
+        assertEquals(JSType.toInt32(-4294967295.6d), 1);
+        assertEquals(JSType.toInt32(-4294967296.6d), 0);
+        assertEquals(JSType.toInt32(-4294967297.6d), -1);
+    }
+
+    /**
+     * Test of JSType.toUint16(double)
+     */
+    @Test
+    public void testToUint16() {
+        assertEquals(JSType.toUint16(+0.0), 0);
+        assertEquals(JSType.toUint16(-0.0), 0);
+        assertEquals(JSType.toUint16(Double.NaN), 0);
+        assertEquals(JSType.toUint16(Double.POSITIVE_INFINITY), 0);
+        assertEquals(JSType.toUint16(Double.NEGATIVE_INFINITY), 0);
+        assertEquals(JSType.toUint16(9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint16(-9223372036854775807.0d), 0);
+        assertEquals(JSType.toUint16(1099511627776.0d), 0);
+        assertEquals(JSType.toUint16(-1099511627776.0d), 0);
+        assertEquals(JSType.toUint16(4294967295.0d), 65535);
+        assertEquals(JSType.toUint16(4294967296.0d), 0);
+        assertEquals(JSType.toUint16(4294967297.0d), 1);
+        assertEquals(JSType.toUint16(-4294967295.0d), 1);
+        assertEquals(JSType.toUint16(-4294967296.0d), 0);
+        assertEquals(JSType.toUint16(-4294967297.0d), 65535);
+        assertEquals(JSType.toUint16(4294967295.6d), 65535);
+        assertEquals(JSType.toUint16(4294967296.6d), 0);
+        assertEquals(JSType.toUint16(4294967297.6d), 1);
+        assertEquals(JSType.toUint16(-4294967295.6d), 1);
+        assertEquals(JSType.toUint16(-4294967296.6d), 0);
+        assertEquals(JSType.toUint16(-4294967297.6d), 65535);
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/LexicalBindingTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import org.testng.annotations.Test;
+
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import javax.script.SimpleScriptContext;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Top-level lexical binding tests.
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.LexicalBindingTest
+ */
+@SuppressWarnings("javadoc")
+public class LexicalBindingTest {
+
+    final static String LANGUAGE_ES6 = "--language=es6";
+    final static int NUMBER_OF_CONTEXTS = 20;
+    final static int MEGAMORPHIC_LOOP_COUNT = 20;
+
+    /**
+     * Test access to global var-declared variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void megamorphicVarTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine();
+        final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
+        final String sharedScript = "foo";
+
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i] = new SimpleScriptContext();
+            final Bindings b = e.createBindings();
+            context.setBindings(b, ScriptContext.ENGINE_SCOPE);
+            assertEquals(e.eval("var foo = '" + i + "';", context), null);
+        }
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i];
+            assertEquals(e.eval(sharedScript, context), String.valueOf(i));
+        }
+    }
+
+    /**
+     * Test access to global lexically declared variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void megamorphicMultiGlobalLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
+        final String sharedScript = "foo";
+
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i] = new SimpleScriptContext();
+            final Bindings b = e.createBindings();
+            context.setBindings(b, ScriptContext.ENGINE_SCOPE);
+            assertEquals(e.eval("let foo = '" + i + "';", context), null);
+        }
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i];
+            assertEquals(e.eval(sharedScript, context), String.valueOf(i));
+        }
+    }
+
+
+    /**
+     * Test access to global lexically declared variables for shared script classes with single global.
+     */
+    @Test
+    public static void megamorphicSingleGlobalLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final String sharedGetterScript = "foo";
+        final String sharedSetterScript = "foo = 1";
+
+        for (int i = 0; i < MEGAMORPHIC_LOOP_COUNT; i++) {
+            assertEquals(e.eval(sharedSetterScript), 1);
+            assertEquals(e.eval(sharedGetterScript), 1);
+            assertEquals(e.eval("delete foo; a" + i + " = 1; foo = " + i + ";"), i);
+            assertEquals(e.eval(sharedGetterScript), i);
+        }
+
+        assertEquals(e.eval("let foo = 'foo';"), null);
+        assertEquals(e.eval(sharedGetterScript), "foo");
+        assertEquals(e.eval(sharedSetterScript), 1);
+        assertEquals(e.eval(sharedGetterScript), 1);
+        assertEquals(e.eval("this.foo"), MEGAMORPHIC_LOOP_COUNT - 1);
+    }
+
+    /**
+     * Test access to global lexically declared variables for shared script classes with single global.
+     */
+    @Test
+    public static void megamorphicInheritedGlobalLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final String sharedGetterScript = "foo";
+        final String sharedSetterScript = "foo = 1";
+
+        for (int i = 0; i < MEGAMORPHIC_LOOP_COUNT; i++) {
+            assertEquals(e.eval(sharedSetterScript), 1);
+            assertEquals(e.eval(sharedGetterScript), 1);
+            assertEquals(e.eval("delete foo; a" + i + " = 1; Object.prototype.foo = " + i + ";"), i);
+            assertEquals(e.eval(sharedGetterScript), i);
+        }
+
+        assertEquals(e.eval("let foo = 'foo';"), null);
+        assertEquals(e.eval(sharedGetterScript), "foo");
+        assertEquals(e.eval(sharedSetterScript), 1);
+        assertEquals(e.eval(sharedGetterScript), 1);
+        assertEquals(e.eval("this.foo"), MEGAMORPHIC_LOOP_COUNT - 1);
+    }
+
+    /**
+     * Test multi-threaded access to global lexically declared variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "foo";
+
+        assertEquals(e.eval("let foo = 'original context';", origContext), null);
+        assertEquals(e.eval("let foo = 'new context';", newCtxt), null);
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval("foo = 'newer context';", newCtxt), "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        assertEquals(e.eval(sharedScript), "original context");
+        assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+    private static class ScriptRunner implements Runnable {
+
+        final ScriptEngine engine;
+        final ScriptContext context;
+        final String source;
+        final Object expected;
+        final int iterations;
+
+        ScriptRunner(final ScriptEngine engine, final ScriptContext context, final String source, final Object expected, final int iterations) {
+            this.engine = engine;
+            this.context = context;
+            this.source = source;
+            this.expected = expected;
+            this.iterations = iterations;
+        }
+
+        @Override
+        public void run() {
+            try {
+                for (int i = 0; i < iterations; i++) {
+                    assertEquals(engine.eval(source, context), expected);
+                }
+            } catch (final ScriptException se) {
+                throw new RuntimeException(se);
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/NoPersistenceCachingTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.nashorn.internal.runtime.test;
+
+import static org.testng.Assert.fail;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngineManager;
+import javax.script.SimpleScriptContext;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * @test
+ * @bug 8037378
+ * @summary Sanity tests for no persistence caching
+ * @run testng/othervm jdk.nashorn.internal.runtime.NoPersistenceCachingTest
+ */
+@SuppressWarnings("javadoc")
+public class NoPersistenceCachingTest {
+
+   private ScriptEngine engine;
+   private ScriptContext context1, context2, context3;
+   private ByteArrayOutputStream stderr;
+   private PrintStream prevStderr;
+
+   @BeforeTest
+   public void setupTest() {
+      stderr = new ByteArrayOutputStream();
+      prevStderr = System.err;
+      System.setErr(new PrintStream(stderr));
+      NashornScriptEngineFactory nashornFactory = null;
+      final ScriptEngineManager sm = new ScriptEngineManager();
+      for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
+         if (fac instanceof NashornScriptEngineFactory) {
+            nashornFactory = (NashornScriptEngineFactory) fac;
+            break;
+         }
+      }
+      if (nashornFactory == null) {
+         fail("Cannot find nashorn factory!");
+      }
+      // fine is enough for cache hits, finest produces way too much information
+      // TODO this should be ported to use the RuntimeEvents instead of screen scraping
+      // logs, as obviously this is very brittle
+      final String[] options = new String[]{"--log=compiler:fine"};
+      engine = nashornFactory.getScriptEngine(options);
+      context1 = engine.getContext();
+      context2 = new SimpleScriptContext();
+      context2.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
+      context3 = new SimpleScriptContext();
+      context3.setBindings(engine.createBindings(), ScriptContext.ENGINE_SCOPE);
+   }
+
+   @AfterTest
+   public void setErrTest() {
+      System.setErr(prevStderr);
+   }
+
+   public void runTest(final int numberOfContext, final String expectedOutputPattern,
+                       final int expectedPatternOccurrence) {
+
+      try {
+         switch (numberOfContext) {
+         case 2:
+            final String scriptTwoContexts = "print('HelloTwoContexts')";
+            engine.eval(scriptTwoContexts, context1);
+            engine.eval(scriptTwoContexts, context2);
+            break;
+         case 3:
+            final String scriptThreeContexts = "print('HelloThreeContexts')";
+            engine.eval(scriptThreeContexts, context1);
+            engine.eval(scriptThreeContexts, context2);
+            engine.eval(scriptThreeContexts, context3);
+            break;
+        default:
+            break;
+         }
+      } catch (final Exception se) {
+         se.printStackTrace();
+         fail(se.getMessage());
+      }
+      final Pattern deoptimizing = Pattern.compile(expectedOutputPattern);
+      final Matcher matcher = deoptimizing.matcher(stderr.toString());
+      int matches = 0;
+      while (matcher.find()) {
+         matches++;
+      }
+      if (matches != expectedPatternOccurrence) {
+         fail("Number of cache hit is not correct, expected: "
+                    + expectedPatternOccurrence + " and found: " + matches + "\n"
+              + stderr);
+      }
+      stderr.reset();
+   }
+
+   private static String getCodeCachePattern() {
+      return ("\\[compiler\\]\\sCode\\scache\\shit\\sfor\\s<eval>\\savoiding\\srecompile.");
+   }
+
+    @Test
+    public void twoContextTest() {
+       runTest(2, getCodeCachePattern(), 1);
+
+    }
+
+    @Test
+    public void threeContextTest() {
+       runTest(3, getCodeCachePattern(), 2);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/SourceTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import static jdk.nashorn.internal.runtime.Source.sourceFor;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Arrays;
+import jdk.nashorn.api.scripting.URLReader;
+import jdk.nashorn.internal.runtime.Source;
+import org.testng.annotations.Test;
+
+/**
+ * Tests different Source representations.
+ */
+@SuppressWarnings("javadoc")
+public class SourceTest {
+
+    final private static String SOURCE_NAME = "source.js";
+    final private static String SOURCE_STRING = "var x = 1;";
+    final private static char[] SOURCE_CHARS = SOURCE_STRING.toCharArray();
+    final private static String RESOURCE_PATH = "resources/load_test.js";
+    final private static File SOURCE_FILE = new File("build/test/classes/jdk/nashorn/internal/runtime/" + RESOURCE_PATH);
+    final private static URL  SOURCE_URL = SourceTest.class.getResource(RESOURCE_PATH);
+
+
+    @Test
+    public void testStringSource() {
+        testSources(sourceFor(SOURCE_NAME, SOURCE_STRING), sourceFor(SOURCE_NAME, SOURCE_STRING));
+        testSources(sourceFor(SOURCE_NAME, SOURCE_STRING), sourceFor(SOURCE_NAME, SOURCE_CHARS));
+    }
+
+    @Test
+    public void testCharArraySource() {
+        testSources(sourceFor(SOURCE_NAME, SOURCE_CHARS), sourceFor(SOURCE_NAME, SOURCE_CHARS));
+        testSources(sourceFor(SOURCE_NAME, SOURCE_CHARS), sourceFor(SOURCE_NAME, SOURCE_STRING));
+    }
+
+    @Test
+    public void testURLSource() {
+        try {
+            testSources(sourceFor(SOURCE_NAME, SOURCE_URL), sourceFor(SOURCE_NAME, SOURCE_URL));
+            testSources(sourceFor(SOURCE_NAME, SOURCE_URL), sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)));
+
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testURLReaderSource() {
+        try {
+            System.err.println(SourceTest.class.getResource(""));
+            testSources(sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)), sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)));
+            testSources(sourceFor(SOURCE_NAME, new URLReader(SOURCE_URL)), sourceFor(SOURCE_NAME, SOURCE_URL));
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testReaderSource() {
+        try {
+            testSources(sourceFor(SOURCE_NAME, getReader(RESOURCE_PATH)), sourceFor(SOURCE_NAME, getReader(RESOURCE_PATH)));
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testFileSource() {
+        try {
+            testSources(sourceFor(SOURCE_NAME, SOURCE_FILE), sourceFor(SOURCE_NAME, SOURCE_FILE));
+        } catch (final IOException e) {
+            fail(e.toString());
+        }
+    }
+
+    private static Reader getReader(final String path) {
+        return new InputStreamReader(SourceTest.class.getResourceAsStream(path));
+    }
+
+    private static void testSources(final Source source1, final Source source2) {
+        final char[] chars1 = source1.getContent();
+        final char[] chars2 = source2.getContent();
+        final String str1 = source1.getString();
+        final String str2 = source2.getString();
+        assertTrue(Arrays.equals(chars1, chars2));
+        assertEquals(str1, str2);
+        assertEquals(source1.hashCode(), source2.hashCode());
+        assertTrue(source1.equals(source2));
+        assertTrue(Arrays.equals(source1.getContent(), str1.toCharArray()));
+        assertTrue(Arrays.equals(source1.getContent(), chars1));
+        assertTrue(Arrays.equals(source1.getContent(), source2.getContent()));
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/TrustedScriptEngineTest.java	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,363 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngineManager;
+import javax.script.ScriptException;
+import javax.script.SimpleScriptContext;
+import jdk.nashorn.api.scripting.ClassFilter;
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import jdk.nashorn.internal.runtime.Version;
+import org.testng.annotations.Test;
+
+/**
+ * Tests for trusted client usage of nashorn script engine factory extension API
+ */
+@SuppressWarnings("javadoc")
+public class TrustedScriptEngineTest {
+    @Test
+    public void versionTest() {
+        final ScriptEngineManager m = new ScriptEngineManager();
+        final ScriptEngine e = m.getEngineByName("nashorn");
+        assertEquals(e.getFactory().getEngineVersion(), Version.version());
+    }
+
+    private static class MyClassLoader extends ClassLoader {
+        // to check if script engine uses the specified class loader
+        private final boolean[] reached = new boolean[1];
+
+        @Override
+        protected Class<?> findClass(final String name) throws ClassNotFoundException {
+            // flag that it reached here
+            reached[0] = true;
+            return super.findClass(name);
+        }
+
+        public boolean reached() {
+            return reached[0];
+        }
+    }
+
+    // These are for "private" extension API of NashornScriptEngineFactory that
+    // accepts a ClassLoader and/or command line options.
+
+    @Test
+    public void factoryClassLoaderTest() {
+        final ScriptEngineManager sm = new ScriptEngineManager();
+        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
+            if (fac instanceof NashornScriptEngineFactory) {
+                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
+                final MyClassLoader loader = new MyClassLoader();
+                // set the classloader as app class loader
+                final ScriptEngine e = nfac.getScriptEngine(loader);
+                try {
+                    e.eval("Packages.foo");
+                    // check that the class loader was attempted
+                    assertTrue(loader.reached(), "did not reach class loader!");
+                } catch (final ScriptException se) {
+                    se.printStackTrace();
+                    fail(se.getMessage());
+                }
+                return;
+            }
+        }
+
+        fail("Cannot find nashorn factory!");
+    }
+
+    @Test
+    public void factoryClassLoaderAndOptionsTest() {
+        final ScriptEngineManager sm = new ScriptEngineManager();
+        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
+            if (fac instanceof NashornScriptEngineFactory) {
+                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
+                final String[] options = new String[] { "-strict" };
+                final MyClassLoader loader = new MyClassLoader();
+                // set the classloader as app class loader
+                final ScriptEngine e = nfac.getScriptEngine(options, loader);
+                try {
+                    e.eval("Packages.foo");
+                    // check that the class loader was attempted
+                    assertTrue(loader.reached(), "did not reach class loader!");
+                } catch (final ScriptException se) {
+                    se.printStackTrace();
+                    fail(se.getMessage());
+                }
+
+                try {
+                    // strict mode - delete of a var should throw SyntaxError
+                    e.eval("var d = 2; delete d;");
+                } catch (final ScriptException se) {
+                    // check that the error message contains "SyntaxError"
+                    assertTrue(se.getMessage().contains("SyntaxError"));
+                }
+
+                return;
+            }
+        }
+
+        fail("Cannot find nashorn factory!");
+    }
+
+    @Test
+    public void factoryOptionsTest() {
+        final ScriptEngineManager sm = new ScriptEngineManager();
+        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
+            if (fac instanceof NashornScriptEngineFactory) {
+                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
+                // specify --no-syntax-extensions flag
+                final String[] options = new String[] { "--no-syntax-extensions" };
+                final ScriptEngine e = nfac.getScriptEngine(options);
+                try {
+                    // try nashorn specific extension
+                    e.eval("var f = funtion(x) 2*x;");
+                    fail("should have thrown exception!");
+                } catch (final Exception ex) {
+                    //empty
+                }
+                return;
+            }
+        }
+
+        fail("Cannot find nashorn factory!");
+    }
+
+    @Test
+    /**
+     * Test repeated evals with --loader-per-compile=false
+     * We used to get "class redefinition error".
+     */
+    public void noLoaderPerCompilerTest() {
+        final ScriptEngineManager sm = new ScriptEngineManager();
+        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
+            if (fac instanceof NashornScriptEngineFactory) {
+                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
+                final String[] options = new String[] { "--loader-per-compile=false" };
+                final ScriptEngine e = nfac.getScriptEngine(options);
+                try {
+                    e.eval("2 + 3");
+                    e.eval("4 + 4");
+                } catch (final ScriptException se) {
+                    se.printStackTrace();
+                    fail(se.getMessage());
+                }
+                return;
+            }
+        }
+        fail("Cannot find nashorn factory!");
+    }
+
+    @Test
+    /**
+     * Test that we can use same script name in repeated evals with --loader-per-compile=false
+     * We used to get "class redefinition error" as name was derived from script name.
+     */
+    public void noLoaderPerCompilerWithSameNameTest() {
+        final ScriptEngineManager sm = new ScriptEngineManager();
+        for (final ScriptEngineFactory fac : sm.getEngineFactories()) {
+            if (fac instanceof NashornScriptEngineFactory) {
+                final NashornScriptEngineFactory nfac = (NashornScriptEngineFactory)fac;
+                final String[] options = new String[] { "--loader-per-compile=false" };
+                final ScriptEngine e = nfac.getScriptEngine(options);
+                e.put(ScriptEngine.FILENAME, "test.js");
+                try {
+                    e.eval("2 + 3");
+                    e.eval("4 + 4");
+                } catch (final ScriptException se) {
+                    se.printStackTrace();
+                    fail(se.getMessage());
+                }
+                return;
+            }
+        }
+        fail("Cannot find nashorn factory!");
+    }
+
+    @Test
+    public void globalPerEngineTest() throws ScriptException {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final String[] options = new String[] { "--global-per-engine" };
+        final ScriptEngine e = fac.getScriptEngine(options);
+
+        e.eval("function foo() {}");
+
+        final ScriptContext newCtx = new SimpleScriptContext();
+        newCtx.setBindings(e.createBindings(), ScriptContext.ENGINE_SCOPE);
+
+        // all global definitions shared and so 'foo' should be
+        // visible in new Bindings as well.
+        assertTrue(e.eval("typeof foo", newCtx).equals("function"));
+
+        e.eval("function bar() {}", newCtx);
+
+        // bar should be visible in default context
+        assertTrue(e.eval("typeof bar").equals("function"));
+    }
+
+    @Test
+    public void classFilterTest() throws ScriptException {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine e = fac.getScriptEngine(new ClassFilter() {
+            @Override
+            public boolean exposeToScripts(final String fullName) {
+                // don't allow anything that is not "java."
+                return fullName.startsWith("java.");
+            }
+        });
+
+        assertEquals(e.eval("typeof javax.script.ScriptEngine"), "object");
+        assertEquals(e.eval("typeof java.util.Vector"), "function");
+
+        try {
+            e.eval("Java.type('javax.script.ScriptContext')");
+            fail("should not reach here");
+        } catch (final ScriptException | RuntimeException se) {
+            if (! (se.getCause() instanceof ClassNotFoundException)) {
+                fail("ClassNotFoundException expected");
+            }
+        }
+    }
+
+    @Test
+    public void classFilterTest2() throws ScriptException {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine e = fac.getScriptEngine(new String[0], Thread.currentThread().getContextClassLoader(),
+            new ClassFilter() {
+                @Override
+                public boolean exposeToScripts(final String fullName) {
+                    // don't allow anything that is not "java."
+                    return fullName.startsWith("java.");
+                }
+            });
+
+        assertEquals(e.eval("typeof javax.script.ScriptEngine"), "object");
+        assertEquals(e.eval("typeof java.util.Vector"), "function");
+
+        try {
+            e.eval("Java.type('javax.script.ScriptContext')");
+            fail("should not reach here");
+        } catch (final ScriptException | RuntimeException se) {
+            if (! (se.getCause() instanceof ClassNotFoundException)) {
+                fail("ClassNotFoundException expected");
+            }
+        }
+    }
+
+    @Test
+    public void nullClassFilterTest() {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        try {
+            fac.getScriptEngine((ClassFilter)null);
+            fail("should have thrown NPE");
+        } catch (final NullPointerException e) {
+            //empty
+        }
+    }
+
+    @Test
+    public void nullClassFilterTest2() {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        try {
+            fac.getScriptEngine(new String[0], null, null);
+            fail("should have thrown NPE");
+        } catch (final NullPointerException e) {
+            //empty
+        }
+    }
+
+    @Test
+    public void nullArgsTest() {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        try {
+            fac.getScriptEngine((String[])null);
+            fail("should have thrown NPE");
+        } catch (final NullPointerException e) {
+            //empty
+        }
+    }
+
+    @Test
+    public void nullArgsTest2() {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        try {
+            fac.getScriptEngine(null, null, new ClassFilter() {
+                @Override
+                public boolean exposeToScripts(final String name) {
+                    return true;
+                }
+            });
+            fail("should have thrown NPE");
+        } catch (final NullPointerException e) {
+            //empty
+        }
+    }
+
+    @Test
+    public void nashornSwallowsConstKeyword() throws Exception {
+        final NashornScriptEngineFactory f = new NashornScriptEngineFactory();
+        final String[] args = new String[] { "--const-as-var" };
+        final ScriptEngine engine = f.getScriptEngine(args);
+
+        final Object ret = engine.eval(""
+            + "(function() {\n"
+            + "  const x = 10;\n"
+            + "  return x;\n"
+            + "})();"
+        );
+        assertEquals(ret, 10, "Parsed and executed OK");
+    }
+
+    @Test
+    public void evalDefaultFileNameTest() throws ScriptException {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine engine = fac.getScriptEngine(new String[] { "--verify-code=true" });
+        // default FILENAME being "<eval>" make sure generated code bytecode verifies.
+        engine.eval("var a = 3;");
+    }
+
+    @Test
+    public void evalFileNameWithSpecialCharsTest() throws ScriptException {
+        final NashornScriptEngineFactory fac = new NashornScriptEngineFactory();
+        final ScriptEngine engine = fac.getScriptEngine(new String[] { "--verify-code=true" });
+        final ScriptContext ctxt = new SimpleScriptContext();
+        // use file name with "dangerous" chars.
+        ctxt.setAttribute(ScriptEngine.FILENAME, "<myscript>", ScriptContext.ENGINE_SCOPE);
+        engine.eval("var a = 3;");
+        ctxt.setAttribute(ScriptEngine.FILENAME, "[myscript]", ScriptContext.ENGINE_SCOPE);
+        engine.eval("var h = 'hello';");
+        ctxt.setAttribute(ScriptEngine.FILENAME, ";/\\$.", ScriptContext.ENGINE_SCOPE);
+        engine.eval("var foo = 'world';");
+        // name used by jjs shell tool for the interactive mode
+        ctxt.setAttribute(ScriptEngine.FILENAME, "<shell>", ScriptContext.ENGINE_SCOPE);
+        engine.eval("var foo = 'world';");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/test/resources/load_test.js	Wed Jul 05 20:27:20 2017 +0200
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+function loadedFunc(arg) {
+    return arg.toUpperCase();
+}
--- a/test/lib/sun/hotspot/WhiteBox.java	Wed Apr 08 13:12:48 2015 -0700
+++ b/test/lib/sun/hotspot/WhiteBox.java	Wed Jul 05 20:27:20 2017 +0200
@@ -24,6 +24,7 @@
 
 package sun.hotspot;
 
+import java.lang.management.MemoryUsage;
 import java.lang.reflect.Executable;
 import java.util.Arrays;
 import java.util.List;
@@ -95,8 +96,10 @@
   // G1
   public native boolean g1InConcurrentMark();
   public native boolean g1IsHumongous(Object o);
+  public native long    g1NumMaxRegions();
   public native long    g1NumFreeRegions();
   public native int     g1RegionSize();
+  public native MemoryUsage g1AuxiliaryMemoryUsage();
   public native Object[]    parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
 
   // NMT