Merge JDK-8145252-TLS13-branch
authorxuelei
Fri, 08 Jun 2018 09:40:28 -0700
branchJDK-8145252-TLS13-branch
changeset 56707 929ac4f1cddd
parent 56706 a82a96b62d22 (current diff)
parent 50472 ee1a0ddb2590 (diff)
child 56708 25178bb3e8f5
Merge
src/hotspot/os_cpu/aix_ppc/orderAccess_aix_ppc.inline.hpp
src/hotspot/os_cpu/bsd_x86/orderAccess_bsd_x86.inline.hpp
src/hotspot/os_cpu/bsd_zero/orderAccess_bsd_zero.inline.hpp
src/hotspot/os_cpu/linux_aarch64/orderAccess_linux_aarch64.inline.hpp
src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.inline.hpp
src/hotspot/os_cpu/linux_ppc/orderAccess_linux_ppc.inline.hpp
src/hotspot/os_cpu/linux_s390/orderAccess_linux_s390.inline.hpp
src/hotspot/os_cpu/linux_sparc/orderAccess_linux_sparc.inline.hpp
src/hotspot/os_cpu/linux_x86/orderAccess_linux_x86.inline.hpp
src/hotspot/os_cpu/linux_zero/orderAccess_linux_zero.inline.hpp
src/hotspot/os_cpu/solaris_sparc/orderAccess_solaris_sparc.inline.hpp
src/hotspot/os_cpu/solaris_x86/orderAccess_solaris_x86.inline.hpp
src/hotspot/os_cpu/windows_x86/orderAccess_windows_x86.inline.hpp
src/hotspot/share/runtime/orderAccess.inline.hpp
src/java.base/aix/native/libjsig/jsig.c
src/java.desktop/macosx/native/libsplashscreen/libpng/zlib.h
src/java.sql.rowset/share/classes/javax/sql/rowset/package.html
src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/StringTable.java
src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/MissingRequiredOptionException.java
src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/UnacceptableNumberOfNonOptionsException.java
src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Objects.java
--- a/.hgtags	Thu Jun 07 23:12:35 2018 -0700
+++ b/.hgtags	Fri Jun 08 09:40:28 2018 -0700
@@ -488,3 +488,4 @@
 3595bd343b65f8c37818ebe6a4c343ddeb1a5f88 jdk-11+14
 a11c1cb542bbd1671d25b85efe7d09b983c48525 jdk-11+15
 02934b0d661b82b7fe1052a04998d2091352e08d jdk-11+16
+64e4b1686141e57a681936a8283983341484676e jdk-11+17
--- a/make/CompileJavaModules.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/CompileJavaModules.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -325,6 +325,10 @@
 
 ################################################################################
 
+jdk.internal.opt_COPY += .properties
+
+################################################################################
+
 jdk.jcmd_COPY += _options
 
 ################################################################################
--- a/make/common/JdkNativeCompilation.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/common/JdkNativeCompilation.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -32,6 +32,36 @@
 
 include NativeCompilation.gmk
 
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, common/JdkNativeCompilation.gmk))
+
+FindSrcDirsForLib += \
+  $(call uniq, $(wildcard \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+
+FindSrcDirsForComponent += \
+  $(call uniq, $(wildcard \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/$(strip $2) \
+      $(TOPDIR)/src/$(strip $1)/share/native/$(strip $2)))
+
+GetJavaHeaderDir = \
+  $(wildcard $(SUPPORT_OUTPUTDIR)/headers/$(strip $1))
+
+# Process a dir description such as "java.base:headers" into a set of proper absolute paths.
+ProcessDir = \
+  $(if $(findstring :, $1), \
+    $(call FindSrcDirsForComponent, $(firstword $(subst :, , $1)), $(lastword $(subst :, , $1))) \
+  , \
+    $(if $(filter /%, $1), \
+      $1 \
+    , \
+      $(call FindSrcDirsForComponent, $(MODULE), $1) \
+    ) \
+  )
+
 # Setup make rules for creating a native shared library with suitable defaults
 # for the OpenJDK project.
 #
@@ -39,8 +69,16 @@
 # and the targets generated are listed in a variable by that name.
 #
 # Remaining parameters are named arguments. These are all passed on to
-# SetupNativeCompilation, except for 
+# SetupNativeCompilation, except for
 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
+#   EXTRA_HEADER_DIRS -- additional directories to look for headers in
+#   EXTRA_SRC -- additional directories to look for source in
+#   EXCLUDE_SRC_PATTERNS -- exclude source dirs matching these patterns from
+#     appearing in SRC.
+#   HEADERS_FROM_SRC -- if false, does not add source dirs automatically as
+#     header include dirs. (Defaults to true.)
+#   SRC -- this is passed on, but preprocessed to accept source dir designations
+#     such as "java.base:headers".
 SetupJdkLibrary = $(NamedParamsMacroTemplate)
 define SetupJdkLibraryBody
   ifeq ($$($1_OUTPUT_DIR), )
@@ -51,6 +89,20 @@
     $1_OBJECT_DIR := $$(SUPPORT_OUTPUTDIR)/native/$$(MODULE)/lib$$($1_NAME)
   endif
 
+  ifeq ($$($1_SRC), )
+    $1_SRC := $$(call FindSrcDirsForLib, $$(MODULE), $$($1_NAME))
+  else
+    $1_SRC := $$(foreach dir, $$($1_SRC), $$(call ProcessDir, $$(dir)))
+  endif
+  ifneq ($$($1_EXTRA_SRC), )
+    $1_SRC += $$(foreach dir, $$($1_EXTRA_SRC), $$(call ProcessDir, $$(dir)))
+  endif
+
+  ifneq ($$($1_EXCLUDE_SRC_PATTERNS), )
+    $1_EXCLUDE_SRC := $$(call containing, $$($1_EXCLUDE_SRC_PATTERNS), $$($1_SRC))
+    $1_SRC := $$(filter-out $$($1_EXCLUDE_SRC), $$($1_SRC))
+  endif
+
   ifeq ($$($1_VERSIONINFO_RESOURCE), )
     $1_VERSIONINFO_RESOURCE := $$(GLOBAL_VERSION_INFO_RESOURCE)
   else ifeq ($$($1_VERSIONINFO_RESOURCE), DISABLE)
@@ -66,6 +118,25 @@
     $1_RC_FLAGS :=
   endif
 
+  ifneq ($$($1_HEADERS_FROM_SRC), false)
+    $1_SRC_HEADER_FLAGS := $$(foreach dir, $$(wildcard $$($1_SRC) \
+        $$(call GetJavaHeaderDir, $$(MODULE))), -I$$(dir))
+  endif
+  ifneq ($$($1_EXTRA_HEADER_DIRS), )
+    $1_PROCESSED_EXTRA_HEADER_DIRS := $$(foreach dir, $$($1_EXTRA_HEADER_DIRS), \
+        $$(call ProcessDir, $$(dir)))
+    $1_EXTRA_HEADER_FLAGS := $$(addprefix -I, $$($1_PROCESSED_EXTRA_HEADER_DIRS))
+  endif
+
+  ifneq ($$($1_CFLAGS), )
+    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
+  endif
+  ifneq ($$($1_CXXFLAGS), )
+    $1_CXXFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
+  endif
+  ifeq ($$($1_CFLAGS)$$($1_CXXFLAGS), )
+    $1_CFLAGS += $$($1_SRC_HEADER_FLAGS) $$($1_EXTRA_HEADER_FLAGS)
+  endif
   $1_RC_FLAGS += $$($1_EXTRA_RC_FLAGS)
 
   # Since we reuse the rule name ($1), all our arguments will pass through.
@@ -80,7 +151,7 @@
 # and the targets generated are listed in a variable by that name.
 #
 # Remaining parameters are named arguments. These are all passed on to
-# SetupNativeCompilation, except for 
+# SetupNativeCompilation, except for
 #   EXTRA_RC_FLAGS -- additional RC_FLAGS to append.
 SetupJdkExecutable = $(NamedParamsMacroTemplate)
 define SetupJdkExecutableBody
--- a/make/common/MakeBase.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/common/MakeBase.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -634,7 +634,7 @@
 ################################################################################
 # Filter out duplicate sub strings while preserving order. Keeps the first occurance.
 uniq = \
-    $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1)))
+    $(strip $(if $1,$(firstword $1) $(call uniq,$(filter-out $(firstword $1),$1))))
 
 # Returns all whitespace-separated words in $2 where at least one of the
 # whitespace-separated words in $1 is a substring.
--- a/make/conf/jib-profiles.js	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/conf/jib-profiles.js	Fri Jun 08 09:40:28 2018 -0700
@@ -233,7 +233,7 @@
     common.main_profile_names = [
         "linux-x64", "linux-x86", "macosx-x64", "solaris-x64",
         "solaris-sparcv9", "windows-x64", "windows-x86",
-        "linux-aarch64", "linux-arm64", "linux-arm-vfp-hflt",
+        "linux-aarch64", "linux-arm32", "linux-arm64", "linux-arm-vfp-hflt",
         "linux-arm-vfp-hflt-dyn"
     ];
 
@@ -490,6 +490,17 @@
             ],
         },
 
+        "linux-arm32": {
+            target_os: "linux",
+            target_cpu: "arm",
+            build_cpu: "x64",
+            dependencies: ["devkit", "autoconf", "build_devkit", "cups"],
+            configure_args: [
+                "--openjdk-target=arm-linux-gnueabihf", "--with-freetype=bundled",
+                "--with-abi-profile=arm-vfp-hflt", "--disable-warnings-as-errors"
+            ],
+        },
+
         "linux-arm-vfp-hflt": {
             target_os: "linux",
             target_cpu: "arm",
@@ -625,6 +636,9 @@
        "linux-aarch64": {
             platform: "linux-aarch64",
         },
+       "linux-arm32": {
+            platform: "linux-arm32",
+        },
        "linux-arm64": {
             platform: "linux-arm64-vfp-hflt",
         },
@@ -829,7 +843,11 @@
                     : "gcc7.3.0-Fedora27+1.0"),
         linux_arm: (input.profile != null && input.profile.indexOf("hflt") >= 0
                     ? "gcc-linaro-arm-linux-gnueabihf-raspbian-2012.09-20120921_linux+1.0"
-                    : "arm-linaro-4.7+1.0")
+                    : (input.profile.indexOf("arm32") >= 0
+                       ? "gcc7.3.0-Fedora27+1.0"
+                       : "arm-linaro-4.7+1.0"
+                       )
+                    )
     };
 
     var devkit_platform = (input.target_cpu == "x86"
--- a/make/data/currency/CurrencyData.properties	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/data/currency/CurrencyData.properties	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@
 # Version of the currency code information in this class.
 # It is a serial number that accompanies with each amendment.
 
-dataVersion=164
+dataVersion=167
 
 # List of all valid ISO 4217 currency codes.
 # To ensure compatibility, do not remove codes.
@@ -47,7 +47,7 @@
     HRK191-HTG332-HUF348-IDR360-IEP372-ILS376-INR356-IQD368-IRR364-ISK352-\
     ITL380-JMD388-JOD400-JPY392-KES404-KGS417-KHR116-KMF174-KPW408-KRW410-\
     KWD414-KYD136-KZT398-LAK418-LBP422-LKR144-LRD430-LSL426-LTL440-LUF442-\
-    LVL428-LYD434-MAD504-MDL498-MGA969-MGF450-MKD807-MMK104-MNT496-MOP446-MRO478-\
+    LVL428-LYD434-MAD504-MDL498-MGA969-MGF450-MKD807-MMK104-MNT496-MOP446-MRO478-MRU929-\
     MTL470-MUR480-MVR462-MWK454-MXN484-MXV979-MYR458-MZM508-MZN943-NAD516-NGN566-\
     NIO558-NLG528-NOK578-NPR524-NZD554-OMR512-PAB590-PEN604-PGK598-PHP608-\
     PKR586-PLN985-PTE620-PYG600-QAR634-ROL946-RON946-RSD941-RUB643-RUR810-RWF646-SAR682-\
@@ -324,7 +324,7 @@
 # LAO PEOPLE'S DEMOCRATIC REPUBLIC (THE)
 LA=LAK
 # LATVIA
-LV=LVL;2013-12-31-22-00-00;EUR
+LV=EUR
 # LEBANON
 LB=LBP
 # LESOTHO
@@ -336,7 +336,7 @@
 # LIECHTENSTEIN
 LI=CHF
 # LITHUANIA
-LT=LTL;2014-12-31-22-00-00;EUR
+LT=EUR
 # LUXEMBOURG
 LU=EUR
 # MACAU
@@ -360,7 +360,7 @@
 # MARTINIQUE
 MQ=EUR
 # MAURITANIA
-MR=MRO
+MR=MRU
 # MAURITIUS
 MU=MUR
 # MAYOTTE
--- a/make/data/lsrdata/language-subtag-registry.txt	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/data/lsrdata/language-subtag-registry.txt	Fri Jun 08 09:40:28 2018 -0700
@@ -1,4 +1,4 @@
-File-Date: 2017-08-15
+File-Date: 2018-04-23
 %%
 Type: language
 Subtag: aa
@@ -378,6 +378,7 @@
 Description: Armenian
 Added: 2005-10-16
 Suppress-Script: Armn
+Comments: see also hyw
 %%
 Type: language
 Subtag: hz
@@ -525,6 +526,7 @@
 %%
 Type: language
 Subtag: km
+Description: Khmer
 Description: Central Khmer
 Added: 2005-10-16
 Suppress-Script: Khmr
@@ -957,6 +959,7 @@
 Description: Serbian
 Added: 2005-10-16
 Macrolanguage: sh
+Comments: see cnr for Montenegrin
 %%
 Type: language
 Subtag: ss
@@ -1531,6 +1534,7 @@
 %%
 Type: language
 Subtag: add
+Description: Lidzonka
 Description: Dzodinka
 Added: 2009-07-29
 %%
@@ -2114,7 +2118,7 @@
 %%
 Type: language
 Subtag: aja
-Description: Aja (Sudan)
+Description: Aja (South Sudan)
 Added: 2009-07-29
 %%
 Type: language
@@ -3097,6 +3101,7 @@
 %%
 Type: language
 Subtag: asf
+Description: Auslan
 Description: Australian Sign Language
 Added: 2009-07-29
 %%
@@ -4240,7 +4245,7 @@
 %%
 Type: language
 Subtag: bdh
-Description: Baka (Sudan)
+Description: Baka (South Sudan)
 Added: 2009-07-29
 %%
 Type: language
@@ -4250,6 +4255,7 @@
 %%
 Type: language
 Subtag: bdj
+Description: Bai (South Sudan)
 Description: Bai
 Added: 2009-07-29
 %%
@@ -5293,7 +5299,7 @@
 %%
 Type: language
 Subtag: blm
-Description: Beli (Sudan)
+Description: Beli (South Sudan)
 Added: 2009-07-29
 %%
 Type: language
@@ -8104,6 +8110,13 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: cnr
+Description: Montenegrin
+Added: 2018-01-23
+Macrolanguage: sh
+Comments: see sr for Serbian
+%%
+Type: language
 Subtag: cns
 Description: Central Asmat
 Added: 2009-07-29
@@ -8768,6 +8781,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: cuy
+Description: Cuitlatec
+Added: 2018-03-08
+%%
+Type: language
 Subtag: cvg
 Description: Chug
 Added: 2009-07-29
@@ -11089,7 +11107,7 @@
 %%
 Type: language
 Subtag: fap
-Description: Palor
+Description: Paloor
 Added: 2009-07-29
 %%
 Type: language
@@ -12282,6 +12300,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: gkd
+Description: Magɨ (Madang Province)
+Added: 2018-03-08
+%%
+Type: language
 Subtag: gke
 Description: Ndai
 Added: 2009-07-29
@@ -12494,6 +12517,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: gnj
+Description: Ngen
+Added: 2018-03-08
+%%
+Type: language
 Subtag: gnk
 Description: //Gana
 Description: ǁGana
@@ -13224,6 +13252,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: gyo
+Description: Gyalsumdo
+Added: 2018-03-08
+%%
+Type: language
 Subtag: gyr
 Description: Guarayu
 Added: 2009-07-29
@@ -13584,6 +13617,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: hkn
+Description: Mel-Khaonh
+Added: 2018-03-08
+%%
+Type: language
 Subtag: hks
 Description: Hong Kong Sign Language
 Description: Heung Kong Sau Yue
@@ -14238,6 +14276,12 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: hyw
+Description: Western Armenian
+Added: 2018-03-08
+Comments: see also hy
+%%
+Type: language
 Subtag: hyx
 Description: Armenian (family)
 Added: 2009-07-29
@@ -14860,6 +14904,7 @@
 %%
 Type: language
 Subtag: iri
+Description: Rigwe
 Description: Irigwe
 Added: 2009-07-29
 %%
@@ -20313,7 +20358,7 @@
 %%
 Type: language
 Subtag: lno
-Description: Lango (Sudan)
+Description: Lango (South Sudan)
 Added: 2009-07-29
 %%
 Type: language
@@ -20579,6 +20624,7 @@
 Subtag: lsg
 Description: Lyons Sign Language
 Added: 2009-07-29
+Deprecated: 2018-03-08
 %%
 Type: language
 Subtag: lsh
@@ -20850,6 +20896,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: lws
+Description: Malawian Sign Language
+Added: 2018-03-08
+%%
+Type: language
 Subtag: lwt
 Description: Lewotobi
 Added: 2009-07-29
@@ -20904,6 +20955,7 @@
 Subtag: maa
 Description: San Jerónimo Tecóatl Mazatec
 Added: 2009-07-29
+Comments: see also pbm
 %%
 Type: language
 Subtag: mab
@@ -23799,11 +23851,13 @@
 Subtag: mwx
 Description: Mediak
 Added: 2009-07-29
+Deprecated: 2018-03-08
 %%
 Type: language
 Subtag: mwy
 Description: Mosiro
 Added: 2009-07-29
+Deprecated: 2018-03-08
 %%
 Type: language
 Subtag: mwz
@@ -24527,6 +24581,8 @@
 Subtag: ncp
 Description: Ndaktup
 Added: 2009-07-29
+Deprecated: 2018-03-08
+Preferred-Value: kdz
 %%
 Type: language
 Subtag: ncq
@@ -25458,6 +25514,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: nlm
+Description: Mankiyali
+Added: 2018-03-08
+%%
+Type: language
 Subtag: nln
 Description: Durango Nahuatl
 Added: 2009-07-29
@@ -26693,6 +26754,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: nzd
+Description: Nzadi
+Added: 2018-03-08
+%%
+Type: language
 Subtag: nzi
 Description: Nzima
 Added: 2005-10-16
@@ -27757,6 +27823,12 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: pbm
+Description: Puebla Mazatec
+Added: 2018-03-08
+Comments: see also maa
+%%
+Type: language
 Subtag: pbn
 Description: Kpasam
 Added: 2009-07-29
@@ -30902,6 +30974,7 @@
 %%
 Type: language
 Subtag: scp
+Description: Hyolmo
 Description: Helambu Sherpa
 Added: 2009-07-29
 %%
@@ -33049,6 +33122,7 @@
 %%
 Type: language
 Subtag: sxg
+Description: Shuhi
 Description: Shixing
 Added: 2009-07-29
 %%
@@ -33835,6 +33909,11 @@
 Added: 2009-07-29
 %%
 Type: language
+Subtag: tez
+Description: Tetserret
+Added: 2018-03-08
+%%
+Type: language
 Subtag: tfi
 Description: Tofin Gbe
 Added: 2009-07-29
@@ -34399,7 +34478,7 @@
 Type: language
 Subtag: tlh
 Description: Klingon
-Description: tlhIngan-Hol
+Description: tlhIngan Hol
 Added: 2005-10-16
 %%
 Type: language
@@ -42199,6 +42278,7 @@
 %%
 Type: extlang
 Subtag: asf
+Description: Auslan
 Description: Australian Sign Language
 Added: 2009-07-29
 Preferred-Value: asf
@@ -42927,7 +43007,7 @@
 Subtag: lsg
 Description: Lyons Sign Language
 Added: 2009-07-29
-Preferred-Value: lsg
+Deprecated: 2018-03-08
 Prefix: sgn
 %%
 Type: extlang
@@ -42983,6 +43063,13 @@
 Macrolanguage: lv
 %%
 Type: extlang
+Subtag: lws
+Description: Malawian Sign Language
+Added: 2018-03-08
+Preferred-Value: lws
+Prefix: sgn
+%%
+Type: extlang
 Subtag: lzh
 Description: Literary Chinese
 Added: 2009-07-29
@@ -44493,6 +44580,11 @@
 Added: 2006-10-17
 %%
 Type: script
+Subtag: Rohg
+Description: Hanifi Rohingya
+Added: 2017-12-13
+%%
+Type: script
 Subtag: Roro
 Description: Rongorongo
 Added: 2005-10-16
@@ -44563,6 +44655,16 @@
 Added: 2005-10-16
 %%
 Type: script
+Subtag: Sogd
+Description: Sogdian
+Added: 2017-12-13
+%%
+Type: script
+Subtag: Sogo
+Description: Old Sogdian
+Added: 2017-12-13
+%%
+Type: script
 Subtag: Sora
 Description: Sora Sompeng
 Added: 2011-01-07
@@ -46412,15 +46514,26 @@
   not brought into effect until 2009
 %%
 Type: variant
+Subtag: aranes
+Description: Aranese
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in the Val d'Aran
+%%
+Type: variant
 Subtag: arevela
 Description: Eastern Armenian
 Added: 2006-09-18
+Deprecated: 2018-03-24
+Preferred-Value: hy
 Prefix: hy
 %%
 Type: variant
 Subtag: arevmda
 Description: Western Armenian
 Added: 2006-09-18
+Deprecated: 2018-03-24
+Preferred-Value: hyw
 Prefix: hy
 %%
 Type: variant
@@ -46431,6 +46544,13 @@
 Prefix: tw
 %%
 Type: variant
+Subtag: auvern
+Description: Auvergnat
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in Auvergne
+%%
+Type: variant
 Subtag: baku1926
 Description: Unified Turkic Latin Alphabet (Historical)
 Added: 2007-04-18
@@ -46510,6 +46630,13 @@
 Comments: Jargon embedded in American English
 %%
 Type: variant
+Subtag: cisaup
+Description: Cisalpine
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in northwestern Italy
+%%
+Type: variant
 Subtag: colb1945
 Description: Portuguese-Brazilian Orthographic Convention of 1945
   (Convenção Ortográfica Luso-Brasileira de 1945)
@@ -46528,6 +46655,12 @@
 Prefix: en
 %%
 Type: variant
+Subtag: creiss
+Description: Occitan variants of the Croissant area
+Added: 2018-04-22
+Prefix: oc
+%%
+Type: variant
 Subtag: dajnko
 Description: Slovene in Dajnko alphabet
 Added: 2012-06-27
@@ -46556,6 +46689,11 @@
 Added: 2006-12-11
 %%
 Type: variant
+Subtag: fonkirsh
+Description: Kirshenbaum Phonetic Alphabet
+Added: 2018-04-22
+%%
+Type: variant
 Subtag: fonnapa
 Description: North American Phonetic Alphabet
 Description: Americanist Phonetic Notation
@@ -46573,6 +46711,36 @@
 Comments: Indicates that the content is transcribed according to X-SAMPA
 %%
 Type: variant
+Subtag: gascon
+Description: Gascon
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in Gascony
+%%
+Type: variant
+Subtag: grclass
+Description: Classical Occitan orthography
+Added: 2018-04-22
+Prefix: oc
+Comments: Classical written standard for Occitan developed in 1935 by
+  Alibèrt
+%%
+Type: variant
+Subtag: grital
+Description: Italian-inspired Occitan orthography
+Added: 2018-04-22
+Prefix: oc
+%%
+Type: variant
+Subtag: grmistr
+Description: Mistralian or Mistralian-inspired Occitan orthography
+Added: 2018-04-22
+Prefix: oc
+Comments: Written standard developed by Romanilha in 1853 and used by
+  Mistral and the Félibres, including derived standards such as Escolo
+  dóu Po, Escolo Gaston Febus, and others
+%%
+Type: variant
 Subtag: hepburn
 Description: Hepburn romanization
 Added: 2009-10-01
@@ -46617,6 +46785,13 @@
 Prefix: sa
 %%
 Type: variant
+Subtag: ivanchov
+Description: Bulgarian in 1899 orthography
+Added: 2017-12-13
+Prefix: bg
+Comments: Bulgarian orthography introduced by Todor Ivanchov in 1899
+%%
+Type: variant
 Subtag: jauer
 Description: Jauer dialect of Romansh
 Added: 2010-06-29
@@ -46659,6 +46834,20 @@
 Prefix: sa
 %%
 Type: variant
+Subtag: lemosin
+Description: Limousin
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in Limousin
+%%
+Type: variant
+Subtag: lengadoc
+Description: Languedocien
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in Languedoc
+%%
+Type: variant
 Subtag: lipaw
 Description: The Lipovaz dialect of Resian
 Description: The Lipovec dialect of Resian
@@ -46712,6 +46901,13 @@
 Prefix: en-CA
 %%
 Type: variant
+Subtag: nicard
+Description: Niçard
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in Nice
+%%
+Type: variant
 Subtag: njiva
 Description: The Gniva dialect of Resian
 Description: The Njiva dialect of Resian
@@ -46798,6 +46994,13 @@
 Prefix: el
 %%
 Type: variant
+Subtag: provenc
+Description: Provençal
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in Provence
+%%
+Type: variant
 Subtag: puter
 Description: Puter idiom of Romansh
 Added: 2010-06-29
@@ -46959,6 +47162,13 @@
   "idioms" of the Romansh language.
 %%
 Type: variant
+Subtag: vivaraup
+Description: Vivaro-Alpine
+Added: 2018-04-22
+Prefix: oc
+Comments: Occitan variant spoken in northeastern Occitania
+%%
+Type: variant
 Subtag: wadegile
 Description: Wade-Giles romanization
 Added: 2008-10-03
--- a/make/devkit/Makefile	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/devkit/Makefile	Fri Jun 08 09:40:28 2018 -0700
@@ -42,6 +42,8 @@
 # line looking like this:
 #
 # make cross_compile_target="aarch64-linux-gnu" BASE_OS=Fedora27
+# or
+# make cross_compile_target="arm-linux-gnueabihf" BASE_OS=Fedora27
 #
 # This is the makefile which iterates over all host and target platforms.
 #
--- a/make/devkit/Tools.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/devkit/Tools.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -44,13 +44,23 @@
 $(info BUILD=$(BUILD))
 
 ARCH := $(word 1,$(subst -, ,$(TARGET)))
+
+ifeq ($(TARGET), arm-linux-gnueabihf)
+  ARCH=armhfp
+endif
+
 $(info ARCH=$(ARCH))
 
 ifeq ($(BASE_OS), OEL6)
   OEL_URL := http://yum.oracle.com/repo/OracleLinux/OL6/4/base/$(ARCH)/
   LINUX_VERSION := OEL6.4
 else ifeq ($(BASE_OS), Fedora27)
-  OEL_URL := https://dl.fedoraproject.org/pub/fedora-secondary/releases/27/Everything/$(ARCH)/os/Packages/
+  ifeq ($(ARCH), aarch64)
+    FEDORA_TYPE=fedora-secondary
+  else
+    FEDORA_TYPE=fedora/linux
+  endif
+  OEL_URL := https://dl.fedoraproject.org/pub/$(FEDORA_TYPE)/releases/27/Everything/$(ARCH)/os/Packages/
   LINUX_VERSION := Fedora 27
 else
   $(error Unknown base OS $(BASE_OS))
@@ -189,6 +199,8 @@
   endif
 else ifeq ($(ARCH),i686)
   RPM_ARCHS := i386 i686 noarch
+else ifeq ($(ARCH), armhfp)
+  RPM_ARCHS := $(ARCH) armv7hl noarch
 else
   RPM_ARCHS := $(ARCH) noarch
 endif
@@ -410,6 +422,10 @@
   $(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG += --enable-__cxa_atexit
 endif
 
+ifeq ($(ARCH), armhfp)
+  $(BUILDDIR)/$(gcc_ver)/Makefile : CONFIG +=  --with-float=hard
+endif
+
 # Want:
 # c,c++
 # shared libs
--- a/make/gensrc/Gensrc-jdk.compiler.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/gensrc/Gensrc-jdk.compiler.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,6 +32,7 @@
     $(JAVAC_VERSION)))
 
 $(eval $(call SetupParseProperties,PARSE_PROPERTIES, \
-	com/sun/tools/javac/resources/compiler.properties))
+	com/sun/tools/javac/resources/compiler.properties \
+	com/sun/tools/javac/resources/launcher.properties))
 
 all: $(COMPILE_PROPERTIES) $(PARSE_PROPERTIES)
--- a/make/langtools/build.properties	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/langtools/build.properties	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,8 @@
                jdk.jshell
 
 langtools.resource.includes = \
-        com/sun/tools/javac/resources/compiler.properties
+        com/sun/tools/javac/resources/compiler.properties \
+        com/sun/tools/javac/resources/launcher.properties
 
 # Version info -- override as needed
 jdk.version = 9
--- a/make/lib/Awt2dLibraries.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Awt2dLibraries.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -27,37 +27,38 @@
 
 WIN_AWT_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt/awt.lib
 
+LIBAWT_DEFAULT_HEADER_DIRS := \
+    libawt/awt/image \
+    libawt/awt/image/cvutils \
+    libawt/java2d \
+    libawt/java2d/loops \
+    libawt/java2d/pipe \
+    #
+
 ################################################################################
 
-BUILD_LIBMLIB_SRC := $(TOPDIR)/src/java.desktop/share/native/libmlib_image \
-    $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
-BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
-    $(addprefix -I, $(BUILD_LIBMLIB_SRC)) \
-    -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libmlib_image
+# We must not include java.desktop/unix/native/libmlib_image, which is only
+# for usage by solaris-sparc in libmlib_image_v.
+BUILD_LIBMLIB_EXCLUDE_SRC_PATTERNS := unix
 
-BUILD_LIBMLIB_LDLIBS :=
-
-BUILD_LIBMLIB_CFLAGS += -DMLIB_NO_LIBSUNMATH
+BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES -DMLIB_NO_LIBSUNMATH
 
 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
   BUILD_LIBMLIB_CFLAGS += -DMLIB_OS64BIT
 endif
 
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  BUILD_LIBMLIB_LDLIBS += $(LIBM) $(LIBDL)
-endif
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE, \
     NAME := mlib_image, \
-    SRC := $(BUILD_LIBMLIB_SRC), \
+    EXTRA_SRC := common/awt/medialib, \
     EXCLUDE_FILES := mlib_c_ImageBlendTable.c, \
+    EXCLUDE_SRC_PATTERNS := $(BUILD_LIBMLIB_EXCLUDE_SRC_PATTERNS), \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(BUILD_LIBMLIB_CFLAGS), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LIBS := $(BUILD_LIBMLIB_LDLIBS) \
-        $(JDKLIB_LIBS), \
+    LIBS := $(JDKLIB_LIBS), \
+    LIBS_unix := $(LIBM) $(LIBDL), \
 ))
 
 $(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
@@ -68,14 +69,19 @@
 
 ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
 
-  LIBMLIB_IMAGE_V_SRC := $(TOPDIR)/src/java.desktop/share/native/libmlib_image \
-      $(TOPDIR)/src/java.desktop/unix/native/libmlib_image \
-      $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib \
-      $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \
-      #
-  LIBMLIB_IMAGE_V_CFLAGS := $(TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il \
-      $(addprefix -I, $(LIBMLIB_IMAGE_V_SRC)) \
-      #
+  # libmlib_image_v is basically built from mlib_image sources, with some additions
+  # and some exclusions.
+  LIBMLIB_IMAGE_V_SRC := \
+     libmlib_image \
+     common/awt/medialib \
+     #
+
+  LIBMLIB_IMAGE_V_CFLAGS := -xarch=sparcvis -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
+      $(TOPDIR)/src/$(MODULE)/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il
+
+  ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
+    LIBMLIB_IMAGE_V_CFLAGS += -DMLIB_OS64BIT
+  endif
 
   BUILD_LIBMLIB_IMAGE_V_EXFILES := \
       awt_ImagingLib.c \
@@ -95,19 +101,16 @@
       mlib_c_ImageLookUp_f.c \
       #
 
-  LIBMLIB_IMAGE_V_CFLAGS += $(filter-out -DMLIB_NO_LIBSUNMATH, $(BUILD_LIBMLIB_CFLAGS))
-
   $(eval $(call SetupJdkLibrary, BUILD_LIBMLIB_IMAGE_V, \
       NAME := mlib_image_v, \
       SRC := $(LIBMLIB_IMAGE_V_SRC), \
       EXCLUDE_FILES := $(BUILD_LIBMLIB_IMAGE_V_EXFILES), \
       OPTIMIZATION := HIGHEST, \
-      CFLAGS := -xarch=sparcvis \
-          $(LIBMLIB_IMAGE_V_CFLAGS) \
-          $(CFLAGS_JDKLIB), \
+      CFLAGS := $(CFLAGS_JDKLIB) \
+          $(LIBMLIB_IMAGE_V_CFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LIBS := -ljava -ljvm $(BUILD_LIBMLIB_LDLIBS), \
+      LIBS := -ljava -ljvm $(LIBM) $(LIBDL), \
   ))
 
   $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
@@ -118,18 +121,22 @@
 
 ################################################################################
 
-LIBAWT_DIRS := $(TOPDIR)/src/java.desktop/share/native/libawt \
-    $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
-    $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-    $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
+LIBAWT_EXTRA_SRC := \
+    common/awt/debug \
+    $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
     #
 
-ifeq ($(OPENJDK_TARGET_OS), aix)
-  LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
+  LIBAWT_EXTRA_SRC += $(TOPDIR)/src/$(MODULE)/share/native/common/awt/medialib
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/awt/utility
+  LIBAWT_EXTRA_SRC += \
+      $(TOPDIR)/src/$(MODULE)/share/native/common/awt/utility \
+      $(TOPDIR)/src/$(MODULE)/share/native/common/font \
+      $(TOPDIR)/src/$(MODULE)/share/native/common/java2d/opengl \
+      $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
+      #
 endif
 
 ifneq ($(filter $(OPENJDK_TARGET_OS), solaris linux macosx aix), )
@@ -140,33 +147,45 @@
   LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c
 endif
 
-LIBAWT_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-    $(addprefix -I, $(shell find $(LIBAWT_DIRS) -type d)) \
-    $(LIBJAVA_HEADER_FLAGS) \
-    $(addprefix -I, $(BUILD_LIBMLIB_IMAGE_SRC)) \
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  LIBAWT_EXFILES += \
+      java2d/d3d/D3DShaderGen.c \
+      awt/image/cvutils/img_colors.c \
+      #
+endif
+
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9)
+  LIBAWT_EXFILES += java2d/loops/MapAccelFunc.c
+else
+  LIBAWT_EXCLUDES += \
+      $(TOPDIR)/src/$(MODULE)/unix/native/libawt/awt/medialib \
+      $(TOPDIR)/src/$(MODULE)/unix/native/libawt/java2d/loops \
+      $(TOPDIR)/src/$(MODULE)/unix/native/common/awt/medialib \
+      #
+endif
+
+LIBAWT_EXTRA_HEADER_DIRS := \
+    $(LIBAWT_DEFAULT_HEADER_DIRS) \
+    $(call GetJavaHeaderDir, java.base) \
+    libawt/awt/medialib \
+    libawt/java2d/d3d \
+    libawt/java2d/opengl \
+    libawt/java2d/windows \
+    libawt/windows \
+    common/awt/medialib \
+    libmlib_image \
+    include \
+    java.base:libjava \
+    java.base:include \
     #
 
 LIBAWT_CFLAGS += -D__MEDIALIB_OLD_NAMES -D__USE_J2D_NAMES $(X_CFLAGS)
 
-ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
-  LIBAWT_CFLAGS += -DMLIB_ADD_SUFF
-  LIBAWT_CFLAGS += -xarch=sparcvis
-
-  LIBAWT_CFLAGS += $(TOPDIR)/src/java.desktop/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il
-  LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/awt/medialib
-  LIBAWT_EXFILES += java2d/loops/MapAccelFunc.c
+ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), solaris-sparcv9)
+  LIBAWT_CFLAGS += -xarch=sparcvis -DMLIB_ADD_SUFF \
+      $(TOPDIR)/src/$(MODULE)/unix/native/libmlib_image/vis_$(OPENJDK_TARGET_CPU_BITS).il
 
-  ifeq ($(OPENJDK_TARGET_CPU), sparcv9)
-    LIBAWT_ASFLAGS = -P -xarch=v9a
-  else
-    LIBAWT_ASFLAGS = -P -xarch=v8plusa
-  endif
-else
-  LIBAWT_EXCLUDES += \
-      $(TOPDIR)/src/java.desktop/unix/native/libawt/awt/medialib \
-      $(TOPDIR)/src/java.desktop/unix/native/libawt/java2d/loops \
-      $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib \
-      #
+  LIBAWT_ASFLAGS = -P -xarch=v9a
 endif
 
 ifneq ($(OPENJDK_TARGET_OS), solaris)
@@ -174,29 +193,13 @@
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  LIBAWT_DIRS += $(TOPDIR)/src/java.desktop/share/native/common/font \
-      $(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt/systemscale \
-  # Why does libawt need java.base headers?
-  LIBAWT_CFLAGS += -I$(TOPDIR)/src/java.desktop/share/native/common/font \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/windows/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/include \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-      #
-  LIBAWT_EXFILES += \
-      java2d/d3d/D3DShaderGen.c \
-      awt/image/cvutils/img_colors.c \
-      #
-
   LIBAWT_CFLAGS += -EHsc -DUNICODE -D_UNICODE
   ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
     LIBAWT_CFLAGS += -DMLIB_OS64BIT
   endif
 
   LIBAWT_RC_FLAGS ?= -I $(TOPDIR)/src/java.base/windows/native/launcher/icons
-  LIBAWT_VERSIONINFO_RESOURCE := $(TOPDIR)/src/java.desktop/windows/native/libawt/windows/awt.rc
+  LIBAWT_VERSIONINFO_RESOURCE := $(TOPDIR)/src/$(MODULE)/windows/native/libawt/windows/awt.rc
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), linux)
@@ -215,11 +218,12 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBAWT, \
     NAME := awt, \
-    SRC := $(LIBAWT_DIRS), \
+    EXTRA_SRC := $(LIBAWT_EXTRA_SRC), \
     EXCLUDES := $(LIBAWT_EXCLUDES), \
     EXCLUDE_FILES := $(LIBAWT_EXFILES), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_CFLAGS), \
+    EXTRA_HEADER_DIRS := $(LIBAWT_EXTRA_HEADER_DIRS), \
     DISABLED_WARNINGS_gcc := sign-compare unused-result maybe-uninitialized \
         format-nonliteral parentheses, \
     DISABLED_WARNINGS_clang := logical-op-parentheses extern-initializer, \
@@ -265,39 +269,26 @@
 
 ################################################################################
 
-ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
+ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx), )
   ifeq ($(ENABLE_HEADLESS_ONLY), false)
 
-    LIBAWT_XAWT_DIRS := \
-        $(wildcard $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libawt_xawt) \
-        $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
-        $(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-        $(TOPDIR)/src/java.desktop/share/native/common/awt/utility \
-        $(TOPDIR)/src/java.desktop/share/native/common/font \
-        $(TOPDIR)/src/java.desktop/share/native/common/java2d \
-        $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
-        $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
+    LIBAWT_XAWT_EXTRA_SRC := \
+        common/awt \
+        common/java2d \
+        common/font \
         #
 
-    ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
-      LIBAWT_XAWT_DIRS += $(TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
-    endif
-
     LIBAWT_XAWT_EXCLUDES := medialib
 
-    LIBAWT_XAWT_CFLAGS := $(addprefix -I, $(shell $(FIND) $(LIBAWT_XAWT_DIRS) -type d)) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-        -I$(TOPDIR)/src/java.desktop/share/native/include \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-        -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-        $(LIBJAVA_HEADER_FLAGS)
+    LIBAWT_XAWT_EXTRA_HEADER_DIRS := \
+        $(LIBAWT_DEFAULT_HEADER_DIRS) \
+        libawt_xawt/awt \
+        include \
+        common/awt/debug \
+        common/awt/systemscale \
+        common/font \
+        common/java2d/opengl \
+        common/java2d/x11 \
         #
 
     LIBAWT_XAWT_CFLAGS += -DXAWT -DXAWT_HACK \
@@ -334,7 +325,8 @@
 
     $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_XAWT, \
         NAME := awt_xawt, \
-        SRC := $(LIBAWT_XAWT_DIRS), \
+        EXTRA_SRC := $(LIBAWT_XAWT_EXTRA_SRC), \
+        EXTRA_HEADER_DIRS := $(LIBAWT_XAWT_EXTRA_HEADER_DIRS), \
         EXCLUDES := $(LIBAWT_XAWT_EXCLUDES), \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBAWT_XAWT_CFLAGS) \
@@ -350,10 +342,6 @@
             $(call SET_SHARED_LIBRARY_ORIGIN) \
             -L$(INSTALL_LIBRARIES_HERE), \
         LIBS :=  $(X_LIBS) $(LIBAWT_XAWT_LIBS), \
-        RC_FLAGS := $(RC_FLAGS) \
-            -D "JDK_FNAME=xawt.dll" \
-            -D "JDK_INTERNAL_NAME=xawt" \
-            -D "JDK_FTYPE=0x2L", \
     ))
 
     $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
@@ -367,36 +355,34 @@
 
 ################################################################################
 
-LIBLCMS_SRC := $(TOPDIR)/src/java.desktop/share/native/liblcms
-LIBLCMS_CPPFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-    -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-    -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-    $(LIBJAVA_HEADER_FLAGS) \
-    #
 # The fast floor code loses precision.
 LCMS_CFLAGS=-DCMS_DONT_USE_FAST_FLOOR
 
+LCMS_CFLAGS_JDKLIB := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB))
+
 ifeq ($(USE_EXTERNAL_LCMS), true)
   # If we're using an external library, we'll just need the wrapper part.
   # By including it explicitly, all other files will be excluded.
   BUILD_LIBLCMS_INCLUDE_FILES := LCMS.c
+  # If we're using an external library, we can't include our own SRC path
+  # as includes, instead the system headers should be used.
+  LIBLCMS_HEADERS_FROM_SRC := false
 else
   BUILD_LIBLCMS_INCLUDE_FILES :=
-  # If we're using the bundled library, we'll need to include it in the
-  # include path explicitly. Otherwise the system headers will be used.
-  LIBLCMS_CPPFLAGS += $(addprefix -I, $(LIBLCMS_SRC))
 endif
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \
     NAME := lcms, \
-    SRC := $(LIBLCMS_SRC), \
     INCLUDE_FILES := $(BUILD_LIBLCMS_INCLUDE_FILES), \
     OPTIMIZATION := HIGHEST, \
-    CFLAGS := $(filter-out -xc99=%none, $(CFLAGS_JDKLIB)) \
-        $(LIBLCMS_CPPFLAGS) \
+    CFLAGS := $(LCMS_CFLAGS_JDKLIB) \
         $(LCMS_CFLAGS), \
     CFLAGS_solaris := -xc99=no_lib, \
     CFLAGS_windows := -DCMS_IS_WINDOWS_, \
+    EXTRA_HEADER_DIRS := \
+        common/awt/debug \
+        libawt/java2d, \
+    HEADERS_FROM_SRC := $(LIBLCMS_HEADERS_FROM_SRC), \
     DISABLED_WARNINGS_gcc := format-nonliteral type-limits misleading-indentation, \
     DISABLED_WARNINGS_clang := tautological-compare, \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
@@ -414,8 +400,6 @@
 
 ################################################################################
 
-LIBJAVAJPEG_SRC += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
-
 # "DISABLED_WARNINGS_gcc := clobbered" rationale:
 # Suppress gcc warnings like "variable might be clobbered by 'longjmp'
 # or 'vfork'": this warning indicates that some variable is placed to
@@ -429,21 +413,20 @@
   BUILD_LIBJAVAJPEG_INCLUDE_FILES := \
       imageioJPEG.c \
       jpegdecoder.c
-  BUILD_LIBJAVAJPEG_HEADERS :=
+  # If we're using an external library, we can't include our own SRC path
+  # as includes, instead the system headers should be used.
+  LIBJPEG_HEADERS_FROM_SRC := false
 else
   LIBJPEG_LIBS :=
   BUILD_LIBJAVAJPEG_INCLUDE_FILES :=
-  BUILD_LIBJAVAJPEG_HEADERS := $(addprefix -I, $(LIBJAVAJPEG_SRC))
 endif
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBJAVAJPEG, \
     NAME := javajpeg, \
-    SRC := $(LIBJAVAJPEG_SRC), \
     INCLUDE_FILES := $(BUILD_LIBJAVAJPEG_INCLUDE_FILES), \
     OPTIMIZATION := HIGHEST, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBJAVAJPEG_HEADERS) \
-        $(LIBJAVA_HEADER_FLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+    CFLAGS := $(CFLAGS_JDKLIB), \
+    HEADERS_FROM_SRC := $(LIBJPEG_HEADERS_FROM_SRC), \
     DISABLED_WARNINGS_gcc := clobbered implicit-fallthrough shift-negative-value, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -460,42 +443,32 @@
 # Mac and Windows only use the native AWT lib, do not build libawt_headless
 ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
 
-  LIBAWT_HEADLESS_DIRS := $(TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d \
-      $(TOPDIR)/src/java.desktop/share/native/common/java2d \
-      $(TOPDIR)/src/java.desktop/share/native/common/font \
+  LIBAWT_HEADLESS_EXTRA_SRC := \
+      common/font \
+      common/java2d \
+      $(TOPDIR)/src/$(MODULE)/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
       #
 
   LIBAWT_HEADLESS_EXCLUDES := medialib
-  LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/font \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
-      $(LIBJAVA_HEADER_FLAGS) \
+
+  LIBAWT_HEADLESS_EXTRA_HEADER_DIRS := \
+      $(LIBAWT_DEFAULT_HEADER_DIRS) \
+      common/awt/debug \
+      common/font \
+      common/java2d/opengl \
       #
 
+  LIBAWT_HEADLESS_CFLAGS := $(CUPS_CFLAGS) $(FONTCONFIG_CFLAGS) $(X_CFLAGS) \
+      -DHEADLESS=true -DPACKAGE_PATH=\"$(PACKAGE_PATH)\"
+
   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_HEADLESS, \
       NAME := awt_headless, \
-      SRC := $(LIBAWT_HEADLESS_DIRS), \
+      EXTRA_SRC := $(LIBAWT_HEADLESS_EXTRA_SRC), \
       EXCLUDES := $(LIBAWT_HEADLESS_EXCLUDES), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
-          -DHEADLESS=true \
-          -DPACKAGE_PATH=\"$(PACKAGE_PATH)\" \
-          $(CUPS_CFLAGS) \
-          $(FONTCONFIG_CFLAGS) \
-          $(X_CFLAGS) \
           $(LIBAWT_HEADLESS_CFLAGS), \
+      EXTRA_HEADER_DIRS := $(LIBAWT_HEADLESS_EXTRA_HEADER_DIRS), \
       DISABLED_WARNINGS_xlc := 1506-356, \
       DISABLED_WARNINGS_solstudio := E_EMPTY_TRANSLATION_UNIT, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -519,12 +492,15 @@
 ################################################################################
 
 ifeq ($(FREETYPE_TO_USE), system)
+  # For use by libfontmanager:
   LIBFREETYPE_CFLAGS := $(FREETYPE_CFLAGS)
   LIBFREETYPE_LIBS := $(FREETYPE_LIBS)
 else
-  LIBFREETYPE_SRC := $(TOPDIR)/src/java.desktop/share/native/libfreetype
-  BUILD_LIBFREETYPE_HEADERS := $(addprefix -I, $(LIBFREETYPE_SRC)/include)
-  LIBFREETYPE_CFLAGS := $(BUILD_LIBFREETYPE_HEADERS)
+  BUILD_LIBFREETYPE_HEADER_DIRS := $(TOPDIR)/src/$(MODULE)/share/native/libfreetype/include
+  BUILD_LIBFREETYPE_CFLAGS := -DFT2_BUILD_LIBRARY $(EXPORT_ALL_SYMBOLS)
+
+  # For use by libfontmanager:
+  LIBFREETYPE_CFLAGS := -I$(BUILD_LIBFREETYPE_HEADER_DIRS)
   ifeq ($(OPENJDK_TARGET_OS), windows)
     LIBFREETYPE_LIBS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfreetype/freetype.lib
   else
@@ -533,10 +509,10 @@
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBFREETYPE, \
       NAME := freetype, \
-      SRC := $(LIBFREETYPE_SRC)/src, \
       OPTIMIZATION := HIGHEST, \
-      CFLAGS := $(CFLAGS_JDKLIB) $(BUILD_LIBFREETYPE_HEADERS) \
-          -DFT2_BUILD_LIBRARY $(EXPORT_ALL_SYMBOLS), \
+      CFLAGS := $(CFLAGS_JDKLIB) \
+          $(BUILD_LIBFREETYPE_CFLAGS), \
+      EXTRA_HEADER_DIRS := $(BUILD_LIBFREETYPE_HEADER_DIRS), \
       DISABLED_WARNINGS_solstudio := \
          E_STATEMENT_NOT_REACHED \
          E_END_OF_LOOP_CODE_NOT_REACHED, \
@@ -550,19 +526,6 @@
 
 ###########################################################################
 
-LIBFONTMANAGER_SRC := $(TOPDIR)/src/java.desktop/share/native/libfontmanager \
-    $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
-LIBFONTMANAGER_CFLAGS := \
-    $(addprefix -I, $(shell $(FIND) \
-      $(LIBFONTMANAGER_SRC) \
-      $(TOPDIR)/src/java.desktop/share/native/libawt \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
-      $(TOPDIR)/src/java.desktop/share/native/common \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-    $(LIBJAVA_HEADER_FLAGS) \
-    #
-
 #### Begin harfbuzz configuration
 
 HARFBUZZ_CFLAGS := -DHAVE_OT -DHAVE_FALLBACK -DHAVE_UCDN
@@ -590,6 +553,16 @@
 
 #### End harfbuzz configuration
 
+LIBFONTMANAGER_EXTRA_HEADER_DIRS := \
+    libfontmanager/harfbuzz \
+    libfontmanager/harfbuzz/hb-ucdn \
+    common/awt \
+    common/font \
+    libawt/java2d \
+    libawt/java2d/pipe \
+    libawt/java2d/loops \
+    #
+
 LIBFONTMANAGER_CFLAGS += $(LIBFREETYPE_CFLAGS)
 BUILD_LIBFONTMANAGER_FONTLIB += $(LIBFREETYPE_LIBS)
 
@@ -599,7 +572,6 @@
   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
       X11TextRenderer.c
   LIBFONTMANAGER_OPTIMIZATION := HIGHEST
-  LIBFONTMANAGER_CFLAGS += -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows
 else ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
       X11TextRenderer.c \
@@ -610,7 +582,7 @@
       lcdglyph.c
 endif
 
-LIBFONTMANAGER_CFLAGS += $(FONT_HEADERS) $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
+LIBFONTMANAGER_CFLAGS += $(X_CFLAGS) -DLE_STANDALONE -DHEADLESS
 
 ifeq ($(TOOLCHAIN_TYPE), gcc)
   # Turn off all warnings for sunFont.c. This is needed because the specific warning
@@ -626,7 +598,6 @@
 #   libawt_xawt). See JDK-8196516 for details.
 $(eval $(call SetupJdkLibrary, BUILD_LIBFONTMANAGER, \
     NAME := fontmanager, \
-    SRC := $(LIBFONTMANAGER_SRC), \
     EXCLUDE_FILES := $(LIBFONTMANAGER_EXCLUDE_FILES) \
         AccelGlyphCache.c, \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
@@ -634,6 +605,7 @@
     CXXFLAGS := $(CXXFLAGS_JDKLIB) $(LIBFONTMANAGER_CFLAGS), \
     OPTIMIZATION := $(LIBFONTMANAGER_OPTIMIZATION), \
     CFLAGS_windows = -DCC_NOEX, \
+    EXTRA_HEADER_DIRS := $(LIBFONTMANAGER_EXTRA_HEADER_DIRS), \
     WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := sign-compare int-to-pointer-cast \
         type-limits missing-field-initializers implicit-fallthrough, \
@@ -665,7 +637,7 @@
 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  $(BUILD_LIBFONTMANAGER): $(call FindLib, java.desktop, awt_lwawt)
+  $(BUILD_LIBFONTMANAGER): $(call FindLib, $(MODULE), awt_lwawt)
 endif
 
 ifeq ($(FREETYPE_TO_USE), bundled)
@@ -677,29 +649,30 @@
 ################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
-  LIBJAWT_CFLAGS := -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      -I$(TOPDIR)/src/java.desktop/windows/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/include \
-      $(LIBJAVA_HEADER_FLAGS) \
+
+  LIBJAWT_CFLAGS := -EHsc -DUNICODE -D_UNICODE
+
+  LIBJAWT_EXTRA_HEADER_DIRS := \
+      include \
+      common/awt/debug \
+      libawt/awt/image/cvutils \
+      libawt/java2d \
+      libawt/java2d/windows \
+      libawt/windows \
+      java.base:include \
+      java.base:libjava \
       #
 
   ifeq ($(OPENJDK_TARGET_CPU), x86)
     KERNEL32_LIB := kernel32.lib
   endif
+
   $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
       NAME := jawt, \
-      SRC := $(LIBJAWT_SRC), \
-      INCLUDE_FILES := $(LIBJAWT_INCLUDE_FILES), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CXXFLAGS_JDKLIB) \
-          -EHsc -DUNICODE -D_UNICODE \
           $(LIBJAWT_CFLAGS), \
+      EXTRA_HEADER_DIRS := $(LIBJAWT_EXTRA_HEADER_DIRS), \
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
       LIBS := $(JDKLIB_LIBS) $(KERNEL32_LIB) advapi32.lib $(WIN_AWT_LIB), \
   ))
@@ -718,17 +691,9 @@
 else # OPENJDK_TARGET_OS not windows
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libjawt
-  else
-    LIBJAWT_SRC := $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
+    # libjawt on macosx do not use the unix code
+    LIBJAWT_EXCLUDE_SRC_PATTERNS := unix
   endif
-  LIBJAWT_CFLAGS := \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
-      -I$(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/include \
-      $(LIBJAVA_HEADER_FLAGS) \
-      #
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     JAWT_LIBS := -lawt_lwawt
@@ -741,19 +706,22 @@
       JAWT_LIBS += -lawt_xawt
     else
       JAWT_LIBS += -lawt_headless
-      HEADLESS_CFLAG += -DHEADLESS
+      ifeq ($(OPENJDK_TARGET_OS), linux)
+        JAWT_CFLAGS += -DHEADLESS
+      endif
     endif
   endif
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBJAWT, \
       NAME := jawt, \
-      SRC := $(LIBJAWT_SRC), \
+      EXCLUDE_SRC_PATTERNS := $(LIBJAWT_EXCLUDE_SRC_PATTERNS), \
       INCLUDE_FILES := $(JAWT_FILES), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
-          $(LIBJAWT_CFLAGS), \
-      CFLAGS_linux := $(HEADLESS_CFLAG), \
-      CFLAGS_macosx := $(LIBJAWT_CFLAGS_macosx), \
+          $(JAWT_CFLAGS), \
+      EXTRA_HEADER_DIRS := \
+          include \
+          common/awt, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
@@ -781,52 +749,56 @@
 
 ifeq ($(ENABLE_HEADLESS_ONLY), false)
 
-  LIBSPLASHSCREEN_DIRS := \
-      $(TOPDIR)/src/java.desktop/share/native/libjavajpeg \
-      $(TOPDIR)/src/java.desktop/share/native/libsplashscreen \
+  LIBSPLASHSCREEN_EXTRA_SRC := \
+      common/awt/systemscale \
       #
 
-  ifeq ($(USE_EXTERNAL_LIBGIF), true)
-    GIFLIB_LIBS := -lgif
+  ifeq ($(USE_EXTERNAL_LIBGIF), false)
+    LIBSPLASHSCREEN_HEADER_DIRS += libsplashscreen/giflib
+  else
     LIBSPLASHSCREEN_EXCLUDES := giflib
-  else
-    LIBSPLASHSCREEN_CFLAGS += -I$(TOPDIR)/src/java.desktop/share/native/libsplashscreen/giflib
+    GIFLIB_LIBS := -lgif
   endif
 
-  ifeq ($(USE_EXTERNAL_LIBJPEG), true)
-    LIBJPEG_LIBS := -ljpeg
+  ifeq ($(USE_EXTERNAL_LIBJPEG), false)
+    # While the following ought to work, it will currently pull in the closed
+    # additions to this library, and this was not done previously in the build.
+    # LIBSPLASHSCREEN_EXTRA_SRC += libjavajpeg
+    LIBSPLASHSCREEN_EXTRA_SRC += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
   else
-    LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/share/native/libjavajpeg
-    LIBJPEG_CFLAGS := -I$(TOPDIR)/src/java.desktop/share/native/libjavajpeg
+    LIBJPEG_LIBS := -ljpeg
   endif
 
   ifeq ($(USE_EXTERNAL_LIBPNG), false)
-    LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/share/native/libsplashscreen/libpng
+    LIBSPLASHSCREEN_HEADER_DIRS += libsplashscreen/libpng
+
+    ifeq ($(OPENJDK_TARGET_OS), macosx)
+      ifeq ($(USE_EXTERNAL_LIBZ), true)
+        # When building our own libpng and using an external libz, we need to
+        # inject our own libz.h to tweak the exported ZLIB_VERNUM macro. See
+        # $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng/zlibwrapper/zlib.h
+        # for details. This must be specified with -iquote, not -I to avoid a
+        # circular include.
+        LIBSPLASHSCREEN_CFLAGS += -iquote $(TOPDIR)/src/$(MODULE)/macosx/native/libsplashscreen/libpng/zlibwrapper
+      endif
+    endif
   else
     LIBSPLASHSCREEN_EXCLUDES += libpng
   endif
 
-  ifneq ($(OPENJDK_TARGET_OS), macosx)
-    LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen
-  else
-    LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen
+  ifeq ($(USE_EXTERNAL_LIBZ), false)
+    LIBSPLASHSCREEN_EXTRA_SRC += java.base:libzip/zlib
   endif
 
-  ifneq ($(filter $(OPENJDK_TARGET_OS),linux solaris aix), )
-    LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/unix/native/common/awt/systemscale
+  ifeq ($(OPENJDK_TARGET_OS), macosx)
+    # libsplashscreen on macosx do not use the unix code
+    LIBSPLASHSCREEN_EXCLUDE_SRC_PATTERNS := unix
   endif
 
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-    LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.desktop/windows/native/common/awt/systemscale
-  endif
-  LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0 \
-      $(addprefix -I, $(LIBSPLASHSCREEN_DIRS)) \
-      $(LIBJAVA_HEADER_FLAGS) \
-      #
+  LIBSPLASHSCREEN_CFLAGS += -DSPLASHSCREEN -DPNG_NO_MMX_CODE -DPNG_ARM_NEON_OPT=0
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     LIBSPLASHSCREEN_CFLAGS += -DWITH_MACOSX
-    LIBSPLASHSCREEN_CFLAGS += -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp
 
     BUILD_LIBSPLASHSCREEN_java_awt_SplashScreen.c_CFLAGS := -x objective-c -O0
     BUILD_LIBSPLASHSCREEN_splashscreen_gfx_impl.c_CFLAGS := -x objective-c -O0
@@ -844,20 +816,6 @@
 
   LIBSPLASHSCREEN_LIBS :=
 
-  ifeq ($(USE_EXTERNAL_LIBZ), false)
-    LIBSPLASHSCREEN_DIRS += $(TOPDIR)/src/java.base/share/native/libzip/zlib
-  else
-    ifeq ($(OPENJDK_TARGET_OS), macosx)
-      ifeq ($(USE_EXTERNAL_LIBPNG), false)
-        # When building our own libpng and using an external libz, we need to
-        # inject our own libz.h to tweak the exported ZLIB_VERNUM macro. See
-        # $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng/zlib.h
-        # for details.
-        LIBSPLASHSCREEN_CFLAGS += -iquote $(TOPDIR)/src/java.desktop/macosx/native/libsplashscreen/libpng
-      endif
-    endif
-  endif
-
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     LIBSPLASHSCREEN_LIBS += \
         $(LIBM) -lpthread -liconv -losxapp \
@@ -871,14 +829,22 @@
     LIBSPLASHSCREEN_LIBS += $(X_LIBS) -lX11 -lXext $(LIBM) -lpthread -ldl
   endif
 
+  LIBSPLASHSCREEN_HEADER_DIRS += \
+      libosxapp \
+      java.base:include \
+      java.base:libjava \
+      #
+
   $(eval $(call SetupJdkLibrary, BUILD_LIBSPLASHSCREEN, \
       NAME := splashscreen, \
-      SRC := $(LIBSPLASHSCREEN_DIRS), \
+      EXTRA_SRC := $(LIBSPLASHSCREEN_EXTRA_SRC), \
+      EXCLUDE_SRC_PATTERNS := $(LIBSPLASHSCREEN_EXCLUDE_SRC_PATTERNS), \
       EXCLUDE_FILES := imageioJPEG.c jpegdecoder.c pngtest.c, \
       EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(LIBSPLASHSCREEN_CFLAGS) $(CFLAGS_JDKLIB) \
+      CFLAGS := $(CFLAGS_JDKLIB) $(LIBSPLASHSCREEN_CFLAGS) \
           $(GIFLIB_CFLAGS) $(LIBJPEG_CFLAGS) $(PNG_CFLAGS) $(LIBZ_CFLAGS), \
+      EXTRA_HEADER_DIRS := $(LIBSPLASHSCREEN_HEADER_DIRS), \
       DISABLED_WARNINGS_gcc := sign-compare type-limits unused-result \
           maybe-uninitialized shift-negative-value implicit-fallthrough, \
       DISABLED_WARNINGS_clang := incompatible-pointer-types, \
@@ -897,7 +863,7 @@
   TARGETS += $(BUILD_LIBSPLASHSCREEN)
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    $(BUILD_LIBSPLASHSCREEN): $(call FindLib, java.desktop, osxapp)
+    $(BUILD_LIBSPLASHSCREEN): $(call FindLib, $(MODULE), osxapp)
   endif
 
 endif
@@ -906,49 +872,38 @@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
-  LIBAWT_LWAWT_DIRS := \
-      $(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt \
-      $(TOPDIR)/src/java.desktop/unix/native/common/awt \
-      $(TOPDIR)/src/java.desktop/share/native/common/font \
-      $(TOPDIR)/src/java.desktop/share/native/common/java2d \
+  LIBAWT_LWAWT_EXTRA_SRC := \
+      $(TOPDIR)/src/$(MODULE)/unix/native/common/awt \
+      $(TOPDIR)/src/$(MODULE)/share/native/common/font \
+      $(TOPDIR)/src/$(MODULE)/share/native/common/java2d \
       #
 
-  LIBAWT_LWAWT_CFLAGS := \
-      $(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
-      -I$(TOPDIR)/src/java.desktop/unix/native/libawt_xawt/awt \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/font \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-      -I$(TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/unix/native/libawt/java2d \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
-      -I$(TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
-      -I$(TOPDIR)/src/java.desktop/share/native/libmlib_image/ \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
-      $(LIBJAVA_HEADER_FLAGS) \
+  LIBAWT_LWAWT_EXTRA_HEADER_DIRS := \
+      $(LIBAWT_DEFAULT_HEADER_DIRS) \
+      libawt_lwawt/awt \
+      libawt_lwawt/font \
+      libawt_lwawt/java2d/opengl \
+      include \
+      common/awt/debug \
+      common/java2d/opengl \
+      libosxapp \
       #
 
+  LIBAWT_LWAWT_CFLAGS := $(X_CFLAGS) $(X_LIBS)
+
   LIBAWT_LWAWT_EXFILES := fontpath.c awt_Font.c X11Color.c
-  LIBAWT_LWAWT_EXCLUDES := $(TOPDIR)/src/java.desktop/unix/native/common/awt/medialib
+  LIBAWT_LWAWT_EXCLUDES := $(TOPDIR)/src/$(MODULE)/unix/native/common/awt/medialib
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBAWT_LWAWT, \
       NAME := awt_lwawt, \
-      SRC := $(LIBAWT_LWAWT_DIRS), \
+      EXTRA_SRC := $(LIBAWT_LWAWT_EXTRA_SRC), \
       INCLUDE_FILES := $(LIBAWT_LWAWT_FILES), \
       EXCLUDE_FILES := $(LIBAWT_LWAWT_EXFILES), \
       EXCLUDES := $(LIBAWT_LWAWT_EXCLUDES), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
-          $(X_CFLAGS) \
-          $(X_LIBS) \
           $(LIBAWT_LWAWT_CFLAGS), \
+      EXTRA_HEADER_DIRS := $(LIBAWT_LWAWT_EXTRA_HEADER_DIRS), \
       DISABLED_WARNINGS_clang := incomplete-implementation enum-conversion \
           deprecated-declarations objc-method-access bitwise-op-parentheses \
           incompatible-pointer-types parentheses-equality extra-tokens, \
@@ -975,7 +930,7 @@
 
   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBMLIB_IMAGE)
 
-  $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.desktop, osxapp)
+  $(BUILD_LIBAWT_LWAWT): $(call FindLib, $(MODULE), osxapp)
 
   $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
 
@@ -987,15 +942,11 @@
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBOSXUI, \
       NAME := osxui, \
-      SRC := $(TOPDIR)/src/java.desktop/macosx/native/libosxui, \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) \
-          -I$(TOPDIR)/src/java.desktop/macosx/native/libosxui \
-          -I$(TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
-          -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
-          -I$(TOPDIR)/src/java.base/share/native/libjava \
-          -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-          -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop,  \
+      CFLAGS := $(CFLAGS_JDKLIB), \
+      EXTRA_HEADER_DIRS := \
+          libawt_lwawt/awt \
+          libosxapp, \
       DISABLED_WARNINGS_clang := deprecated-declarations, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
@@ -1014,7 +965,7 @@
 
   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
 
-  $(BUILD_LIBOSXUI): $(call FindLib, java.desktop, osxapp)
+  $(BUILD_LIBOSXUI): $(call FindLib, $(MODULE), osxapp)
 
   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
 
--- a/make/lib/CoreLibraries.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/CoreLibraries.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -104,7 +104,6 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBVERIFY, \
     NAME := verify, \
-    SRC := $(TOPDIR)/src/java.base/share/native/libverify, \
     OPTIMIZATION := $(LIBVERIFY_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
@@ -119,13 +118,7 @@
 
 ##########################################################################################
 
-# Allow a custom makefile to add extra src dirs
-LIBJAVA_SRC_DIRS += $(call FindSrcDirsForLib, java.base, java)
-
-LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-    -I$(TOPDIR)/src/java.base/share/native/libfdlibm \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-    -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
+LIBJAVA_CFLAGS := -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
@@ -134,12 +127,12 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBJAVA, \
     NAME := java, \
-    SRC := $(LIBJAVA_SRC_DIRS), \
     OPTIMIZATION := HIGH, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(LIBJAVA_CFLAGS), \
     System.c_CFLAGS := $(VERSION_CFLAGS), \
     jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
+    EXTRA_HEADER_DIRS := libfdlibm, \
     WARNINGS_AS_ERRORS_xlc := false, \
     DISABLED_WARNINGS_gcc := unused-result, \
     DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
@@ -180,13 +173,9 @@
 $(eval $(call SetupJdkLibrary, BUILD_LIBZIP, \
     NAME := zip, \
     OPTIMIZATION := LOW, \
-    SRC := $(TOPDIR)/src/java.base/share/native/libzip, \
     EXCLUDES := $(LIBZIP_EXCLUDES), \
     CFLAGS := $(CFLAGS_JDKLIB) \
-        $(LIBZ_CFLAGS) \
-        -I$(TOPDIR)/src/java.base/share/native/libjava \
-        -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
+        $(LIBZ_CFLAGS), \
     CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -200,22 +189,12 @@
 
 ##########################################################################################
 
-JIMAGELIB_CPPFLAGS := \
-    -I$(TOPDIR)/src/java.base/share/native/libjava \
-    -I$(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
-    -I$(TOPDIR)/src/java.base/share/native/libjimage \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-    #
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBJIMAGE, \
     NAME := jimage, \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     OPTIMIZATION := LOW, \
-    SRC := $(TOPDIR)/src/java.base/share/native/libjimage \
-        $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjimage, \
-    EXCLUDES := $(LIBJIMAGE_EXCLUDES), \
-    CFLAGS := $(CFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
-    CXXFLAGS := $(CXXFLAGS_JDKLIB) $(JIMAGELIB_CPPFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB), \
+    CXXFLAGS := $(CXXFLAGS_JDKLIB), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
     CFLAGS_unix := -UDEBUG, \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
@@ -231,10 +210,6 @@
 
 ##########################################################################################
 
-LIBJLI_SRC_DIRS := $(call FindSrcDirsForLib, java.base, jli)
-
-LIBJLI_CFLAGS := $(CFLAGS_JDKLIB)
-
 ifeq ($(call check-jvm-variant, zero), true)
   ERGO_FAMILY := zero
 else
@@ -263,7 +238,7 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   # Staticically link with c runtime on windows.
-  LIBJLI_CFLAGS := $(filter-out -MD, $(LIBJLI_CFLAGS))
+  LIBJLI_CFLAGS_JDKLIB := $(filter-out -MD, $(CFLAGS_JDKLIB))
   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)
   # Supply the name of the C runtime lib.
   LIBJLI_CFLAGS += -DMSVCR_DLL_NAME='"$(notdir $(MSVCR_DLL))"'
@@ -271,11 +246,10 @@
     LIBJLI_CFLAGS += -DMSVCP_DLL_NAME='"$(notdir $(MSVCP_DLL))"'
   endif
 else
+  LIBJLI_CFLAGS_JDKLIB := $(CFLAGS_JDKLIB)
   LIBJLI_OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE)/jli
 endif
 
-LIBJLI_CFLAGS += $(addprefix -I, $(LIBJLI_SRC_DIRS))
-
 LIBJLI_CFLAGS += $(LIBZ_CFLAGS)
 
 ifneq ($(USE_EXTERNAL_LIBZ), true)
@@ -293,12 +267,10 @@
 $(eval $(call SetupJdkLibrary, BUILD_LIBJLI, \
     NAME := jli, \
     OUTPUT_DIR := $(LIBJLI_OUTPUT_DIR), \
-    SRC := $(LIBJLI_SRC_DIRS), \
     EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
     EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
     OPTIMIZATION := HIGH, \
-    CFLAGS := $(LIBJLI_CFLAGS), \
-    DISABLED_WARNINGS_gcc := maybe-uninitialized, \
+    CFLAGS := $(LIBJLI_CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
     DISABLED_WARNINGS_solstudio := \
         E_ASM_DISABLES_OPTIMIZATION \
         E_STATEMENT_NOT_REACHED, \
@@ -316,6 +288,8 @@
 
 TARGETS += $(BUILD_LIBJLI)
 
+LIBJLI_SRC_DIRS := $(call FindSrcDirsForComponent, java.base, libjli)
+
 # On windows, the static library has the same suffix as the import library created by
 # with the shared library, so the static library is given a different name. No harm
 # in doing it for all platform to reduce complexity.
@@ -328,7 +302,8 @@
       EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
       EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
       OPTIMIZATION := HIGH, \
-      CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
+      CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \
+          $(addprefix -I, $(LIBJLI_SRC_DIRS)), \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
   ))
@@ -347,7 +322,8 @@
       EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
       EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
       OPTIMIZATION := HIGH, \
-      CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
+      CFLAGS := $(LIBJLI_CFLAGS_JDKLIB) $(LIBJLI_CFLAGS) \
+          $(addprefix -I, $(LIBJLI_SRC_DIRS)), \
       LDFLAGS := -nostdlib $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
   ))
@@ -371,7 +347,7 @@
       EXCLUDE_FILES := $(LIBJLI_EXCLUDE_FILES), \
       EXTRA_FILES := $(LIBJLI_EXTRA_FILES), \
       OPTIMIZATION := HIGH, \
-      CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
+      CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
       ARFLAGS := $(ARFLAGS), \
       OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))
 
--- a/make/lib/Lib-java.base.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.base.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,9 +29,7 @@
 $(eval $(call IncludeCustomExtension, lib/Lib-java.base.gmk))
 
 # Prepare the find cache.
-LIB_java.base_SRC_DIRS += $(TOPDIR)/src/java.base/*/native
-
-$(eval $(call FillCacheFind, $(wildcard $(LIB_java.base_SRC_DIRS))))
+$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.base/*/native)))
 
 ################################################################################
 # Create all the core libraries
@@ -41,14 +39,10 @@
 ################################################################################
 # Create the network library
 
-LIBNET_SRC_DIRS := $(call FindSrcDirsForLib, java.base, net)
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBNET, \
     NAME := net, \
-    SRC := $(LIBNET_SRC_DIRS), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-        $(LIBJAVA_HEADER_FLAGS) $(addprefix -I, $(LIBNET_SRC_DIRS)), \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     DISABLED_WARNINGS_gcc := format-nonliteral, \
     DISABLED_WARNINGS_clang := parentheses-equality constant-logical-operand, \
     DISABLED_WARNINGS_microsoft := 4244 4047 4133 4996, \
@@ -72,31 +66,15 @@
 ################################################################################
 # Create the nio library
 
-BUILD_LIBNIO_SRC := \
-    $(TOPDIR)/src/java.base/share/native/libnio \
-    $(TOPDIR)/src/java.base/share/native/libnio/ch \
-    $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio \
-    $(sort $(wildcard \
-      $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
-      $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/fs \
-      $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/ch \
-      $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/fs)) \
-    #
-
-BUILD_LIBNIO_CFLAGS := \
-    $(addprefix -I, $(BUILD_LIBNIO_SRC)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-    $(LIBJAVA_HEADER_FLAGS) \
-    $(addprefix -I, $(BUILD_LIBNET_SRC))
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBNIO, \
     NAME := nio, \
-    SRC := $(BUILD_LIBNIO_SRC), \
-    EXCLUDE_FILES := $(BUILD_LIBNIO_EXFILES), \
     OPTIMIZATION := HIGH, \
     WARNINGS_AS_ERRORS_xlc := false, \
-    CFLAGS := $(CFLAGS_JDKLIB) \
-        $(BUILD_LIBNIO_CFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB), \
+    EXTRA_HEADER_DIRS := \
+        libnio/ch \
+        libnio/fs \
+        libnet, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljava -lnet, \
@@ -122,17 +100,10 @@
   # JavaNativeFoundation framework not supported in static builds
   ifneq ($(STATIC_BUILD), true)
 
-    LIBOSXSECURITY_DIRS := $(TOPDIR)/src/java.base/macosx/native/libosxsecurity
-    LIBOSXSECURITY_CFLAGS := -I$(LIBOSXSECURITY_DIRS) \
-        $(LIBJAVA_HEADER_FLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-
     $(eval $(call SetupJdkLibrary, BUILD_LIBOSXSECURITY, \
         NAME := osxsecurity, \
-        SRC := $(LIBOSXSECURITY_DIRS), \
         OPTIMIZATION := LOW, \
-        CFLAGS := $(CFLAGS_JDKLIB) \
-            $(LIBOSXSECURITY_CFLAGS), \
+        CFLAGS := $(CFLAGS_JDKLIB), \
         DISABLED_WARNINGS_clang := deprecated-declarations, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base \
@@ -158,7 +129,6 @@
 ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
   ifeq ($(STATIC_BUILD), false)
 
-    LIBJSIG_SRC_DIR := $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjsig
     LIBJSIG_MAPFILE := $(wildcard $(TOPDIR)/make/mapfiles/libjsig/mapfile-vers-$(OPENJDK_TARGET_OS))
 
     ifeq ($(OPENJDK_TARGET_OS), linux)
@@ -168,7 +138,6 @@
 
     $(eval $(call SetupJdkLibrary, BUILD_LIBJSIG, \
         NAME := jsig, \
-        SRC := $(LIBJSIG_SRC_DIR), \
         CFLAGS := $(CFLAGS_JDKLIB) $(LIBJSIG_CFLAGS), \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-java.desktop.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.desktop.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,9 +29,7 @@
 $(eval $(call IncludeCustomExtension, lib/Lib-java.desktop.gmk))
 
 # Prepare the find cache.
-LIB_java.desktop_SRC_DIRS += $(TOPDIR)/src/java.desktop/*/native
-
-$(eval $(call FillCacheFind, $(wildcard $(LIB_java.desktop_SRC_DIRS))))
+$(eval $(call FillCacheFind, $(wildcard $(TOPDIR)/src/java.desktop/*/native)))
 
 ################################################################################
 # Create the AWT/2D libraries
@@ -43,16 +41,8 @@
 
 ifneq ($(OPENJDK_TARGET_OS), aix)
 
-  LIBJSOUND_SRC_DIRS := $(wildcard \
-      $(TOPDIR)/src/java.desktop/share/native/libjsound \
-      $(TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/libjsound \
-      )
-
   LIBJSOUND_CFLAGS := \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
       $(ALSA_CFLAGS) \
-      $(LIBJAVA_HEADER_FLAGS) \
-      $(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir)) \
       -DX_PLATFORM=X_$(OPENJDK_TARGET_OS_UPPERCASE) \
       -DUSE_PORTS=TRUE \
       -DUSE_DAUDIO=TRUE \
@@ -71,7 +61,6 @@
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBJSOUND, \
       NAME := jsound, \
-      SRC := $(LIBJSOUND_SRC_DIRS), \
       TOOLCHAIN := $(LIBJSOUND_TOOLCHAIN), \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
@@ -97,15 +86,11 @@
 # Create the macosx specific osxapp and osx libraries
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIBOSXAPP_SRC := $(TOPDIR)/src/java.desktop/macosx/native/libosxapp
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBOSXAPP, \
       NAME := osxapp, \
-      SRC := $(LIBOSXAPP_SRC), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) \
-          $(addprefix -I, $(LIBOSXAPP_SRC)) \
-          -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
+      CFLAGS := $(CFLAGS_JDKLIB), \
       DISABLED_WARNINGS_clang := objc-method-access objc-root-class \
           deprecated-declarations, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -129,19 +114,11 @@
 
   ##############################################################################
 
-  LIBOSX_DIRS := $(TOPDIR)/src/java.desktop/macosx/native/libosx
-  LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
-      -I$(TOPDIR)/src/java.desktop/macosx/native/libosxapp \
-      $(LIBJAVA_HEADER_FLAGS) \
-      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
-      #
-
   $(eval $(call SetupJdkLibrary, BUILD_LIBOSX, \
       NAME := osx, \
-      SRC := $(LIBOSX_DIRS), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) \
-          $(LIBOSX_CFLAGS), \
+      CFLAGS := $(CFLAGS_JDKLIB), \
+      EXTRA_HEADER_DIRS := libosxapp, \
       DISABLED_WARNINGS_clang := deprecated-declarations, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
--- a/make/lib/Lib-java.instrument.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.instrument.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -30,32 +30,24 @@
 
 ################################################################################
 
-LIBINSTRUMENT_SRC := $(TOPDIR)/src/java.instrument/share/native/libinstrument \
-    $(TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_TYPE)/native/libinstrument \
-    #
-LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
-    $(addprefix -I, $(LIBINSTRUMENT_SRC)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.instrument \
-    -I$(TOPDIR)/src/java.base/share/native/libjli \
-    -I$(TOPDIR)/src/java.base/share/native/libjava \
-    #
-
 ifeq ($(OPENJDK_TARGET_OS), windows)
   # Statically link the C runtime so that there are not dependencies on modules
   # not on the search patch when invoked from the Windows system directory
   # (or elsewhere).
-  LIBINSTRUMENT_CFLAGS := $(filter-out -MD, $(LIBINSTRUMENT_CFLAGS))
+  LIBINSTRUMENT_CFLAGS_JDKLIB := $(filter-out -MD, $(CFLAGS_JDKLIB))
   # equivalent of strcasecmp is stricmp on Windows
-  LIBINSTRUMENT_CFLAGS += -Dstrcasecmp=stricmp
+  LIBINSTRUMENT_CFLAGS := -Dstrcasecmp=stricmp
+else
+  LIBINSTRUMENT_CFLAGS_JDKLIB := $(CFLAGS_JDKLIB)
 endif
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBINSTRUMENT, \
     NAME := instrument, \
-    SRC := $(LIBINSTRUMENT_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(LIBINSTRUMENT_CFLAGS), \
+    CFLAGS := $(LIBINSTRUMENT_CFLAGS_JDKLIB) $(LIBINSTRUMENT_CFLAGS), \
     CFLAGS_debug := -DJPLIS_LOGGING, \
     CFLAGS_release := -DNO_JPLIS_LOGGING, \
+    EXTRA_HEADER_DIRS := java.base:libjli, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN) \
         $(LIBINSTRUMENT_LDFLAGS), \
--- a/make/lib/Lib-java.management.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.management.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -30,13 +30,6 @@
 
 ################################################################################
 
-LIBMANAGEMENT_SRC += $(TOPDIR)/src/java.management/share/native/libmanagement
-LIBMANAGEMENT_CFLAGS := -I$(TOPDIR)/src/hotspot/share/include \
-    $(addprefix -I,$(LIBMANAGEMENT_SRC)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.management \
-    $(LIBJAVA_HEADER_FLAGS) \
-    #
-
 LIBMANAGEMENT_OPTIMIZATION := HIGH
 ifneq ($(findstring $(OPENJDK_TARGET_OS), solaris linux), )
   ifeq ($(COMPILE_WITH_DEBUG_SYMBOLS), true)
@@ -46,9 +39,8 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT, \
     NAME := management, \
-    SRC := $(LIBMANAGEMENT_SRC), \
     OPTIMIZATION := $(LIBMANAGEMENT_OPTIMIZATION), \
-    CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_CFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-java.prefs.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.prefs.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -27,18 +27,16 @@
 
 ################################################################################
 
+# libprefs on macosx do not use the unix code
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  LIBPREF_SRC_DIRS := $(TOPDIR)/src/java.prefs/macosx/native/libprefs
-else
-  LIBPREF_SRC_DIRS := $(TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_TYPE)/native/libprefs
+  LIBPREFS_EXCLUDE_SRC_PATTERNS := unix
 endif
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBPREFS, \
     NAME := prefs, \
-    SRC := $(LIBPREF_SRC_DIRS), \
+    EXCLUDE_SRC_PATTERNS := $(LIBPREFS_EXCLUDE_SRC_PATTERNS), \
     OPTIMIZATION := HIGH, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBPREF_SRC_DIRS)) \
-        $(LIBJAVA_HEADER_FLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljvm, \
--- a/make/lib/Lib-java.rmi.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.rmi.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,9 +29,8 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBRMI, \
     NAME := rmi, \
-    SRC := $(TOPDIR)/src/java.rmi/share/native/librmi, \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/java.rmi, \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := -ljvm, \
--- a/make/lib/Lib-java.security.jgss.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.security.jgss.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -27,16 +27,10 @@
 
 ################################################################################
 
-LIBJ2GSS_SRC := $(TOPDIR)/src/java.security.jgss/share/native/libj2gss \
-  #
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBJ2GSS, \
     NAME := j2gss, \
-    SRC := $(LIBJ2GSS_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
-        $(LIBJAVA_HEADER_FLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(LIBDL), \
@@ -49,15 +43,10 @@
 ifneq ($(BUILD_CRYPTO), false)
 
   ifeq ($(OPENJDK_TARGET_OS), windows)
-    BUILD_LIBW2K_LSA_AUTH_SRC := $(call FindSrcDirsForLib, $(MODULE), w2k_lsa_auth)
-
     $(eval $(call SetupJdkLibrary, BUILD_LIBW2K_LSA_AUTH, \
         NAME := w2k_lsa_auth, \
-        SRC := $(BUILD_LIBW2K_LSA_AUTH_SRC), \
         OPTIMIZATION := LOW, \
-        CFLAGS := $(CFLAGS_JDKLIB) \
-            $(addprefix -I, $(BUILD_LIBW2K_LSA_AUTH_SRC)) \
-            -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+        CFLAGS := $(CFLAGS_JDKLIB), \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LIBS := advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
@@ -69,17 +58,12 @@
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    BUILD_LIBOSXKRB5_SRC := $(call FindSrcDirsForLib, $(MODULE), osxkrb5)
-
     # libosxkrb5 needs to call deprecated krb5 APIs so that java
     # can use the native credentials cache.
     $(eval $(call SetupJdkLibrary, BUILD_LIBOSXKRB5, \
         NAME := osxkrb5, \
-        SRC := $(BUILD_LIBOSXKRB5_SRC), \
         OPTIMIZATION := LOW, \
-        CFLAGS := $(CFLAGS_JDKLIB) \
-            $(addprefix -I, $(BUILD_LIBOSXKRB5_SRC)) \
-            -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
+        CFLAGS := $(CFLAGS_JDKLIB), \
         DISABLED_WARNINGS_clang := deprecated-declarations, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-java.smartcardio.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-java.smartcardio.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -27,18 +27,12 @@
 
 ################################################################################
 
-LIBJ2PCSC_SRC := $(TOPDIR)/src/java.smartcardio/share/native/libj2pcsc \
-    $(TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc
-LIBJ2PCSC_CPPFLAGS := $(addprefix -I,$(LIBJ2PCSC_SRC)) \
-    -I$(TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc/MUSCLE \
-    -I$(SUPPORT_OUTPUTDIR)/headers/java.smartcardio
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBJ2PCSC, \
     NAME := j2pcsc, \
-    SRC := $(LIBJ2PCSC_SRC), \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     CFLAGS_unix := -D__sun_jdk, \
+    EXTRA_HEADER_DIRS := libj2pcsc/MUSCLE, \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(LIBJ2PCSC_CPPFLAGS), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := $(LIBDL), \
--- a/make/lib/Lib-jdk.accessibility.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.accessibility.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -30,12 +30,6 @@
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
   ROOT_SRCDIR := $(TOPDIR)/src/jdk.accessibility/windows/native
-  JAVA_AB_SRCDIR := $(ROOT_SRCDIR)/libjavaaccessbridge $(ROOT_SRCDIR)/common
-  WIN_AB_SRCDIR := $(ROOT_SRCDIR)/libwindowsaccessbridge $(ROOT_SRCDIR)/common
-  SYSINFO_SRCDIR := $(ROOT_SRCDIR)/libjabsysinfo
-  ACCESSBRIDGE_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/jdk.accessibility \
-      -I$(TOPDIR)/src/java.desktop/windows/native/include \
-      -I$(TOPDIR)/src/java.desktop/share/native/include
 
   define SetupJavaDLL
     # Parameter 1 Suffix
@@ -43,13 +37,16 @@
 
     $(call SetupJdkLibrary, BUILD_JAVAACCESSBRIDGE$1, \
         NAME := javaaccessbridge$1, \
-        SRC := $(JAVA_AB_SRCDIR), \
+        SRC := libjavaaccessbridge, \
+        EXTRA_SRC := common, \
         OPTIMIZATION := LOW, \
         DISABLED_WARNINGS_microsoft := 4311 4302 4312, \
-        CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS) \
-            $(addprefix -I,$(JAVA_AB_SRCDIR)) \
-            -I$(ROOT_SRCDIR)/include/bridge \
+        CFLAGS := $(CFLAGS_JDKLIB) \
             -DACCESSBRIDGE_ARCH_$2, \
+        EXTRA_HEADER_DIRS := \
+            include/bridge \
+            java.base:include \
+            java.desktop:include, \
         LDFLAGS := $(LDFLAGS_JDKLIB), \
         LIBS := kernel32.lib user32.lib gdi32.lib \
             winspool.lib comdlg32.lib advapi32.lib shell32.lib \
@@ -68,13 +65,15 @@
     # Parameter 2 ACCESSBRIDGE_ARCH_ suffix
     $(call SetupJdkLibrary, BUILD_WINDOWSACCESSBRIDGE$1, \
         NAME := windowsaccessbridge$1, \
-        SRC := $(WIN_AB_SRCDIR), \
+        SRC := libwindowsaccessbridge, \
+        EXTRA_SRC := common, \
         OPTIMIZATION := LOW, \
         DISABLED_WARNINGS_microsoft := 4311 4302 4312, \
-        CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT $(ACCESSBRIDGE_CFLAGS) \
-            $(addprefix -I,$(WIN_AB_SRCDIR)) \
-            -I$(ROOT_SRCDIR)/include/bridge \
+        CFLAGS := $(filter-out -MD, $(CFLAGS_JDKLIB)) -MT \
             -DACCESSBRIDGE_ARCH_$2, \
+        EXTRA_HEADER_DIRS := \
+            include/bridge \
+            java.base:include, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             -def:$(ROOT_SRCDIR)/libwindowsaccessbridge/WinAccessBridge.DEF, \
         LIBS := kernel32.lib user32.lib gdi32.lib \
@@ -91,9 +90,8 @@
 
     $(call SetupJdkLibrary, BUILD_ACCESSBRIDGESYSINFO, \
         NAME := jabsysinfo, \
-        SRC := $(SYSINFO_SRCDIR), \
         OPTIMIZATION := LOW, \
-        CFLAGS := $(CFLAGS_JDKLIB) $(ACCESSBRIDGE_CFLAGS), \
+        CFLAGS := $(CFLAGS_JDKLIB), \
         LDFLAGS := $(LDFLAGS_JDKLIB), \
         VERSIONINFO_RESOURCE := $(ROOT_SRCDIR)/common/AccessBridgeStatusWindow.rc, \
     )
--- a/make/lib/Lib-jdk.attach.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.attach.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -36,11 +36,8 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBATTACH, \
     NAME := attach, \
-    SRC := $(call FindSrcDirsForLib, jdk.attach, attach), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
-        $(LIBJAVA_HEADER_FLAGS) $(LIBATTACH_CFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB) $(LIBATTACH_CFLAGS), \
     CFLAGS_windows := /Gy, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.crypto.cryptoki.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.crypto.cryptoki.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -27,16 +27,10 @@
 
 ################################################################################
 
-LIBJ2PKCS11_SRC := $(TOPDIR)/src/jdk.crypto.cryptoki/share/native/libj2pkcs11 \
-    $(TOPDIR)/src/jdk.crypto.cryptoki/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pkcs11
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBJ2PKCS11, \
     NAME := j2pkcs11, \
-    SRC := $(LIBJ2PKCS11_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
-        $(LIBJAVA_HEADER_FLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.cryptoki, \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_unix := $(LIBDL), \
--- a/make/lib/Lib-jdk.crypto.ec.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.crypto.ec.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -28,31 +28,23 @@
 ################################################################################
 
 ifeq ($(ENABLE_INTREE_EC), true)
-
-  LIBSUNEC_SRC := $(TOPDIR)/src/jdk.crypto.ec/share/native/libsunec
-  BUILD_LIBSUNEC_FLAGS := $(addprefix -I, $(SUNEC_SRC))
-
-  #
   # On sol-sparc...all libraries are compiled with -xregs=no%appl
-  # (set in CFLAGS_REQUIRED_sparc)
-  #
-  # except!!! libsunec.so
-  #
-  ECC_JNI_SOLSPARC_FILTER :=
+  # (set in CFLAGS_REQUIRED_sparc) except libsunec.so
   ifeq ($(OPENJDK_TARGET_CPU_ARCH), sparc)
-    ECC_JNI_SOLSPARC_FILTER := -xregs=no%appl
+    BUILD_LIBSUNEC_CFLAGS_JDKLIB := $(filter-out -xregs=no%appl, $(CFLAGS_JDKLIB))
+    BUILD_LIBSUNEC_CXXFLAGS_JDKLIB := $(filter-out -xregs=no%appl, $(CXXFLAGS_JDKLIB))
+  else
+    BUILD_LIBSUNEC_CFLAGS_JDKLIB := $(CFLAGS_JDKLIB)
+    BUILD_LIBSUNEC_CXXFLAGS_JDKLIB := $(CXXFLAGS_JDKLIB)
   endif
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBSUNEC, \
       NAME := sunec, \
-      SRC := $(LIBSUNEC_SRC), \
       TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CFLAGS_JDKLIB)) \
-          $(BUILD_LIBSUNEC_FLAGS) \
+      CFLAGS := $(BUILD_LIBSUNEC_CFLAGS_JDKLIB) \
           -DMP_API_COMPATIBLE -DNSS_ECC_MORE_THAN_SUITE_B, \
-      CXXFLAGS := $(filter-out $(ECC_JNI_SOLSPARC_FILTER), $(CXXFLAGS_JDKLIB)) \
-          $(BUILD_LIBSUNEC_FLAGS), \
+      CXXFLAGS := $(BUILD_LIBSUNEC_CXXFLAGS_JDKLIB), \
       DISABLED_WARNINGS_gcc := sign-compare implicit-fallthrough, \
       DISABLED_WARNINGS_microsoft := 4101 4244 4146 4018, \
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK), \
--- a/make/lib/Lib-jdk.crypto.mscapi.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.crypto.mscapi.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,14 +29,10 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
-  LIBSUNMSCAPI_SRC := $(TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_TYPE)/native/libsunmscapi
-
   $(eval $(call SetupJdkLibrary, BUILD_LIBSUNMSCAPI, \
       NAME := sunmscapi, \
-      SRC := $(LIBSUNMSCAPI_SRC), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) \
-          -I$(LIBSUNMSCAPI_SRC), \
+      CFLAGS := $(CFLAGS_JDKLIB), \
       LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := crypt32.lib advapi32.lib, \
--- a/make/lib/Lib-jdk.crypto.ucrypto.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.crypto.ucrypto.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,14 +29,10 @@
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
-  LIBJ2UCRYPTO_SRC := $(TOPDIR)/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto
-
   $(eval $(call SetupJdkLibrary, BUILD_LIBJ2UCRYPTO, \
       NAME := j2ucrypto, \
-      SRC := $(LIBJ2UCRYPTO_SRC), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) \
-          $(addprefix -I, $(LIBJ2UCRYPTO_SRC)), \
+      CFLAGS := $(CFLAGS_JDKLIB), \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(LIBDL), \
   ))
--- a/make/lib/Lib-jdk.hotspot.agent.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.hotspot.agent.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,19 +29,6 @@
 
 ################################################################################
 
-SA_TOPDIR := $(TOPDIR)/src/jdk.hotspot.agent
-
-SA_SRC += \
-    $(SA_TOPDIR)/share/native/libsaproc \
-    $(SA_TOPDIR)/$(OPENJDK_TARGET_OS)/native/libsaproc \
-    #
-
-SA_INCLUDES := \
-    $(addprefix -I, $(SA_SRC)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/jdk.hotspot.agent \
-    -I$(TOPDIR)/src/hotspot/os/$(OPENJDK_TARGET_OS) \
-    #
-
 ifeq ($(OPENJDK_TARGET_OS), linux)
   SA_CFLAGS := -D_FILE_OFFSET_BITS=64
 
@@ -68,9 +55,8 @@
     DISABLED_WARNINGS_microsoft := 4267, \
     DISABLED_WARNINGS_gcc := sign-compare, \
     DISABLED_WARNINGS_CXX_solstudio := truncwarn unknownpragma, \
-    SRC := $(SA_SRC), \
-    CFLAGS := $(CFLAGS_JDKLIB) $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CUSTOM_CFLAGS), \
-    CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_INCLUDES) $(SA_CFLAGS) $(SA_CXXFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB) $(SA_CFLAGS), \
+    CXXFLAGS := $(CXXFLAGS_JDKLIB) $(SA_CFLAGS) $(SA_CXXFLAGS), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(SA_LDFLAGS), \
     LIBS_linux := -lthread_db $(LIBDL), \
     LIBS_solaris := -ldl -ldemangle -lthread -lproc, \
--- a/make/lib/Lib-jdk.internal.le.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.internal.le.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,19 +29,10 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
-  LIBLE_SRC := $(TOPDIR)/src/jdk.internal.le/$(OPENJDK_TARGET_OS_TYPE)/native/lible \
-      #
-  LIBLE_CPPFLAGS := \
-      $(addprefix -I, $(LIBLE_SRC)) \
-      -I$(SUPPORT_OUTPUTDIR)/headers/jdk.internal.le \
-      #
-
   $(eval $(call SetupJdkLibrary, BUILD_LIBLE, \
       NAME := le, \
-      SRC := $(LIBLE_SRC), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) $(LIBJAVA_HEADER_FLAGS)\
-          $(LIBLE_CPPFLAGS), \
+      CFLAGS := $(CFLAGS_JDKLIB), \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(JDKLIB_LIBS) user32.lib, \
   ))
--- a/make/lib/Lib-jdk.jdi.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.jdi.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,22 +29,13 @@
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
-  LIBDT_SHMEM_SRC := $(TOPDIR)/src/jdk.jdi/share/native/libdt_shmem \
-      $(TOPDIR)/src/jdk.jdi/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_shmem \
-      #
-  LIBDT_SHMEM_CPPFLAGS := -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
-      $(addprefix -I, $(LIBDT_SHMEM_SRC)) \
-      -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-      -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-      -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdi \
-      #
-
   $(eval $(call SetupJdkLibrary, BUILD_LIBDT_SHMEM, \
       NAME := dt_shmem, \
-      SRC := $(LIBDT_SHMEM_SRC), \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
-          $(LIBDT_SHMEM_CPPFLAGS), \
+      CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP, \
+      EXTRA_HEADER_DIRS := \
+          jdk.jdwp.agent:include \
+          jdk.jdwp.agent:libjdwp/export, \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LIBS := $(JDKLIB_LIBS), \
   ))
--- a/make/lib/Lib-jdk.jdwp.agent.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.jdwp.agent.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -27,21 +27,14 @@
 
 ################################################################################
 
-LIBDT_SOCKET_SRC := $(TOPDIR)/src/jdk.jdwp.agent/share/native/libdt_socket \
-    $(TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_socket
-LIBDT_SOCKET_CPPFLAGS := \
-    $(addprefix -I, $(LIBDT_SOCKET_SRC)) \
-    -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-    -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \
-    -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-    #
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBDT_SOCKET, \
     NAME := dt_socket, \
-    SRC := $(LIBDT_SOCKET_SRC), \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -DUSE_MMAP \
         $(LIBDT_SOCKET_CPPFLAGS), \
+    EXTRA_HEADER_DIRS := \
+        include \
+        libjdwp/export, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_linux := -lpthread, \
@@ -56,21 +49,14 @@
 
 ################################################################################
 
-LIBJDWP_SRC := $(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \
-    $(TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libjdwp
-LIBJDWP_CPPFLAGS := \
-    -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
-    -I$(TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-    $(addprefix -I, $(LIBJDWP_SRC))
-
 # JDWP_LOGGING causes log messages to be compiled into the library.
 $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \
     NAME := jdwp, \
-    SRC := $(LIBJDWP_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING \
-        $(LIBJDWP_CPPFLAGS) \
-        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent, \
+    CFLAGS := $(CFLAGS_JDKLIB) -DJDWP_LOGGING, \
+    EXTRA_HEADER_DIRS := \
+      include \
+      libjdwp/export, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-jdk.management.agent.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.management.agent.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -27,17 +27,10 @@
 
 ################################################################################
 
-LIBMANAGEMENT_AGENT_SRC += $(TOPDIR)/src/jdk.management.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement_agent
-LIBMANAGEMENT_AGENT_CFLAGS := $(addprefix -I,$(LIBMANAGEMENT_AGENT_SRC)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/jdk.management.agent \
-    $(LIBJAVA_HEADER_FLAGS) \
-    #
-
 $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_AGENT, \
     NAME := management_agent, \
-    SRC := $(LIBMANAGEMENT_AGENT_SRC), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_AGENT_CFLAGS), \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS := $(JDKLIB_LIBS), \
--- a/make/lib/Lib-jdk.management.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.management.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -30,15 +30,6 @@
 
 ################################################################################
 
-LIBMANAGEMENT_EXT_SRC += $(TOPDIR)/src/jdk.management/share/native/libmanagement_ext \
-    $(TOPDIR)/src/jdk.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement_ext       \
-    $(TOPDIR)/src/jdk.management/$(OPENJDK_TARGET_OS)/native/libmanagement_ext
-LIBMANAGEMENT_EXT_CFLAGS := -I$(TOPDIR)/src/java.management/share/native/include \
-    $(addprefix -I,$(LIBMANAGEMENT_EXT_SRC)) \
-    -I$(SUPPORT_OUTPUTDIR)/headers/jdk.management \
-    $(LIBJAVA_HEADER_FLAGS) \
-    #
-
 ifeq ($(OPENJDK_TARGET_OS), windows)
   # In (at least) VS2013 and later, -DPSAPI_VERSION=1 is needed to generate
   # a binary that is compatible with windows versions older than 7/2008R2.
@@ -55,8 +46,6 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBMANAGEMENT_EXT, \
     NAME := management_ext, \
-    SRC := $(LIBMANAGEMENT_EXT_SRC), \
-    LANG := C, \
     OPTIMIZATION := $(LIBMANAGEMENT_EXT_OPTIMIZATION), \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBMANAGEMENT_EXT_CFLAGS), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
--- a/make/lib/Lib-jdk.net.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.net.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -31,9 +31,8 @@
 
   $(eval $(call SetupJdkLibrary, BUILD_LIBEXTNET, \
       NAME := extnet, \
-      SRC := $(TOPDIR)/src/jdk.net/$(OPENJDK_TARGET_OS)/native/libextnet, \
       OPTIMIZATION := LOW, \
-      CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.net, \
+      CFLAGS := $(CFLAGS_JDKLIB), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LIBS := -ljava, \
--- a/make/lib/Lib-jdk.pack.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.pack.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,16 +29,13 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBUNPACK, \
     NAME := unpack, \
-    SRC := $(TOPDIR)/src/jdk.pack/share/native/libunpack \
-        $(TOPDIR)/src/jdk.pack/share/native/common-unpack, \
+    EXTRA_SRC := common-unpack, \
     TOOLCHAIN := TOOLCHAIN_LINK_CXX, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CXXFLAGS_JDKLIB) \
-        -DNO_ZLIB -DUNPACK_JNI -DFULL \
-        -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-        -I$(TOPDIR)/src/jdk.pack/share/native/common-unpack \
-        $(LIBJAVA_HEADER_FLAGS), \
+        -DNO_ZLIB -DUNPACK_JNI -DFULL, \
     CFLAGS_release := -DPRODUCT, \
+    EXTRA_HEADER_DIRS := $(call GetJavaHeaderDir, java.base), \
     DISABLED_WARNINGS_gcc := implicit-fallthrough, \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/make/lib/Lib-jdk.sctp.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.sctp.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,18 +29,15 @@
 
 ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
 
-  ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix))
+  ifeq ($(filter $(OPENJDK_TARGET_OS), macosx aix), )
     $(eval $(call SetupJdkLibrary, BUILD_LIBSCTP, \
         NAME := sctp, \
-        SRC := $(TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_TYPE)/native/libsctp, \
         OPTIMIZATION := LOW, \
-        CFLAGS := $(CFLAGS_JDKLIB) \
-            -I $(TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
-            -I $(TOPDIR)/src/java.base/share/native/libnio/ch \
-            $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \
-            $(LIBJAVA_HEADER_FLAGS) \
-            -I$(SUPPORT_OUTPUTDIR)/headers/jdk.sctp \
-            -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
+        CFLAGS := $(CFLAGS_JDKLIB), \
+        EXTRA_HEADER_DIRS := \
+            $(call GetJavaHeaderDir, java.base) \
+            java.base:libnet \
+            java.base:libnio/ch, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LIBS_unix := -lnio -lnet -ljava -ljvm, \
--- a/make/lib/Lib-jdk.security.auth.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/Lib-jdk.security.auth.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -29,9 +29,8 @@
 
 $(eval $(call SetupJdkLibrary, BUILD_LIBJAAS, \
     NAME := jaas, \
-    SRC := $(call FindSrcDirsForLib, jdk.security.auth, jaas), \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.security.auth, \
+    CFLAGS := $(CFLAGS_JDKLIB), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LIBS_windows := netapi32.lib user32.lib mpr.lib advapi32.lib $(JDKLIB_LIBS), \
--- a/make/lib/LibCommon.gmk	Thu Jun 07 23:12:35 2018 -0700
+++ b/make/lib/LibCommon.gmk	Fri Jun 08 09:40:28 2018 -0700
@@ -25,9 +25,6 @@
 
 include JdkNativeCompilation.gmk
 
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, lib/LibCommon.gmk))
-
 ################################################################################
 
 GLOBAL_VERSION_INFO_RESOURCE := $(TOPDIR)/src/java.base/windows/native/common/version.rc
@@ -67,16 +64,6 @@
 endif
 
 ################################################################################
-# Find the default set of src dirs for a native library.
-# Param 1 - module name
-# Param 2 - library name
-FindSrcDirsForLib += \
-  $(call uniq, $(wildcard \
-      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
-      $(TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
-      $(TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
-
-################################################################################
 # Find a library
 # Param 1 - module name
 # Param 2 - library name
@@ -94,10 +81,6 @@
     $(addprefix $(SUPPORT_OUTPUTDIR)/native/, \
         $(strip $1)$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(STATIC_LIBRARY_SUFFIX))
 
-################################################################################
-# Define the header include flags needed to compile against it.
-LIBJAVA_HEADER_FLAGS := $(addprefix -I, $(call FindSrcDirsForLib, java.base, java))
-
 # Put the libraries here.
 INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
 
--- a/src/hotspot/cpu/aarch64/aarch64.ad	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/aarch64/aarch64.ad	Fri Jun 08 09:40:28 2018 -0700
@@ -3792,69 +3792,7 @@
   return false;
 }
 
-// Transform:
-// (AddP base (AddP base address (LShiftL index con)) offset)
-// into:
-// (AddP base (AddP base offset) (LShiftL index con))
-// to take full advantage of ARM's addressing modes
 void Compile::reshape_address(AddPNode* addp) {
-  Node *addr = addp->in(AddPNode::Address);
-  if (addr->is_AddP() && addr->in(AddPNode::Base) == addp->in(AddPNode::Base)) {
-    const AddPNode *addp2 = addr->as_AddP();
-    if ((addp2->in(AddPNode::Offset)->Opcode() == Op_LShiftL &&
-         addp2->in(AddPNode::Offset)->in(2)->is_Con() &&
-         size_fits_all_mem_uses(addp, addp2->in(AddPNode::Offset)->in(2)->get_int())) ||
-        addp2->in(AddPNode::Offset)->Opcode() == Op_ConvI2L) {
-
-      // Any use that can't embed the address computation?
-      for (DUIterator_Fast imax, i = addp->fast_outs(imax); i < imax; i++) {
-        Node* u = addp->fast_out(i);
-        if (!u->is_Mem()) {
-          return;
-        }
-        if (u->is_LoadVector() || u->is_StoreVector() || u->Opcode() == Op_StoreCM) {
-          return;
-        }
-        if (addp2->in(AddPNode::Offset)->Opcode() != Op_ConvI2L) {
-          int scale = 1 << addp2->in(AddPNode::Offset)->in(2)->get_int();
-          if (VM_Version::expensive_load(u->as_Mem()->memory_size(), scale)) {
-            return;
-          }
-        }
-      }
-
-      Node* off = addp->in(AddPNode::Offset);
-      Node* addr2 = addp2->in(AddPNode::Address);
-      Node* base = addp->in(AddPNode::Base);
-
-      Node* new_addr = NULL;
-      // Check whether the graph already has the new AddP we need
-      // before we create one (no GVN available here).
-      for (DUIterator_Fast imax, i = addr2->fast_outs(imax); i < imax; i++) {
-        Node* u = addr2->fast_out(i);
-        if (u->is_AddP() &&
-            u->in(AddPNode::Base) == base &&
-            u->in(AddPNode::Address) == addr2 &&
-            u->in(AddPNode::Offset) == off) {
-          new_addr = u;
-          break;
-        }
-      }
-
-      if (new_addr == NULL) {
-        new_addr = new AddPNode(base, addr2, off);
-      }
-      Node* new_off = addp2->in(AddPNode::Offset);
-      addp->set_req(AddPNode::Address, new_addr);
-      if (addr->outcnt() == 0) {
-        addr->disconnect_inputs(NULL, this);
-      }
-      addp->set_req(AddPNode::Offset, new_off);
-      if (off->outcnt() == 0) {
-        off->disconnect_inputs(NULL, this);
-      }
-    }
-  }
 }
 
 // helper for encoding java_to_runtime calls on sim
--- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -37,6 +37,7 @@
 #include "compiler/disassembler.hpp"
 #include "memory/resourceArea.hpp"
 #include "nativeInst_aarch64.hpp"
+#include "oops/accessDecorators.hpp"
 #include "oops/compressedOops.inline.hpp"
 #include "oops/klass.inline.hpp"
 #include "oops/oop.hpp"
@@ -2127,7 +2128,7 @@
 
   bind(not_weak);
   // Resolve (untagged) jobject.
-  bs->load_at(this, IN_ROOT | IN_CONCURRENT_ROOT, T_OBJECT,
+  bs->load_at(this, IN_CONCURRENT_ROOT, T_OBJECT,
                     value, Address(value, 0), tmp, thread);
   verify_oop(value);
   bind(done);
@@ -3664,7 +3665,7 @@
 void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
   // OopHandle::resolve is an indirection.
   BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
-  bs->load_at(this, IN_ROOT | IN_CONCURRENT_ROOT, T_OBJECT,
+  bs->load_at(this, IN_CONCURRENT_ROOT, T_OBJECT,
                     result, Address(result, 0), tmp, rthread);
 }
 
@@ -3983,6 +3984,7 @@
                                     Register dst, Address src,
                                     Register tmp1, Register thread_tmp) {
   BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::load_at(this, decorators, type, dst, src, tmp1, thread_tmp);
@@ -3995,6 +3997,7 @@
                                      Address dst, Register src,
                                      Register tmp1, Register thread_tmp) {
   BarrierSetAssembler *bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::store_at(this, decorators, type, dst, src, tmp1, thread_tmp);
--- a/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/aarch64/templateTable_aarch64.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -813,7 +813,7 @@
   do_oop_load(_masm,
               Address(r1, arrayOopDesc::base_offset_in_bytes(T_OBJECT)),
               r0,
-              IN_HEAP | IN_HEAP_ARRAY);
+              IN_HEAP_ARRAY);
 }
 
 void TemplateTable::baload()
@@ -1141,7 +1141,7 @@
   // Get the value we will store
   __ ldr(r0, at_tos());
   // Now store using the appropriate barrier
-  do_oop_store(_masm, element_address, r0, IN_HEAP | IN_HEAP_ARRAY);
+  do_oop_store(_masm, element_address, r0, IN_HEAP_ARRAY);
   __ b(done);
 
   // Have a NULL in r0, r3=array, r2=index.  Store NULL at ary[idx]
@@ -1149,7 +1149,7 @@
   __ profile_null_seen(r2);
 
   // Store a NULL
-  do_oop_store(_masm, element_address, noreg, IN_HEAP | IN_HEAP_ARRAY);
+  do_oop_store(_masm, element_address, noreg, IN_HEAP_ARRAY);
 
   // Pop stack arguments
   __ bind(done);
--- a/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/arm/macroAssembler_arm.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -36,6 +36,7 @@
 #include "gc/shared/collectedHeap.inline.hpp"
 #include "interpreter/interpreter.hpp"
 #include "memory/resourceArea.hpp"
+#include "oops/accessDecorators.hpp"
 #include "oops/klass.inline.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/biasedLocking.hpp"
@@ -2133,7 +2134,7 @@
   b(done);
   bind(not_weak);
   // Resolve (untagged) jobject.
-  access_load_at(T_OBJECT, IN_ROOT | IN_CONCURRENT_ROOT,
+  access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
                  Address(value, 0), value, tmp1, tmp2, noreg);
   verify_oop(value);
   bind(done);
@@ -2700,6 +2701,7 @@
 void MacroAssembler::access_load_at(BasicType type, DecoratorSet decorators,
                                     Address src, Register dst, Register tmp1, Register tmp2, Register tmp3) {
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::load_at(this, decorators, type, dst, src, tmp1, tmp2, tmp3);
@@ -2711,6 +2713,7 @@
 void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators,
                                      Address obj, Register new_val, Register tmp1, Register tmp2, Register tmp3, bool is_null) {
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::store_at(this, decorators, type, obj, new_val, tmp1, tmp2, tmp3, is_null);
--- a/src/hotspot/cpu/arm/relocInfo_arm.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/arm/relocInfo_arm.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 #include "nativeInst_arm.hpp"
 #include "oops/compressedOops.inline.hpp"
 #include "oops/oop.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/safepoint.hpp"
 
 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
--- a/src/hotspot/cpu/ppc/assembler_ppc.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/ppc/assembler_ppc.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -486,7 +486,7 @@
   // Case 2: Can use addis.
   if (xd == 0) {
     short xc = rem & 0xFFFF; // 2nd 16-bit chunk.
-    rem = (rem >> 16) + ((unsigned short)xd >> 15);
+    rem = (rem >> 16) + ((unsigned short)xc >> 15);
     if (rem == 0) {
       addis(d, s, xc);
       return 0;
--- a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -214,11 +214,9 @@
   assert(sizeof(*ct->card_table()->byte_map_base()) == sizeof(jbyte), "adjust this code");
 
   // Does store cross heap regions?
-  if (G1RSBarrierRegionFilter) {
-    __ xorr(tmp1, store_addr, new_val);
-    __ srdi_(tmp1, tmp1, HeapRegion::LogOfHRGrainBytes);
-    __ beq(CCR0, filtered);
-  }
+  __ xorr(tmp1, store_addr, new_val);
+  __ srdi_(tmp1, tmp1, HeapRegion::LogOfHRGrainBytes);
+  __ beq(CCR0, filtered);
 
   // Crosses regions, storing NULL?
   if (not_null) {
--- a/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -32,6 +32,7 @@
 #include "code/codeCache.hpp"
 #include "gc/shared/barrierSet.hpp"
 #include "gc/shared/barrierSetAssembler.hpp"
+#include "oops/accessDecorators.hpp"
 #include "runtime/safepointMechanism.hpp"
 
 inline bool MacroAssembler::is_ld_largeoffset(address a) {
@@ -332,6 +333,7 @@
                          ON_UNKNOWN_OOP_REF)) == 0, "unsupported decorator");
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
   bool as_raw = (decorators & AS_RAW) != 0;
+  decorators = AccessInternal::decorator_fixup(decorators);
   if (as_raw) {
     bs->BarrierSetAssembler::store_at(this, decorators, type,
                                       base, ind_or_offs, val,
@@ -349,6 +351,7 @@
   assert((decorators & ~(AS_RAW | IN_HEAP | IN_HEAP_ARRAY | IN_ROOT | OOP_NOT_NULL |
                          ON_PHANTOM_OOP_REF | ON_WEAK_OOP_REF)) == 0, "unsupported decorator");
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::load_at(this, decorators, type,
--- a/src/hotspot/cpu/ppc/nativeInst_ppc.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/ppc/nativeInst_ppc.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -30,7 +30,7 @@
 #include "oops/compressedOops.inline.hpp"
 #include "oops/oop.hpp"
 #include "runtime/handles.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "utilities/ostream.hpp"
--- a/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/ppc/templateTable_ppc_64.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -688,7 +688,7 @@
                  Rtemp2     = R31;
   __ index_check(Rarray, R17_tos /* index */, UseCompressedOops ? 2 : LogBytesPerWord, Rtemp, Rload_addr);
   do_oop_load(_masm, Rload_addr, arrayOopDesc::base_offset_in_bytes(T_OBJECT), R17_tos, Rtemp, Rtemp2,
-              IN_HEAP | IN_HEAP_ARRAY);
+              IN_HEAP_ARRAY);
   __ verify_oop(R17_tos);
   //__ dcbt(R17_tos); // prefetch
 }
@@ -1015,14 +1015,14 @@
 
   __ bind(Lis_null);
   do_oop_store(_masm, Rstore_addr, arrayOopDesc::base_offset_in_bytes(T_OBJECT), noreg /* 0 */,
-               Rscratch, Rscratch2, Rscratch3, IN_HEAP | IN_HEAP_ARRAY);
+               Rscratch, Rscratch2, Rscratch3, IN_HEAP_ARRAY);
   __ profile_null_seen(Rscratch, Rscratch2);
   __ b(Ldone);
 
   // Store is OK.
   __ bind(Lstore_ok);
   do_oop_store(_masm, Rstore_addr, arrayOopDesc::base_offset_in_bytes(T_OBJECT), R17_tos /* value */,
-               Rscratch, Rscratch2, Rscratch3, IN_HEAP | IN_HEAP_ARRAY | OOP_NOT_NULL);
+               Rscratch, Rscratch2, Rscratch3, IN_HEAP_ARRAY | OOP_NOT_NULL);
 
   __ bind(Ldone);
   // Adjust sp (pops array, index and value).
--- a/src/hotspot/cpu/s390/assembler_s390.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/s390/assembler_s390.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -2967,6 +2967,7 @@
 
   // branch never (nop)
   inline void z_nop();
+  inline void nop(); // Used by shared code.
 
   // ===============================================================================================
 
--- a/src/hotspot/cpu/s390/assembler_s390.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/s390/assembler_s390.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1311,6 +1311,7 @@
 
 // branch never (nop), branch always
 inline void Assembler::z_nop() { z_bcr(bcondNop, Z_R0); }
+inline void Assembler::nop() { z_nop(); }
 inline void Assembler::z_br(Register r2) { assert(r2 != Z_R0, "nop if target is Z_R0, use z_nop() instead"); z_bcr(bcondAlways, r2 ); }
 
 inline void Assembler::z_exrl(Register r1, Label& L) { z_exrl(r1, target(L)); }  // z10
--- a/src/hotspot/cpu/s390/c1_MacroAssembler_s390.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/s390/c1_MacroAssembler_s390.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -95,8 +95,6 @@
   void invalidate_registers(Register preserve1 = noreg, Register preserve2 = noreg,
                             Register preserve3 = noreg) PRODUCT_RETURN;
 
-  void nop() { z_nop(); }
-
   // This platform only uses signal-based null checks. The Label is not needed.
   void null_check(Register r, Label *Lnull = NULL) { MacroAssembler::null_check(r); }
 
--- a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -273,16 +273,14 @@
 
   // Does store cross heap regions?
   // It does if the two addresses specify different grain addresses.
-  if (G1RSBarrierRegionFilter) {
-    if (VM_Version::has_DistinctOpnds()) {
-      __ z_xgrk(Rtmp1, Rstore_addr, Rnew_val);
-    } else {
-      __ z_lgr(Rtmp1, Rstore_addr);
-      __ z_xgr(Rtmp1, Rnew_val);
-    }
-    __ z_srag(Rtmp1, Rtmp1, HeapRegion::LogOfHRGrainBytes);
-    __ z_bre(filtered);
+  if (VM_Version::has_DistinctOpnds()) {
+    __ z_xgrk(Rtmp1, Rstore_addr, Rnew_val);
+  } else {
+    __ z_lgr(Rtmp1, Rstore_addr);
+    __ z_xgr(Rtmp1, Rnew_val);
   }
+  __ z_srag(Rtmp1, Rtmp1, HeapRegion::LogOfHRGrainBytes);
+  __ z_bre(filtered);
 
   // Crosses regions, storing NULL?
   if (not_null) {
--- a/src/hotspot/cpu/s390/macroAssembler_s390.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/s390/macroAssembler_s390.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -34,6 +34,7 @@
 #include "gc/shared/cardTableBarrierSet.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
+#include "oops/accessDecorators.hpp"
 #include "oops/compressedOops.inline.hpp"
 #include "oops/klass.inline.hpp"
 #include "opto/compile.hpp"
@@ -4053,6 +4054,7 @@
   assert((decorators & ~(AS_RAW | IN_HEAP | IN_HEAP_ARRAY | IN_ROOT | OOP_NOT_NULL |
                          ON_UNKNOWN_OOP_REF)) == 0, "unsupported decorator");
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::store_at(this, decorators, type,
@@ -4071,6 +4073,7 @@
   assert((decorators & ~(AS_RAW | IN_HEAP | IN_HEAP_ARRAY | IN_ROOT | OOP_NOT_NULL |
                          ON_PHANTOM_OOP_REF | ON_WEAK_OOP_REF)) == 0, "unsupported decorator");
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::load_at(this, decorators, type,
--- a/src/hotspot/cpu/s390/templateTable_s390.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -853,7 +853,7 @@
   index_check(Z_tmp_1, index, shift);
   // Now load array element.
   do_oop_load(_masm, Address(Z_tmp_1, index, arrayOopDesc::base_offset_in_bytes(T_OBJECT)), Z_tos,
-              Z_tmp_2, Z_tmp_3, IN_HEAP | IN_HEAP_ARRAY);
+              Z_tmp_2, Z_tmp_3, IN_HEAP_ARRAY);
   __ verify_oop(Z_tos);
 }
 
@@ -1197,7 +1197,7 @@
 
   // Store a NULL.
   do_oop_store(_masm, Address(Rstore_addr, (intptr_t)0), noreg,
-               tmp3, tmp2, tmp1, IN_HEAP | IN_HEAP_ARRAY);
+               tmp3, tmp2, tmp1, IN_HEAP_ARRAY);
   __ z_bru(done);
 
   // Come here on success.
@@ -1205,7 +1205,7 @@
 
   // Now store using the appropriate barrier.
   do_oop_store(_masm, Address(Rstore_addr, (intptr_t)0), Rvalue,
-               tmp3, tmp2, tmp1, IN_HEAP | IN_HEAP_ARRAY | OOP_NOT_NULL);
+               tmp3, tmp2, tmp1, IN_HEAP_ARRAY | OOP_NOT_NULL);
 
   // Pop stack arguments.
   __ bind(done);
--- a/src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/sparc/gc/g1/g1BarrierSetAssembler_sparc.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -369,12 +369,10 @@
 
   G1BarrierSet* bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
 
-  if (G1RSBarrierRegionFilter) {
-    __ xor3(store_addr, new_val, tmp);
-    __ srlx(tmp, HeapRegion::LogOfHRGrainBytes, tmp);
+  __ xor3(store_addr, new_val, tmp);
+  __ srlx(tmp, HeapRegion::LogOfHRGrainBytes, tmp);
 
-    __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
-  }
+  __ cmp_and_brx_short(tmp, G0, Assembler::equal, Assembler::pt, filtered);
 
   // If the "store_addr" register is an "in" or "local" register, move it to
   // a scratch reg so we can pass it as an argument.
--- a/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/sparc/macroAssembler_sparc.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -32,6 +32,7 @@
 #include "interpreter/interpreter.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
+#include "oops/accessDecorators.hpp"
 #include "oops/klass.inline.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/biasedLocking.hpp"
@@ -181,7 +182,7 @@
   br (Assembler::always, true, Assembler::pt, done);
   delayed()->nop();
   bind(not_weak);
-  access_load_at(T_OBJECT, IN_ROOT | IN_CONCURRENT_ROOT,
+  access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
                  Address(value, 0), value, tmp);
   verify_oop(value);
   bind(done);
@@ -3401,7 +3402,7 @@
 // ((OopHandle)result).resolve();
 void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
   // OopHandle::resolve is an indirection.
-  access_load_at(T_OBJECT, IN_ROOT | IN_CONCURRENT_ROOT,
+  access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
                  Address(result, 0), result, tmp);
 }
 
@@ -3446,6 +3447,7 @@
 void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators,
                                      Register src, Address dst, Register tmp) {
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::store_at(this, decorators, type, src, dst, tmp);
@@ -3457,6 +3459,7 @@
 void MacroAssembler::access_load_at(BasicType type, DecoratorSet decorators,
                                     Address src, Register dst, Register tmp) {
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::load_at(this, decorators, type, src, dst, tmp);
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -34,6 +34,7 @@
   bool on_heap = (decorators & IN_HEAP) != 0;
   bool on_root = (decorators & IN_ROOT) != 0;
   bool oop_not_null = (decorators & OOP_NOT_NULL) != 0;
+  bool atomic = (decorators & MO_RELAXED) != 0;
 
   switch (type) {
   case T_OBJECT:
@@ -58,6 +59,37 @@
     }
     break;
   }
+  case T_BOOLEAN: __ load_unsigned_byte(dst, src);  break;
+  case T_BYTE:    __ load_signed_byte(dst, src);    break;
+  case T_CHAR:    __ load_unsigned_short(dst, src); break;
+  case T_SHORT:   __ load_signed_short(dst, src);   break;
+  case T_INT:     __ movl  (dst, src);              break;
+  case T_ADDRESS: __ movptr(dst, src);              break;
+  case T_FLOAT:
+    assert(dst == noreg, "only to ftos");
+    __ load_float(src);
+    break;
+  case T_DOUBLE:
+    assert(dst == noreg, "only to dtos");
+    __ load_double(src);
+    break;
+  case T_LONG:
+    assert(dst == noreg, "only to ltos");
+#ifdef _LP64
+    __ movq(rax, src);
+#else
+    if (atomic) {
+      __ fild_d(src);               // Must load atomically
+      __ subptr(rsp,2*wordSize);    // Make space for store
+      __ fistp_d(Address(rsp,0));
+      __ pop(rax);
+      __ pop(rdx);
+    } else {
+      __ movl(rax, src);
+      __ movl(rdx, src.plus_disp(wordSize));
+    }
+#endif
+    break;
   default: Unimplemented();
   }
 }
@@ -67,6 +99,7 @@
   bool on_heap = (decorators & IN_HEAP) != 0;
   bool on_root = (decorators & IN_ROOT) != 0;
   bool oop_not_null = (decorators & OOP_NOT_NULL) != 0;
+  bool atomic = (decorators & MO_RELAXED) != 0;
 
   switch (type) {
   case T_OBJECT:
@@ -106,6 +139,50 @@
     }
     break;
   }
+  case T_BOOLEAN:
+    __ andl(val, 0x1);  // boolean is true if LSB is 1
+    __ movb(dst, val);
+    break;
+  case T_BYTE:
+    __ movb(dst, val);
+    break;
+  case T_SHORT:
+    __ movw(dst, val);
+    break;
+  case T_CHAR:
+    __ movw(dst, val);
+    break;
+  case T_INT:
+    __ movl(dst, val);
+    break;
+  case T_LONG:
+    assert(val == noreg, "only tos");
+#ifdef _LP64
+    __ movq(dst, rax);
+#else
+    if (atomic) {
+      __ push(rdx);
+      __ push(rax);                 // Must update atomically with FIST
+      __ fild_d(Address(rsp,0));    // So load into FPU register
+      __ fistp_d(dst);              // and put into memory atomically
+      __ addptr(rsp, 2*wordSize);
+    } else {
+      __ movptr(dst, rax);
+      __ movptr(dst.plus_disp(wordSize), rdx);
+    }
+#endif
+    break;
+  case T_FLOAT:
+    assert(val == noreg, "only tos");
+    __ store_float(dst);
+    break;
+  case T_DOUBLE:
+    assert(val == noreg, "only tos");
+    __ store_double(dst);
+    break;
+  case T_ADDRESS:
+    __ movptr(dst, val);
+    break;
   default: Unimplemented();
   }
 }
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -33,7 +33,7 @@
 #include "interpreter/interpreter.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/universe.hpp"
-#include "oops/access.hpp"
+#include "oops/accessDecorators.hpp"
 #include "oops/klass.inline.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/biasedLocking.hpp"
@@ -5259,7 +5259,7 @@
   jmp(done);
   bind(not_weak);
   // Resolve (untagged) jobject.
-  access_load_at(T_OBJECT, IN_ROOT | IN_CONCURRENT_ROOT,
+  access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
                  value, Address(value, 0), tmp, thread);
   verify_oop(value);
   bind(done);
@@ -6281,7 +6281,7 @@
   // Only 64 bit platforms support GCs that require a tmp register
   // Only IN_HEAP loads require a thread_tmp register
   // OopHandle::resolve is an indirection like jobject.
-  access_load_at(T_OBJECT, IN_ROOT | IN_CONCURRENT_ROOT,
+  access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
                  result, Address(result, 0), tmp, /*tmp_thread*/noreg);
 }
 
@@ -6323,6 +6323,7 @@
 void MacroAssembler::access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
                                     Register tmp1, Register thread_tmp) {
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::load_at(this, decorators, type, dst, src, tmp1, thread_tmp);
@@ -6334,6 +6335,7 @@
 void MacroAssembler::access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
                                      Register tmp1, Register tmp2) {
   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+  decorators = AccessInternal::decorator_fixup(decorators);
   bool as_raw = (decorators & AS_RAW) != 0;
   if (as_raw) {
     bs->BarrierSetAssembler::store_at(this, decorators, type, dst, src, tmp1, tmp2);
--- a/src/hotspot/cpu/x86/methodHandles_x86.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/x86/methodHandles_x86.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -175,7 +175,9 @@
   __ verify_oop(method_temp);
   __ load_heap_oop(method_temp, Address(method_temp, NONZERO(java_lang_invoke_MemberName::method_offset_in_bytes())), temp2);
   __ verify_oop(method_temp);
-  __ movptr(method_temp, Address(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())));
+  __ access_load_at(T_ADDRESS, IN_HEAP, method_temp,
+                    Address(method_temp, NONZERO(java_lang_invoke_ResolvedMethodName::vmtarget_offset_in_bytes())),
+                    noreg, noreg);
 
   if (VerifyMethodHandles && !for_compiler_entry) {
     // make sure recv is already on stack
@@ -390,7 +392,7 @@
         verify_ref_kind(_masm, JVM_REF_invokeSpecial, member_reg, temp3);
       }
       __ load_heap_oop(rbx_method, member_vmtarget);
-      __ movptr(rbx_method, vmtarget_method);
+      __ access_load_at(T_ADDRESS, IN_HEAP, rbx_method, vmtarget_method, noreg, noreg);
       break;
 
     case vmIntrinsics::_linkToStatic:
@@ -398,7 +400,7 @@
         verify_ref_kind(_masm, JVM_REF_invokeStatic, member_reg, temp3);
       }
       __ load_heap_oop(rbx_method, member_vmtarget);
-      __ movptr(rbx_method, vmtarget_method);
+      __ access_load_at(T_ADDRESS, IN_HEAP, rbx_method, vmtarget_method, noreg, noreg);
       break;
 
     case vmIntrinsics::_linkToVirtual:
@@ -412,7 +414,7 @@
 
       // pick out the vtable index from the MemberName, and then we can discard it:
       Register temp2_index = temp2;
-      __ movptr(temp2_index, member_vmindex);
+      __ access_load_at(T_ADDRESS, IN_HEAP, temp2_index, member_vmindex, noreg, noreg);
 
       if (VerifyMethodHandles) {
         Label L_index_ok;
@@ -446,7 +448,7 @@
       __ verify_klass_ptr(temp3_intf);
 
       Register rbx_index = rbx_method;
-      __ movptr(rbx_index, member_vmindex);
+      __ access_load_at(T_ADDRESS, IN_HEAP, rbx_index, member_vmindex, noreg, noreg);
       if (VerifyMethodHandles) {
         Label L;
         __ cmpl(rbx_index, 0);
--- a/src/hotspot/cpu/x86/templateTable_x86.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/x86/templateTable_x86.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -770,9 +770,10 @@
   // rax: index
   // rdx: array
   index_check(rdx, rax); // kills rbx
-  __ movl(rax, Address(rdx, rax,
-                       Address::times_4,
-                       arrayOopDesc::base_offset_in_bytes(T_INT)));
+  __ access_load_at(T_INT, IN_HEAP | IN_HEAP_ARRAY, rax,
+                    Address(rdx, rax, Address::times_4,
+                            arrayOopDesc::base_offset_in_bytes(T_INT)),
+                    noreg, noreg);
 }
 
 void TemplateTable::laload() {
@@ -782,8 +783,10 @@
   index_check(rdx, rax); // kills rbx
   NOT_LP64(__ mov(rbx, rax));
   // rbx,: index
-  __ movptr(rax, Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 0 * wordSize));
-  NOT_LP64(__ movl(rdx, Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 1 * wordSize)));
+  __ access_load_at(T_LONG, IN_HEAP | IN_HEAP_ARRAY, noreg /* ltos */,
+                    Address(rdx, rbx, Address::times_8,
+                            arrayOopDesc::base_offset_in_bytes(T_LONG)),
+                    noreg, noreg);
 }
 
 
@@ -793,9 +796,11 @@
   // rax: index
   // rdx: array
   index_check(rdx, rax); // kills rbx
-  __ load_float(Address(rdx, rax,
-                        Address::times_4,
-                        arrayOopDesc::base_offset_in_bytes(T_FLOAT)));
+  __ access_load_at(T_FLOAT, IN_HEAP | IN_HEAP_ARRAY, noreg /* ftos */,
+                    Address(rdx, rax,
+                            Address::times_4,
+                            arrayOopDesc::base_offset_in_bytes(T_FLOAT)),
+                    noreg, noreg);
 }
 
 void TemplateTable::daload() {
@@ -803,9 +808,11 @@
   // rax: index
   // rdx: array
   index_check(rdx, rax); // kills rbx
-  __ load_double(Address(rdx, rax,
-                         Address::times_8,
-                         arrayOopDesc::base_offset_in_bytes(T_DOUBLE)));
+  __ access_load_at(T_DOUBLE, IN_HEAP | IN_HEAP_ARRAY, noreg /* dtos */,
+                    Address(rdx, rax,
+                            Address::times_8,
+                            arrayOopDesc::base_offset_in_bytes(T_DOUBLE)),
+                    noreg, noreg);
 }
 
 void TemplateTable::aaload() {
@@ -826,7 +833,9 @@
   // rax: index
   // rdx: array
   index_check(rdx, rax); // kills rbx
-  __ load_signed_byte(rax, Address(rdx, rax, Address::times_1, arrayOopDesc::base_offset_in_bytes(T_BYTE)));
+  __ access_load_at(T_BYTE, IN_HEAP | IN_HEAP_ARRAY, rax,
+                    Address(rdx, rax, Address::times_1, arrayOopDesc::base_offset_in_bytes(T_BYTE)),
+                    noreg, noreg);
 }
 
 void TemplateTable::caload() {
@@ -834,7 +843,9 @@
   // rax: index
   // rdx: array
   index_check(rdx, rax); // kills rbx
-  __ load_unsigned_short(rax, Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)));
+  __ access_load_at(T_CHAR, IN_HEAP | IN_HEAP_ARRAY, rax,
+                    Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)),
+                    noreg, noreg);
 }
 
 // iload followed by caload frequent pair
@@ -847,10 +858,9 @@
   // rax: index
   // rdx: array
   index_check(rdx, rax); // kills rbx
-  __ load_unsigned_short(rax,
-                         Address(rdx, rax,
-                                 Address::times_2,
-                                 arrayOopDesc::base_offset_in_bytes(T_CHAR)));
+  __ access_load_at(T_CHAR, IN_HEAP | IN_HEAP_ARRAY, rax,
+                    Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_CHAR)),
+                    noreg, noreg);
 }
 
 
@@ -859,7 +869,9 @@
   // rax: index
   // rdx: array
   index_check(rdx, rax); // kills rbx
-  __ load_signed_short(rax, Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_SHORT)));
+  __ access_load_at(T_SHORT, IN_HEAP | IN_HEAP_ARRAY, rax,
+                    Address(rdx, rax, Address::times_2, arrayOopDesc::base_offset_in_bytes(T_SHORT)),
+                    noreg, noreg);
 }
 
 void TemplateTable::iload(int n) {
@@ -1051,10 +1063,10 @@
   // rbx: index
   // rdx: array
   index_check(rdx, rbx); // prefer index in rbx
-  __ movl(Address(rdx, rbx,
-                  Address::times_4,
-                  arrayOopDesc::base_offset_in_bytes(T_INT)),
-          rax);
+  __ access_store_at(T_INT, IN_HEAP | IN_HEAP_ARRAY,
+                     Address(rdx, rbx, Address::times_4,
+                             arrayOopDesc::base_offset_in_bytes(T_INT)),
+                     rax, noreg, noreg);
 }
 
 void TemplateTable::lastore() {
@@ -1065,8 +1077,10 @@
   // rdx: high(value)
   index_check(rcx, rbx);  // prefer index in rbx,
   // rbx,: index
-  __ movptr(Address(rcx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 0 * wordSize), rax);
-  NOT_LP64(__ movl(Address(rcx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_LONG) + 1 * wordSize), rdx));
+  __ access_store_at(T_LONG, IN_HEAP | IN_HEAP_ARRAY,
+                     Address(rcx, rbx, Address::times_8,
+                             arrayOopDesc::base_offset_in_bytes(T_LONG)),
+                     noreg /* ltos */, noreg, noreg);
 }
 
 
@@ -1077,7 +1091,10 @@
   // rbx:  index
   // rdx:  array
   index_check(rdx, rbx); // prefer index in rbx
-  __ store_float(Address(rdx, rbx, Address::times_4, arrayOopDesc::base_offset_in_bytes(T_FLOAT)));
+  __ access_store_at(T_FLOAT, IN_HEAP | IN_HEAP_ARRAY,
+                     Address(rdx, rbx, Address::times_4,
+                             arrayOopDesc::base_offset_in_bytes(T_FLOAT)),
+                     noreg /* ftos */, noreg, noreg);
 }
 
 void TemplateTable::dastore() {
@@ -1087,7 +1104,10 @@
   // rbx:  index
   // rdx:  array
   index_check(rdx, rbx); // prefer index in rbx
-  __ store_double(Address(rdx, rbx, Address::times_8, arrayOopDesc::base_offset_in_bytes(T_DOUBLE)));
+  __ access_store_at(T_DOUBLE, IN_HEAP | IN_HEAP_ARRAY,
+                     Address(rdx, rbx, Address::times_8,
+                             arrayOopDesc::base_offset_in_bytes(T_DOUBLE)),
+                     noreg /* dtos */, noreg, noreg);
 }
 
 void TemplateTable::aastore() {
@@ -1160,10 +1180,10 @@
   __ jccb(Assembler::zero, L_skip);
   __ andl(rax, 1);  // if it is a T_BOOLEAN array, mask the stored value to 0/1
   __ bind(L_skip);
-  __ movb(Address(rdx, rbx,
-                  Address::times_1,
-                  arrayOopDesc::base_offset_in_bytes(T_BYTE)),
-          rax);
+  __ access_store_at(T_BYTE, IN_HEAP | IN_HEAP_ARRAY,
+                     Address(rdx, rbx,Address::times_1,
+                             arrayOopDesc::base_offset_in_bytes(T_BYTE)),
+                     rax, noreg, noreg);
 }
 
 void TemplateTable::castore() {
@@ -1173,10 +1193,10 @@
   // rbx: index
   // rdx: array
   index_check(rdx, rbx);  // prefer index in rbx
-  __ movw(Address(rdx, rbx,
-                  Address::times_2,
-                  arrayOopDesc::base_offset_in_bytes(T_CHAR)),
-          rax);
+  __ access_store_at(T_CHAR, IN_HEAP | IN_HEAP_ARRAY,
+                     Address(rdx, rbx, Address::times_2,
+                             arrayOopDesc::base_offset_in_bytes(T_CHAR)),
+                     rax, noreg, noreg);
 }
 
 
@@ -2852,7 +2872,6 @@
   if (!is_static) pop_and_check_object(obj);
 
   const Address field(obj, off, Address::times_1, 0*wordSize);
-  NOT_LP64(const Address hi(obj, off, Address::times_1, 1*wordSize));
 
   Label Done, notByte, notBool, notInt, notShort, notChar, notLong, notFloat, notObj, notDouble;
 
@@ -2864,7 +2883,7 @@
 
   __ jcc(Assembler::notZero, notByte);
   // btos
-  __ load_signed_byte(rax, field);
+  __ access_load_at(T_BYTE, IN_HEAP, rax, field, noreg, noreg);
   __ push(btos);
   // Rewrite bytecode to be faster
   if (!is_static && rc == may_rewrite) {
@@ -2877,7 +2896,7 @@
   __ jcc(Assembler::notEqual, notBool);
 
   // ztos (same code as btos)
-  __ load_signed_byte(rax, field);
+  __ access_load_at(T_BOOLEAN, IN_HEAP, rax, field, noreg, noreg);
   __ push(ztos);
   // Rewrite bytecode to be faster
   if (!is_static && rc == may_rewrite) {
@@ -2901,7 +2920,7 @@
   __ cmpl(flags, itos);
   __ jcc(Assembler::notEqual, notInt);
   // itos
-  __ movl(rax, field);
+  __ access_load_at(T_INT, IN_HEAP, rax, field, noreg, noreg);
   __ push(itos);
   // Rewrite bytecode to be faster
   if (!is_static && rc == may_rewrite) {
@@ -2913,7 +2932,7 @@
   __ cmpl(flags, ctos);
   __ jcc(Assembler::notEqual, notChar);
   // ctos
-  __ load_unsigned_short(rax, field);
+  __ access_load_at(T_CHAR, IN_HEAP, rax, field, noreg, noreg);
   __ push(ctos);
   // Rewrite bytecode to be faster
   if (!is_static && rc == may_rewrite) {
@@ -2925,7 +2944,7 @@
   __ cmpl(flags, stos);
   __ jcc(Assembler::notEqual, notShort);
   // stos
-  __ load_signed_short(rax, field);
+  __ access_load_at(T_SHORT, IN_HEAP, rax, field, noreg, noreg);
   __ push(stos);
   // Rewrite bytecode to be faster
   if (!is_static && rc == may_rewrite) {
@@ -2937,19 +2956,9 @@
   __ cmpl(flags, ltos);
   __ jcc(Assembler::notEqual, notLong);
   // ltos
-
-#ifndef _LP64
-  // Generate code as if volatile.  There just aren't enough registers to
-  // save that information and this code is faster than the test.
-  __ fild_d(field);                // Must load atomically
-  __ subptr(rsp,2*wordSize);    // Make space for store
-  __ fistp_d(Address(rsp,0));
-  __ pop(rax);
-  __ pop(rdx);
-#else
-  __ movq(rax, field);
-#endif
-
+    // Generate code as if volatile (x86_32).  There just aren't enough registers to
+    // save that information and this code is faster than the test.
+  __ access_load_at(T_LONG, IN_HEAP | MO_RELAXED, noreg /* ltos */, field, noreg, noreg);
   __ push(ltos);
   // Rewrite bytecode to be faster
   LP64_ONLY(if (!is_static && rc == may_rewrite) patch_bytecode(Bytecodes::_fast_lgetfield, bc, rbx));
@@ -2960,7 +2969,7 @@
   __ jcc(Assembler::notEqual, notFloat);
   // ftos
 
-  __ load_float(field);
+  __ access_load_at(T_FLOAT, IN_HEAP, noreg /* ftos */, field, noreg, noreg);
   __ push(ftos);
   // Rewrite bytecode to be faster
   if (!is_static && rc == may_rewrite) {
@@ -2974,7 +2983,7 @@
   __ jcc(Assembler::notEqual, notDouble);
 #endif
   // dtos
-  __ load_double(field);
+  __ access_load_at(T_DOUBLE, IN_HEAP, noreg /* dtos */, field, noreg, noreg);
   __ push(dtos);
   // Rewrite bytecode to be faster
   if (!is_static && rc == may_rewrite) {
@@ -3133,7 +3142,7 @@
   {
     __ pop(btos);
     if (!is_static) pop_and_check_object(obj);
-    __ movb(field, rax);
+    __ access_store_at(T_BYTE, IN_HEAP, field, rax, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_bputfield, bc, rbx, true, byte_no);
     }
@@ -3148,8 +3157,7 @@
   {
     __ pop(ztos);
     if (!is_static) pop_and_check_object(obj);
-    __ andl(rax, 0x1);
-    __ movb(field, rax);
+    __ access_store_at(T_BOOLEAN, IN_HEAP, field, rax, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_zputfield, bc, rbx, true, byte_no);
     }
@@ -3180,7 +3188,7 @@
   {
     __ pop(itos);
     if (!is_static) pop_and_check_object(obj);
-    __ movl(field, rax);
+    __ access_store_at(T_INT, IN_HEAP, field, rax, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_iputfield, bc, rbx, true, byte_no);
     }
@@ -3195,7 +3203,7 @@
   {
     __ pop(ctos);
     if (!is_static) pop_and_check_object(obj);
-    __ movw(field, rax);
+    __ access_store_at(T_CHAR, IN_HEAP, field, rax, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_cputfield, bc, rbx, true, byte_no);
     }
@@ -3210,7 +3218,7 @@
   {
     __ pop(stos);
     if (!is_static) pop_and_check_object(obj);
-    __ movw(field, rax);
+    __ access_store_at(T_SHORT, IN_HEAP, field, rax, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_sputfield, bc, rbx, true, byte_no);
     }
@@ -3226,7 +3234,7 @@
   {
     __ pop(ltos);
     if (!is_static) pop_and_check_object(obj);
-    __ movq(field, rax);
+    __ access_store_at(T_LONG, IN_HEAP, field, noreg /* ltos*/, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_lputfield, bc, rbx, true, byte_no);
     }
@@ -3242,11 +3250,7 @@
     if (!is_static) pop_and_check_object(obj);
 
     // Replace with real volatile test
-    __ push(rdx);
-    __ push(rax);                 // Must update atomically with FIST
-    __ fild_d(Address(rsp,0));    // So load into FPU register
-    __ fistp_d(field);            // and put into memory atomically
-    __ addptr(rsp, 2*wordSize);
+    __ access_store_at(T_LONG, IN_HEAP | MO_RELAXED, field, noreg /* ltos */, noreg, noreg);
     // volatile_barrier();
     volatile_barrier(Assembler::Membar_mask_bits(Assembler::StoreLoad |
                                                  Assembler::StoreStore));
@@ -3257,8 +3261,7 @@
 
     __ pop(ltos);  // overwrites rdx
     if (!is_static) pop_and_check_object(obj);
-    __ movptr(hi, rdx);
-    __ movptr(field, rax);
+    __ access_store_at(T_LONG, IN_HEAP, field, noreg /* ltos */, noreg, noreg);
     // Don't rewrite to _fast_lputfield for potential volatile case.
     __ jmp(notVolatile);
   }
@@ -3272,7 +3275,7 @@
   {
     __ pop(ftos);
     if (!is_static) pop_and_check_object(obj);
-    __ store_float(field);
+    __ access_store_at(T_FLOAT, IN_HEAP, field, noreg /* ftos */, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_fputfield, bc, rbx, true, byte_no);
     }
@@ -3289,7 +3292,7 @@
   {
     __ pop(dtos);
     if (!is_static) pop_and_check_object(obj);
-    __ store_double(field);
+    __ access_store_at(T_DOUBLE, IN_HEAP, field, noreg /* dtos */, noreg, noreg);
     if (!is_static && rc == may_rewrite) {
       patch_bytecode(Bytecodes::_fast_dputfield, bc, rbx, true, byte_no);
     }
@@ -3422,30 +3425,31 @@
     break;
   case Bytecodes::_fast_lputfield:
 #ifdef _LP64
-  __ movq(field, rax);
+    __ access_store_at(T_LONG, IN_HEAP, field, noreg /* ltos */, noreg, noreg);
 #else
   __ stop("should not be rewritten");
 #endif
     break;
   case Bytecodes::_fast_iputfield:
-    __ movl(field, rax);
+    __ access_store_at(T_INT, IN_HEAP, field, rax, noreg, noreg);
     break;
   case Bytecodes::_fast_zputfield:
-    __ andl(rax, 0x1);  // boolean is true if LSB is 1
-    // fall through to bputfield
+    __ access_store_at(T_BOOLEAN, IN_HEAP, field, rax, noreg, noreg);
+    break;
   case Bytecodes::_fast_bputfield:
-    __ movb(field, rax);
+    __ access_store_at(T_BYTE, IN_HEAP, field, rax, noreg, noreg);
     break;
   case Bytecodes::_fast_sputfield:
-    // fall through
+    __ access_store_at(T_SHORT, IN_HEAP, field, rax, noreg, noreg);
+    break;
   case Bytecodes::_fast_cputfield:
-    __ movw(field, rax);
+    __ access_store_at(T_CHAR, IN_HEAP, field, rax, noreg, noreg);
     break;
   case Bytecodes::_fast_fputfield:
-    __ store_float(field);
+    __ access_store_at(T_FLOAT, IN_HEAP, field, noreg /* ftos*/, noreg, noreg);
     break;
   case Bytecodes::_fast_dputfield:
-    __ store_double(field);
+    __ access_store_at(T_DOUBLE, IN_HEAP, field, noreg /* dtos*/, noreg, noreg);
     break;
   default:
     ShouldNotReachHere();
@@ -3512,28 +3516,28 @@
     break;
   case Bytecodes::_fast_lgetfield:
 #ifdef _LP64
-  __ movq(rax, field);
+    __ access_load_at(T_LONG, IN_HEAP, noreg /* ltos */, field, noreg, noreg);
 #else
   __ stop("should not be rewritten");
 #endif
     break;
   case Bytecodes::_fast_igetfield:
-    __ movl(rax, field);
+    __ access_load_at(T_INT, IN_HEAP, rax, field, noreg, noreg);
     break;
   case Bytecodes::_fast_bgetfield:
-    __ movsbl(rax, field);
+    __ access_load_at(T_BYTE, IN_HEAP, rax, field, noreg, noreg);
     break;
   case Bytecodes::_fast_sgetfield:
-    __ load_signed_short(rax, field);
+    __ access_load_at(T_SHORT, IN_HEAP, rax, field, noreg, noreg);
     break;
   case Bytecodes::_fast_cgetfield:
-    __ load_unsigned_short(rax, field);
+    __ access_load_at(T_CHAR, IN_HEAP, rax, field, noreg, noreg);
     break;
   case Bytecodes::_fast_fgetfield:
-    __ load_float(field);
+    __ access_load_at(T_FLOAT, IN_HEAP, noreg /* ftos */, field, noreg, noreg);
     break;
   case Bytecodes::_fast_dgetfield:
-    __ load_double(field);
+    __ access_load_at(T_DOUBLE, IN_HEAP, noreg /* dtos */, field, noreg, noreg);
     break;
   default:
     ShouldNotReachHere();
@@ -3566,14 +3570,14 @@
   const Address field = Address(rax, rbx, Address::times_1, 0*wordSize);
   switch (state) {
   case itos:
-    __ movl(rax, field);
+    __ access_load_at(T_INT, IN_HEAP, rax, field, noreg, noreg);
     break;
   case atos:
     do_oop_load(_masm, field, rax);
     __ verify_oop(rax);
     break;
   case ftos:
-    __ load_float(field);
+    __ access_load_at(T_FLOAT, IN_HEAP, noreg /* ftos */, field, noreg, noreg);
     break;
   default:
     ShouldNotReachHere();
--- a/src/hotspot/cpu/x86/x86_64.ad	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/x86/x86_64.ad	Fri Jun 08 09:40:28 2018 -0700
@@ -11607,16 +11607,6 @@
   ins_pipe(ialu_cr_reg_imm);
 %}
 
-instruct compUB_mem_imm(rFlagsReg cr, memory mem, immU8 imm)
-%{
-  match(Set cr (CmpI (LoadUB mem) imm));
-
-  ins_cost(125);
-  format %{ "cmpb    $mem, $imm" %}
-  ins_encode %{ __ cmpb($mem$$Address, $imm$$constant); %}
-  ins_pipe(ialu_cr_reg_mem);
-%}
-
 instruct compB_mem_imm(rFlagsReg cr, memory mem, immI8 imm)
 %{
   match(Set cr (CmpI (LoadB mem) imm));
@@ -11627,16 +11617,6 @@
   ins_pipe(ialu_cr_reg_mem);
 %}
 
-instruct testUB_mem_imm(rFlagsReg cr, memory mem, immU8 imm, immI0 zero)
-%{
-  match(Set cr (CmpI (AndI (LoadUB mem) imm) zero));
-
-  ins_cost(125);
-  format %{ "testb   $mem, $imm" %}
-  ins_encode %{ __ testb($mem$$Address, $imm$$constant); %}
-  ins_pipe(ialu_cr_reg_mem);
-%}
-
 instruct testB_mem_imm(rFlagsReg cr, memory mem, immI8 imm, immI0 zero)
 %{
   match(Set cr (CmpI (AndI (LoadB mem) imm) zero));
--- a/src/hotspot/cpu/zero/cppInterpreter_zero.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/cpu/zero/cppInterpreter_zero.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -43,7 +43,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/jniHandles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/synchronizer.hpp"
--- a/src/hotspot/os/aix/os_aix.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/os/aix/os_aix.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -59,7 +59,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
--- a/src/hotspot/os/bsd/os_bsd.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/os/bsd/os_bsd.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -49,7 +49,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/semaphore.hpp"
--- a/src/hotspot/os/linux/os_linux.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/os/linux/os_linux.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -51,7 +51,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/src/hotspot/os/solaris/os_solaris.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/os/solaris/os_solaris.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -49,7 +49,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/src/hotspot/os/windows/os_windows.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/os/windows/os_windows.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -52,7 +52,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/perfMemory.hpp"
 #include "runtime/sharedRuntime.hpp"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/aix_ppc/orderAccess_aix_ppc.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_HPP
+#define OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_HPP
+
+// Included in orderAccess.hpp header file.
+
+// Compiler version last used for testing: xlc 12
+// Please update this information when this file changes
+
+// Implementation of class OrderAccess.
+
+//
+// Machine barrier instructions:
+//
+// - sync            Two-way memory barrier, aka fence.
+// - lwsync          orders  Store|Store,
+//                            Load|Store,
+//                            Load|Load,
+//                   but not Store|Load
+// - eieio           orders  Store|Store
+// - isync           Invalidates speculatively executed instructions,
+//                   but isync may complete before storage accesses
+//                   associated with instructions preceding isync have
+//                   been performed.
+//
+// Semantic barrier instructions:
+// (as defined in orderAccess.hpp)
+//
+// - release         orders Store|Store,       (maps to lwsync)
+//                           Load|Store
+// - acquire         orders  Load|Store,       (maps to lwsync)
+//                           Load|Load
+// - fence           orders Store|Store,       (maps to sync)
+//                           Load|Store,
+//                           Load|Load,
+//                          Store|Load
+//
+
+#define inlasm_sync()     __asm__ __volatile__ ("sync"   : : : "memory");
+#define inlasm_lwsync()   __asm__ __volatile__ ("lwsync" : : : "memory");
+#define inlasm_eieio()    __asm__ __volatile__ ("eieio"  : : : "memory");
+#define inlasm_isync()    __asm__ __volatile__ ("isync"  : : : "memory");
+// Use twi-isync for load_acquire (faster than lwsync).
+// ATTENTION: seems like xlC 10.1 has problems with this inline assembler macro (VerifyMethodHandles found "bad vminfo in AMH.conv"):
+// #define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
+#define inlasm_acquire_reg(X) inlasm_lwsync();
+
+inline void OrderAccess::loadload()   { inlasm_lwsync(); }
+inline void OrderAccess::storestore() { inlasm_lwsync(); }
+inline void OrderAccess::loadstore()  { inlasm_lwsync(); }
+inline void OrderAccess::storeload()  { inlasm_sync();   }
+
+inline void OrderAccess::acquire()    { inlasm_lwsync(); }
+inline void OrderAccess::release()    { inlasm_lwsync(); }
+inline void OrderAccess::fence()      { inlasm_sync();   }
+
+template<size_t byte_size>
+struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const { register T t = Atomic::load(p); inlasm_acquire_reg(t); return t; }
+};
+
+#undef inlasm_sync
+#undef inlasm_lwsync
+#undef inlasm_eieio
+#undef inlasm_isync
+
+#endif // OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_HPP
--- a/src/hotspot/os_cpu/aix_ppc/orderAccess_aix_ppc.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_INLINE_HPP
-#define OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-
-// Compiler version last used for testing: xlc 12
-// Please update this information when this file changes
-
-// Implementation of class OrderAccess.
-
-//
-// Machine barrier instructions:
-//
-// - sync            Two-way memory barrier, aka fence.
-// - lwsync          orders  Store|Store,
-//                            Load|Store,
-//                            Load|Load,
-//                   but not Store|Load
-// - eieio           orders  Store|Store
-// - isync           Invalidates speculatively executed instructions,
-//                   but isync may complete before storage accesses
-//                   associated with instructions preceding isync have
-//                   been performed.
-//
-// Semantic barrier instructions:
-// (as defined in orderAccess.hpp)
-//
-// - release         orders Store|Store,       (maps to lwsync)
-//                           Load|Store
-// - acquire         orders  Load|Store,       (maps to lwsync)
-//                           Load|Load
-// - fence           orders Store|Store,       (maps to sync)
-//                           Load|Store,
-//                           Load|Load,
-//                          Store|Load
-//
-
-#define inlasm_sync()     __asm__ __volatile__ ("sync"   : : : "memory");
-#define inlasm_lwsync()   __asm__ __volatile__ ("lwsync" : : : "memory");
-#define inlasm_eieio()    __asm__ __volatile__ ("eieio"  : : : "memory");
-#define inlasm_isync()    __asm__ __volatile__ ("isync"  : : : "memory");
-// Use twi-isync for load_acquire (faster than lwsync).
-// ATTENTION: seems like xlC 10.1 has problems with this inline assembler macro (VerifyMethodHandles found "bad vminfo in AMH.conv"):
-// #define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
-#define inlasm_acquire_reg(X) inlasm_lwsync();
-
-inline void OrderAccess::loadload()   { inlasm_lwsync(); }
-inline void OrderAccess::storestore() { inlasm_lwsync(); }
-inline void OrderAccess::loadstore()  { inlasm_lwsync(); }
-inline void OrderAccess::storeload()  { inlasm_sync();   }
-
-inline void OrderAccess::acquire()    { inlasm_lwsync(); }
-inline void OrderAccess::release()    { inlasm_lwsync(); }
-inline void OrderAccess::fence()      { inlasm_sync();   }
-
-template<size_t byte_size>
-struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const { register T t = Atomic::load(p); inlasm_acquire_reg(t); return t; }
-};
-
-#undef inlasm_sync
-#undef inlasm_lwsync
-#undef inlasm_eieio
-#undef inlasm_isync
-
-#endif // OS_CPU_AIX_OJDKPPC_VM_ORDERACCESS_AIX_PPC_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/bsd_x86/orderAccess_bsd_x86.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_HPP
+#define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_HPP
+
+// Included in orderAccess.hpp header file.
+
+// Compiler version last used for testing: clang 5.1
+// Please update this information when this file changes
+
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+static inline void compiler_barrier() {
+  __asm__ volatile ("" : : : "memory");
+}
+
+// x86 is TSO and hence only needs a fence for storeload
+// However, a compiler barrier is still needed to prevent reordering
+// between volatile and non-volatile memory accesses.
+
+// Implementation of class OrderAccess.
+
+inline void OrderAccess::loadload()   { compiler_barrier(); }
+inline void OrderAccess::storestore() { compiler_barrier(); }
+inline void OrderAccess::loadstore()  { compiler_barrier(); }
+inline void OrderAccess::storeload()  { fence();            }
+
+inline void OrderAccess::acquire()    { compiler_barrier(); }
+inline void OrderAccess::release()    { compiler_barrier(); }
+
+inline void OrderAccess::fence() {
+  // always use locked addl since mfence is sometimes expensive
+#ifdef AMD64
+  __asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
+#else
+  __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
+#endif
+  compiler_barrier();
+}
+
+template<>
+struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgb (%2),%0"
+                      : "=q" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgw (%2),%0"
+                      : "=r" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgl (%2),%0"
+                      : "=r" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+
+#ifdef AMD64
+template<>
+struct OrderAccess::PlatformOrderedStore<8, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgq (%2), %0"
+                      : "=r" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+#endif // AMD64
+
+#endif // OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_HPP
--- a/src/hotspot/os_cpu/bsd_x86/orderAccess_bsd_x86.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
-#define OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/orderAccess.hpp"
-#include "runtime/os.hpp"
-
-// Compiler version last used for testing: clang 5.1
-// Please update this information when this file changes
-
-// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
-static inline void compiler_barrier() {
-  __asm__ volatile ("" : : : "memory");
-}
-
-// x86 is TSO and hence only needs a fence for storeload
-// However, a compiler barrier is still needed to prevent reordering
-// between volatile and non-volatile memory accesses.
-
-// Implementation of class OrderAccess.
-
-inline void OrderAccess::loadload()   { compiler_barrier(); }
-inline void OrderAccess::storestore() { compiler_barrier(); }
-inline void OrderAccess::loadstore()  { compiler_barrier(); }
-inline void OrderAccess::storeload()  { fence();            }
-
-inline void OrderAccess::acquire()    { compiler_barrier(); }
-inline void OrderAccess::release()    { compiler_barrier(); }
-
-inline void OrderAccess::fence() {
-  if (os::is_MP()) {
-    // always use locked addl since mfence is sometimes expensive
-#ifdef AMD64
-    __asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
-#else
-    __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
-#endif
-  }
-  compiler_barrier();
-}
-
-template<>
-struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgb (%2),%0"
-                      : "=q" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgw (%2),%0"
-                      : "=r" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgl (%2),%0"
-                      : "=r" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-
-#ifdef AMD64
-template<>
-struct OrderAccess::PlatformOrderedStore<8, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgq (%2), %0"
-                      : "=r" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-#endif // AMD64
-
-#endif // OS_CPU_BSD_X86_VM_ORDERACCESS_BSD_X86_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/bsd_zero/orderAccess_bsd_zero.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2007, 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_HPP
+#define OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_HPP
+
+// Included in orderAccess.hpp header file.
+
+#ifdef ARM
+
+/*
+ * ARM Kernel helper for memory barrier.
+ * Using __asm __volatile ("":::"memory") does not work reliable on ARM
+ * and gcc __sync_synchronize(); implementation does not use the kernel
+ * helper for all gcc versions so it is unreliable to use as well.
+ */
+typedef void (__kernel_dmb_t) (void);
+#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
+
+#define FULL_MEM_BARRIER __kernel_dmb()
+#define LIGHT_MEM_BARRIER __kernel_dmb()
+
+#else // ARM
+
+#define FULL_MEM_BARRIER __sync_synchronize()
+
+#ifdef PPC
+
+#ifdef __NO_LWSYNC__
+#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
+#else
+#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
+#endif
+
+#else // PPC
+
+#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
+
+#endif // PPC
+
+#endif // ARM
+
+// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
+// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.
+
+inline void OrderAccess::loadload()   { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::storestore() { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::loadstore()  { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::storeload()  { FULL_MEM_BARRIER;  }
+
+inline void OrderAccess::acquire()    { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::release()    { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::fence()      { FULL_MEM_BARRIER;  }
+
+#endif // OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_HPP
--- a/src/hotspot/os_cpu/bsd_zero/orderAccess_bsd_zero.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP
-#define OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-
-#ifdef ARM
-
-/*
- * ARM Kernel helper for memory barrier.
- * Using __asm __volatile ("":::"memory") does not work reliable on ARM
- * and gcc __sync_synchronize(); implementation does not use the kernel
- * helper for all gcc versions so it is unreliable to use as well.
- */
-typedef void (__kernel_dmb_t) (void);
-#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
-
-#define FULL_MEM_BARRIER __kernel_dmb()
-#define LIGHT_MEM_BARRIER __kernel_dmb()
-
-#else // ARM
-
-#define FULL_MEM_BARRIER __sync_synchronize()
-
-#ifdef PPC
-
-#ifdef __NO_LWSYNC__
-#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
-#else
-#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
-#endif
-
-#else // PPC
-
-#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
-
-#endif // PPC
-
-#endif // ARM
-
-// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
-// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.
-
-inline void OrderAccess::loadload()   { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::storestore() { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::loadstore()  { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::storeload()  { FULL_MEM_BARRIER;  }
-
-inline void OrderAccess::acquire()    { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::release()    { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::fence()      { FULL_MEM_BARRIER;  }
-
-#endif // OS_CPU_BSD_ZERO_VM_ORDERACCESS_BSD_ZERO_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_aarch64/orderAccess_linux_aarch64.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2003, 2018, 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.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP
+#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP
+
+// Included in orderAccess.hpp header file.
+
+#include "vm_version_aarch64.hpp"
+
+// Implementation of class OrderAccess.
+
+inline void OrderAccess::loadload()   { acquire(); }
+inline void OrderAccess::storestore() { release(); }
+inline void OrderAccess::loadstore()  { acquire(); }
+inline void OrderAccess::storeload()  { fence(); }
+
+inline void OrderAccess::acquire() {
+  READ_MEM_BARRIER;
+}
+
+inline void OrderAccess::release() {
+  WRITE_MEM_BARRIER;
+}
+
+inline void OrderAccess::fence() {
+  FULL_MEM_BARRIER;
+}
+
+template<size_t byte_size>
+struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const { T data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; }
+};
+
+template<size_t byte_size>
+struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); }
+};
+
+template<size_t byte_size>
+struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const { release_store(p, v); fence(); }
+};
+
+#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_HPP
--- a/src/hotspot/os_cpu/linux_aarch64/orderAccess_linux_aarch64.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-/*
- * Copyright (c) 2003, 2018, 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.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP
-#define OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/orderAccess.hpp"
-#include "runtime/os.hpp"
-#include "vm_version_aarch64.hpp"
-
-// Implementation of class OrderAccess.
-
-inline void OrderAccess::loadload()   { acquire(); }
-inline void OrderAccess::storestore() { release(); }
-inline void OrderAccess::loadstore()  { acquire(); }
-inline void OrderAccess::storeload()  { fence(); }
-
-inline void OrderAccess::acquire() {
-  READ_MEM_BARRIER;
-}
-
-inline void OrderAccess::release() {
-  WRITE_MEM_BARRIER;
-}
-
-inline void OrderAccess::fence() {
-  FULL_MEM_BARRIER;
-}
-
-template<size_t byte_size>
-struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const { T data; __atomic_load(p, &data, __ATOMIC_ACQUIRE); return data; }
-};
-
-template<size_t byte_size>
-struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const { __atomic_store(p, &v, __ATOMIC_RELEASE); }
-};
-
-template<size_t byte_size>
-struct OrderAccess::PlatformOrderedStore<byte_size, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const { release_store(p, v); fence(); }
-};
-
-#endif // OS_CPU_LINUX_AARCH64_VM_ORDERACCESS_LINUX_AARCH64_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef OS_CPU_LINUX_ARM_VM_ORDERACCESS_LINUX_ARM_HPP
+#define OS_CPU_LINUX_ARM_VM_ORDERACCESS_LINUX_ARM_HPP
+
+// Included in orderAccess.hpp header file.
+
+#include "runtime/os.hpp"
+#include "vm_version_arm.hpp"
+
+// Implementation of class OrderAccess.
+// - we define the high level barriers below and use the general
+//   implementation in orderAccess.hpp, with customizations
+//   on AARCH64 via the specialized_* template functions
+
+// Memory Ordering on ARM is weak.
+//
+// Implement all 4 memory ordering barriers by DMB, since it is a
+// lighter version of DSB.
+// dmb_sy implies full system shareability domain. RD/WR access type.
+// dmb_st implies full system shareability domain. WR only access type.
+//
+// NOP on < ARMv6 (MP not supported)
+//
+// Non mcr instructions can be used if we build for armv7 or higher arch
+//    __asm__ __volatile__ ("dmb" : : : "memory");
+//    __asm__ __volatile__ ("dsb" : : : "memory");
+//
+// inline void _OrderAccess_dsb() {
+//    volatile intptr_t dummy = 0;
+//    if (os::is_MP()) {
+//      __asm__ volatile (
+//        "mcr p15, 0, %0, c7, c10, 4"
+//        : : "r" (dummy) : "memory");
+//    }
+// }
+
+inline static void dmb_sy() {
+   if (!os::is_MP()) {
+     return;
+   }
+#ifdef AARCH64
+   __asm__ __volatile__ ("dmb sy" : : : "memory");
+#else
+   if (VM_Version::arm_arch() >= 7) {
+#ifdef __thumb__
+     __asm__ volatile (
+     "dmb sy": : : "memory");
+#else
+     __asm__ volatile (
+     ".word 0xF57FF050 | 0xf" : : : "memory");
+#endif
+   } else {
+     intptr_t zero = 0;
+     __asm__ volatile (
+       "mcr p15, 0, %0, c7, c10, 5"
+       : : "r" (zero) : "memory");
+   }
+#endif
+}
+
+inline static void dmb_st() {
+   if (!os::is_MP()) {
+     return;
+   }
+#ifdef AARCH64
+   __asm__ __volatile__ ("dmb st" : : : "memory");
+#else
+   if (VM_Version::arm_arch() >= 7) {
+#ifdef __thumb__
+     __asm__ volatile (
+     "dmb st": : : "memory");
+#else
+     __asm__ volatile (
+     ".word 0xF57FF050 | 0xe" : : : "memory");
+#endif
+   } else {
+     intptr_t zero = 0;
+     __asm__ volatile (
+       "mcr p15, 0, %0, c7, c10, 5"
+       : : "r" (zero) : "memory");
+   }
+#endif
+}
+
+// Load-Load/Store barrier
+inline static void dmb_ld() {
+#ifdef AARCH64
+   if (!os::is_MP()) {
+     return;
+   }
+   __asm__ __volatile__ ("dmb ld" : : : "memory");
+#else
+   dmb_sy();
+#endif
+}
+
+
+inline void OrderAccess::loadload()   { dmb_ld(); }
+inline void OrderAccess::loadstore()  { dmb_ld(); }
+inline void OrderAccess::acquire()    { dmb_ld(); }
+inline void OrderAccess::storestore() { dmb_st(); }
+inline void OrderAccess::storeload()  { dmb_sy(); }
+inline void OrderAccess::release()    { dmb_sy(); }
+inline void OrderAccess::fence()      { dmb_sy(); }
+
+// specializations for Aarch64
+// TODO-AARCH64: evaluate effectiveness of ldar*/stlr* implementations compared to 32-bit ARM approach
+
+#ifdef AARCH64
+
+template<>
+struct OrderAccess::PlatformOrderedLoad<1, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const {
+    volatile T result;
+    __asm__ volatile(
+      "ldarb %w[res], [%[ptr]]"
+      : [res] "=&r" (result)
+      : [ptr] "r" (p)
+      : "memory");
+    return result;
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedLoad<2, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const {
+    volatile T result;
+    __asm__ volatile(
+      "ldarh %w[res], [%[ptr]]"
+      : [res] "=&r" (result)
+      : [ptr] "r" (p)
+      : "memory");
+    return result;
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedLoad<4, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const {
+    volatile T result;
+    __asm__ volatile(
+      "ldar %w[res], [%[ptr]]"
+      : [res] "=&r" (result)
+      : [ptr] "r" (p)
+      : "memory");
+    return result;
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedLoad<8, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const {
+    volatile T result;
+    __asm__ volatile(
+      "ldar %[res], [%[ptr]]"
+      : [res] "=&r" (result)
+      : [ptr] "r" (p)
+      : "memory");
+    return result;
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile(
+      "stlrb %w[val], [%[ptr]]"
+      :
+      : [ptr] "r" (p), [val] "r" (v)
+      : "memory");
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile(
+      "stlrh %w[val], [%[ptr]]"
+      :
+      : [ptr] "r" (p), [val] "r" (v)
+      : "memory");
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile(
+      "stlr %w[val], [%[ptr]]"
+      :
+      : [ptr] "r" (p), [val] "r" (v)
+      : "memory");
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<8, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile(
+      "stlr %[val], [%[ptr]]"
+      :
+      : [ptr] "r" (p), [val] "r" (v)
+      : "memory");
+  }
+};
+
+#endif // AARCH64
+
+#endif // OS_CPU_LINUX_ARM_VM_ORDERACCESS_LINUX_ARM_HPP
--- a/src/hotspot/os_cpu/linux_arm/orderAccess_linux_arm.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-/*
- * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_LINUX_ARM_VM_ORDERACCESS_LINUX_ARM_INLINE_HPP
-#define OS_CPU_LINUX_ARM_VM_ORDERACCESS_LINUX_ARM_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-#include "runtime/os.hpp"
-#include "vm_version_arm.hpp"
-
-// Implementation of class OrderAccess.
-// - we define the high level barriers below and use the general
-//   implementation in orderAccess.inline.hpp, with customizations
-//   on AARCH64 via the specialized_* template functions
-
-// Memory Ordering on ARM is weak.
-//
-// Implement all 4 memory ordering barriers by DMB, since it is a
-// lighter version of DSB.
-// dmb_sy implies full system shareability domain. RD/WR access type.
-// dmb_st implies full system shareability domain. WR only access type.
-//
-// NOP on < ARMv6 (MP not supported)
-//
-// Non mcr instructions can be used if we build for armv7 or higher arch
-//    __asm__ __volatile__ ("dmb" : : : "memory");
-//    __asm__ __volatile__ ("dsb" : : : "memory");
-//
-// inline void _OrderAccess_dsb() {
-//    volatile intptr_t dummy = 0;
-//    if (os::is_MP()) {
-//      __asm__ volatile (
-//        "mcr p15, 0, %0, c7, c10, 4"
-//        : : "r" (dummy) : "memory");
-//   }
-// }
-
-inline static void dmb_sy() {
-   if (!os::is_MP()) {
-     return;
-   }
-#ifdef AARCH64
-   __asm__ __volatile__ ("dmb sy" : : : "memory");
-#else
-   if (VM_Version::arm_arch() >= 7) {
-#ifdef __thumb__
-     __asm__ volatile (
-     "dmb sy": : : "memory");
-#else
-     __asm__ volatile (
-     ".word 0xF57FF050 | 0xf" : : : "memory");
-#endif
-   } else {
-     intptr_t zero = 0;
-     __asm__ volatile (
-       "mcr p15, 0, %0, c7, c10, 5"
-       : : "r" (zero) : "memory");
-   }
-#endif
-}
-
-inline static void dmb_st() {
-   if (!os::is_MP()) {
-     return;
-   }
-#ifdef AARCH64
-   __asm__ __volatile__ ("dmb st" : : : "memory");
-#else
-   if (VM_Version::arm_arch() >= 7) {
-#ifdef __thumb__
-     __asm__ volatile (
-     "dmb st": : : "memory");
-#else
-     __asm__ volatile (
-     ".word 0xF57FF050 | 0xe" : : : "memory");
-#endif
-   } else {
-     intptr_t zero = 0;
-     __asm__ volatile (
-       "mcr p15, 0, %0, c7, c10, 5"
-       : : "r" (zero) : "memory");
-   }
-#endif
-}
-
-// Load-Load/Store barrier
-inline static void dmb_ld() {
-#ifdef AARCH64
-   if (!os::is_MP()) {
-     return;
-   }
-   __asm__ __volatile__ ("dmb ld" : : : "memory");
-#else
-   dmb_sy();
-#endif
-}
-
-
-inline void OrderAccess::loadload()   { dmb_ld(); }
-inline void OrderAccess::loadstore()  { dmb_ld(); }
-inline void OrderAccess::acquire()    { dmb_ld(); }
-inline void OrderAccess::storestore() { dmb_st(); }
-inline void OrderAccess::storeload()  { dmb_sy(); }
-inline void OrderAccess::release()    { dmb_sy(); }
-inline void OrderAccess::fence()      { dmb_sy(); }
-
-// specializations for Aarch64
-// TODO-AARCH64: evaluate effectiveness of ldar*/stlr* implementations compared to 32-bit ARM approach
-
-#ifdef AARCH64
-
-template<>
-struct OrderAccess::PlatformOrderedLoad<1, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const {
-    volatile T result;
-    __asm__ volatile(
-      "ldarb %w[res], [%[ptr]]"
-      : [res] "=&r" (result)
-      : [ptr] "r" (p)
-      : "memory");
-    return result;
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedLoad<2, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const {
-    volatile T result;
-    __asm__ volatile(
-      "ldarh %w[res], [%[ptr]]"
-      : [res] "=&r" (result)
-      : [ptr] "r" (p)
-      : "memory");
-    return result;
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedLoad<4, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const {
-    volatile T result;
-    __asm__ volatile(
-      "ldar %w[res], [%[ptr]]"
-      : [res] "=&r" (result)
-      : [ptr] "r" (p)
-      : "memory");
-    return result;
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedLoad<8, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const {
-    volatile T result;
-    __asm__ volatile(
-      "ldar %[res], [%[ptr]]"
-      : [res] "=&r" (result)
-      : [ptr] "r" (p)
-      : "memory");
-    return result;
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile(
-      "stlrb %w[val], [%[ptr]]"
-      :
-      : [ptr] "r" (p), [val] "r" (v)
-      : "memory");
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile(
-      "stlrh %w[val], [%[ptr]]"
-      :
-      : [ptr] "r" (p), [val] "r" (v)
-      : "memory");
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile(
-      "stlr %w[val], [%[ptr]]"
-      :
-      : [ptr] "r" (p), [val] "r" (v)
-      : "memory");
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<8, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile(
-      "stlr %[val], [%[ptr]]"
-      :
-      : [ptr] "r" (p), [val] "r" (v)
-      : "memory");
-  }
-};
-
-#endif // AARCH64
-
-#endif // OS_CPU_LINUX_ARM_VM_ORDERACCESS_LINUX_ARM_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_ppc/orderAccess_linux_ppc.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_HPP
+#define OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_HPP
+
+// Included in orderAccess.hpp header file.
+
+#ifndef PPC64
+#error "OrderAccess currently only implemented for PPC64"
+#endif
+
+// Compiler version last used for testing: gcc 4.1.2
+// Please update this information when this file changes
+
+// Implementation of class OrderAccess.
+
+//
+// Machine barrier instructions:
+//
+// - sync            Two-way memory barrier, aka fence.
+// - lwsync          orders  Store|Store,
+//                            Load|Store,
+//                            Load|Load,
+//                   but not Store|Load
+// - eieio           orders  Store|Store
+// - isync           Invalidates speculatively executed instructions,
+//                   but isync may complete before storage accesses
+//                   associated with instructions preceding isync have
+//                   been performed.
+//
+// Semantic barrier instructions:
+// (as defined in orderAccess.hpp)
+//
+// - release         orders Store|Store,       (maps to lwsync)
+//                           Load|Store
+// - acquire         orders  Load|Store,       (maps to lwsync)
+//                           Load|Load
+// - fence           orders Store|Store,       (maps to sync)
+//                           Load|Store,
+//                           Load|Load,
+//                          Store|Load
+//
+
+#define inlasm_sync()     __asm__ __volatile__ ("sync"   : : : "memory");
+#define inlasm_lwsync()   __asm__ __volatile__ ("lwsync" : : : "memory");
+#define inlasm_eieio()    __asm__ __volatile__ ("eieio"  : : : "memory");
+#define inlasm_isync()    __asm__ __volatile__ ("isync"  : : : "memory");
+// Use twi-isync for load_acquire (faster than lwsync).
+#define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
+
+inline void   OrderAccess::loadload()   { inlasm_lwsync(); }
+inline void   OrderAccess::storestore() { inlasm_lwsync(); }
+inline void   OrderAccess::loadstore()  { inlasm_lwsync(); }
+inline void   OrderAccess::storeload()  { inlasm_sync();   }
+
+inline void   OrderAccess::acquire()    { inlasm_lwsync(); }
+inline void   OrderAccess::release()    { inlasm_lwsync(); }
+inline void   OrderAccess::fence()      { inlasm_sync();   }
+
+
+template<size_t byte_size>
+struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const { register T t = Atomic::load(p); inlasm_acquire_reg(t); return t; }
+};
+
+#undef inlasm_sync
+#undef inlasm_lwsync
+#undef inlasm_eieio
+#undef inlasm_isync
+#undef inlasm_acquire_reg
+
+#endif // OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_HPP
--- a/src/hotspot/os_cpu/linux_ppc/orderAccess_linux_ppc.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2014 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
-#define OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-
-#ifndef PPC64
-#error "OrderAccess currently only implemented for PPC64"
-#endif
-
-// Compiler version last used for testing: gcc 4.1.2
-// Please update this information when this file changes
-
-// Implementation of class OrderAccess.
-
-//
-// Machine barrier instructions:
-//
-// - sync            Two-way memory barrier, aka fence.
-// - lwsync          orders  Store|Store,
-//                            Load|Store,
-//                            Load|Load,
-//                   but not Store|Load
-// - eieio           orders  Store|Store
-// - isync           Invalidates speculatively executed instructions,
-//                   but isync may complete before storage accesses
-//                   associated with instructions preceding isync have
-//                   been performed.
-//
-// Semantic barrier instructions:
-// (as defined in orderAccess.hpp)
-//
-// - release         orders Store|Store,       (maps to lwsync)
-//                           Load|Store
-// - acquire         orders  Load|Store,       (maps to lwsync)
-//                           Load|Load
-// - fence           orders Store|Store,       (maps to sync)
-//                           Load|Store,
-//                           Load|Load,
-//                          Store|Load
-//
-
-#define inlasm_sync()     __asm__ __volatile__ ("sync"   : : : "memory");
-#define inlasm_lwsync()   __asm__ __volatile__ ("lwsync" : : : "memory");
-#define inlasm_eieio()    __asm__ __volatile__ ("eieio"  : : : "memory");
-#define inlasm_isync()    __asm__ __volatile__ ("isync"  : : : "memory");
-// Use twi-isync for load_acquire (faster than lwsync).
-#define inlasm_acquire_reg(X) __asm__ __volatile__ ("twi 0,%0,0\n isync\n" : : "r" (X) : "memory");
-
-inline void   OrderAccess::loadload()   { inlasm_lwsync(); }
-inline void   OrderAccess::storestore() { inlasm_lwsync(); }
-inline void   OrderAccess::loadstore()  { inlasm_lwsync(); }
-inline void   OrderAccess::storeload()  { inlasm_sync();   }
-
-inline void   OrderAccess::acquire()    { inlasm_lwsync(); }
-inline void   OrderAccess::release()    { inlasm_lwsync(); }
-inline void   OrderAccess::fence()      { inlasm_sync();   }
-
-
-template<size_t byte_size>
-struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const { register T t = Atomic::load(p); inlasm_acquire_reg(t); return t; }
-};
-
-#undef inlasm_sync
-#undef inlasm_lwsync
-#undef inlasm_eieio
-#undef inlasm_isync
-#undef inlasm_acquire_reg
-
-#endif // OS_CPU_LINUX_PPC_VM_ORDERACCESS_LINUX_PPC_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_s390/orderAccess_linux_s390.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_LINUX_S390_VM_ORDERACCESS_LINUX_S390_HPP
+#define OS_CPU_LINUX_S390_VM_ORDERACCESS_LINUX_S390_HPP
+
+// Included in orderAccess.hpp header file.
+
+#include "vm_version_s390.hpp"
+
+// Implementation of class OrderAccess.
+
+//
+// machine barrier instructions:
+//
+//   - z_sync            two-way memory barrier, aka fence
+//
+// semantic barrier instructions:
+// (as defined in orderAccess.hpp)
+//
+//   - z_release         orders Store|Store,    (maps to compiler barrier)
+//                               Load|Store
+//   - z_acquire         orders  Load|Store,    (maps to compiler barrier)
+//                               Load|Load
+//   - z_fence           orders Store|Store,    (maps to z_sync)
+//                               Load|Store,
+//                               Load|Load,
+//                              Store|Load
+//
+
+
+// Only load-after-store-order is not guaranteed on z/Architecture, i.e. only 'fence'
+// is needed.
+
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions.
+#define inlasm_compiler_barrier() __asm__ volatile ("" : : : "memory");
+// "bcr 15, 0" is used as two way memory barrier.
+#define inlasm_zarch_sync() __asm__ __volatile__ ("bcr 15, 0" : : : "memory");
+
+// Release and acquire are empty on z/Architecture, but potential
+// optimizations of gcc must be forbidden by OrderAccess::release and
+// OrderAccess::acquire.
+#define inlasm_zarch_release() inlasm_compiler_barrier()
+#define inlasm_zarch_acquire() inlasm_compiler_barrier()
+#define inlasm_zarch_fence()   inlasm_zarch_sync()
+
+inline void OrderAccess::loadload()   { inlasm_compiler_barrier(); }
+inline void OrderAccess::storestore() { inlasm_compiler_barrier(); }
+inline void OrderAccess::loadstore()  { inlasm_compiler_barrier(); }
+inline void OrderAccess::storeload()  { inlasm_zarch_sync(); }
+
+inline void OrderAccess::acquire()    { inlasm_zarch_acquire(); }
+inline void OrderAccess::release()    { inlasm_zarch_release(); }
+inline void OrderAccess::fence()      { inlasm_zarch_sync(); }
+
+template<size_t byte_size>
+struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
+{
+  template <typename T>
+  T operator()(const volatile T* p) const { register T t = *p; inlasm_zarch_acquire(); return t; }
+};
+
+#undef inlasm_compiler_barrier
+#undef inlasm_zarch_sync
+#undef inlasm_zarch_release
+#undef inlasm_zarch_acquire
+#undef inlasm_zarch_fence
+
+#endif // OS_CPU_LINUX_S390_VM_ORDERACCESS_LINUX_S390_HPP
--- a/src/hotspot/os_cpu/linux_s390/orderAccess_linux_s390.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2016 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_LINUX_S390_VM_ORDERACCESS_LINUX_S390_INLINE_HPP
-#define OS_CPU_LINUX_S390_VM_ORDERACCESS_LINUX_S390_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-#include "vm_version_s390.hpp"
-
-// Implementation of class OrderAccess.
-
-//
-// machine barrier instructions:
-//
-//   - z_sync            two-way memory barrier, aka fence
-//
-// semantic barrier instructions:
-// (as defined in orderAccess.hpp)
-//
-//   - z_release         orders Store|Store,    (maps to compiler barrier)
-//                               Load|Store
-//   - z_acquire         orders  Load|Store,    (maps to compiler barrier)
-//                               Load|Load
-//   - z_fence           orders Store|Store,    (maps to z_sync)
-//                               Load|Store,
-//                               Load|Load,
-//                              Store|Load
-//
-
-
-// Only load-after-store-order is not guaranteed on z/Architecture, i.e. only 'fence'
-// is needed.
-
-// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions.
-#define inlasm_compiler_barrier() __asm__ volatile ("" : : : "memory");
-// "bcr 15, 0" is used as two way memory barrier.
-#define inlasm_zarch_sync() __asm__ __volatile__ ("bcr 15, 0" : : : "memory");
-
-// Release and acquire are empty on z/Architecture, but potential
-// optimizations of gcc must be forbidden by OrderAccess::release and
-// OrderAccess::acquire.
-#define inlasm_zarch_release() inlasm_compiler_barrier()
-#define inlasm_zarch_acquire() inlasm_compiler_barrier()
-#define inlasm_zarch_fence()   inlasm_zarch_sync()
-
-inline void OrderAccess::loadload()   { inlasm_compiler_barrier(); }
-inline void OrderAccess::storestore() { inlasm_compiler_barrier(); }
-inline void OrderAccess::loadstore()  { inlasm_compiler_barrier(); }
-inline void OrderAccess::storeload()  { inlasm_zarch_sync(); }
-
-inline void OrderAccess::acquire()    { inlasm_zarch_acquire(); }
-inline void OrderAccess::release()    { inlasm_zarch_release(); }
-inline void OrderAccess::fence()      { inlasm_zarch_sync(); }
-
-template<size_t byte_size>
-struct OrderAccess::PlatformOrderedLoad<byte_size, X_ACQUIRE>
-{
-  template <typename T>
-  T operator()(const volatile T* p) const { register T t = *p; inlasm_zarch_acquire(); return t; }
-};
-
-#undef inlasm_compiler_barrier
-#undef inlasm_zarch_sync
-#undef inlasm_zarch_release
-#undef inlasm_zarch_acquire
-#undef inlasm_zarch_fence
-
-#endif // OS_CPU_LINUX_S390_VM_ORDERACCESS_LINUX_S390_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_sparc/orderAccess_linux_sparc.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_HPP
+#define OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_HPP
+
+// Included in orderAccess.hpp header file.
+
+// Implementation of class OrderAccess.
+
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+static inline void compiler_barrier() {
+  __asm__ volatile ("" : : : "memory");
+}
+
+// Assume TSO.
+
+inline void OrderAccess::loadload()   { compiler_barrier(); }
+inline void OrderAccess::storestore() { compiler_barrier(); }
+inline void OrderAccess::loadstore()  { compiler_barrier(); }
+inline void OrderAccess::storeload()  { fence();            }
+
+inline void OrderAccess::acquire()    { compiler_barrier(); }
+inline void OrderAccess::release()    { compiler_barrier(); }
+
+inline void OrderAccess::fence() {
+  __asm__ volatile ("membar  #StoreLoad" : : : "memory");
+}
+
+#endif // OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_HPP
--- a/src/hotspot/os_cpu/linux_sparc/orderAccess_linux_sparc.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP
-#define OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-
-// Implementation of class OrderAccess.
-
-// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
-static inline void compiler_barrier() {
-  __asm__ volatile ("" : : : "memory");
-}
-
-// Assume TSO.
-
-inline void OrderAccess::loadload()   { compiler_barrier(); }
-inline void OrderAccess::storestore() { compiler_barrier(); }
-inline void OrderAccess::loadstore()  { compiler_barrier(); }
-inline void OrderAccess::storeload()  { fence();            }
-
-inline void OrderAccess::acquire()    { compiler_barrier(); }
-inline void OrderAccess::release()    { compiler_barrier(); }
-
-inline void OrderAccess::fence() {
-  __asm__ volatile ("membar  #StoreLoad" : : : "memory");
-}
-
-#endif // OS_CPU_LINUX_SPARC_VM_ORDERACCESS_LINUX_SPARC_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_x86/orderAccess_linux_x86.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_HPP
+#define OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_HPP
+
+// Included in orderAccess.hpp header file.
+
+// Compiler version last used for testing: gcc 4.8.2
+// Please update this information when this file changes
+
+// Implementation of class OrderAccess.
+
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+static inline void compiler_barrier() {
+  __asm__ volatile ("" : : : "memory");
+}
+
+inline void OrderAccess::loadload()   { compiler_barrier(); }
+inline void OrderAccess::storestore() { compiler_barrier(); }
+inline void OrderAccess::loadstore()  { compiler_barrier(); }
+inline void OrderAccess::storeload()  { fence();            }
+
+inline void OrderAccess::acquire()    { compiler_barrier(); }
+inline void OrderAccess::release()    { compiler_barrier(); }
+
+inline void OrderAccess::fence() {
+   // always use locked addl since mfence is sometimes expensive
+#ifdef AMD64
+  __asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
+#else
+  __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
+#endif
+  compiler_barrier();
+}
+
+template<>
+struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgb (%2),%0"
+                      : "=q" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgw (%2),%0"
+                      : "=r" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgl (%2),%0"
+                      : "=r" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+
+#ifdef AMD64
+template<>
+struct OrderAccess::PlatformOrderedStore<8, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm__ volatile (  "xchgq (%2), %0"
+                      : "=r" (v)
+                      : "0" (v), "r" (p)
+                      : "memory");
+  }
+};
+#endif // AMD64
+
+#endif // OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_HPP
--- a/src/hotspot/os_cpu/linux_x86/orderAccess_linux_x86.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP
-#define OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/orderAccess.hpp"
-#include "runtime/os.hpp"
-
-// Compiler version last used for testing: gcc 4.8.2
-// Please update this information when this file changes
-
-// Implementation of class OrderAccess.
-
-// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
-static inline void compiler_barrier() {
-  __asm__ volatile ("" : : : "memory");
-}
-
-inline void OrderAccess::loadload()   { compiler_barrier(); }
-inline void OrderAccess::storestore() { compiler_barrier(); }
-inline void OrderAccess::loadstore()  { compiler_barrier(); }
-inline void OrderAccess::storeload()  { fence();            }
-
-inline void OrderAccess::acquire()    { compiler_barrier(); }
-inline void OrderAccess::release()    { compiler_barrier(); }
-
-inline void OrderAccess::fence() {
-  if (os::is_MP()) {
-    // always use locked addl since mfence is sometimes expensive
-#ifdef AMD64
-    __asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
-#else
-    __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
-#endif
-  }
-  compiler_barrier();
-}
-
-template<>
-struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgb (%2),%0"
-                      : "=q" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgw (%2),%0"
-                      : "=r" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgl (%2),%0"
-                      : "=r" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-
-#ifdef AMD64
-template<>
-struct OrderAccess::PlatformOrderedStore<8, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm__ volatile (  "xchgq (%2), %0"
-                      : "=r" (v)
-                      : "0" (v), "r" (p)
-                      : "memory");
-  }
-};
-#endif // AMD64
-
-#endif // OS_CPU_LINUX_X86_VM_ORDERACCESS_LINUX_X86_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/linux_zero/orderAccess_linux_zero.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2007, 2008, 2009 Red Hat, Inc.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_HPP
+#define OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_HPP
+
+// Included in orderAccess.hpp header file.
+
+#ifdef ARM
+
+/*
+ * ARM Kernel helper for memory barrier.
+ * Using __asm __volatile ("":::"memory") does not work reliable on ARM
+ * and gcc __sync_synchronize(); implementation does not use the kernel
+ * helper for all gcc versions so it is unreliable to use as well.
+ */
+typedef void (__kernel_dmb_t) (void);
+#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
+
+#define FULL_MEM_BARRIER __kernel_dmb()
+#define LIGHT_MEM_BARRIER __kernel_dmb()
+
+#else // ARM
+
+#define FULL_MEM_BARRIER __sync_synchronize()
+
+#ifdef PPC
+
+#ifdef __NO_LWSYNC__
+#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
+#else
+#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
+#endif
+
+#else // PPC
+
+#ifdef ALPHA
+
+#define LIGHT_MEM_BARRIER __sync_synchronize()
+
+#else // ALPHA
+
+#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
+
+#endif // ALPHA
+
+#endif // PPC
+
+#endif // ARM
+
+// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
+// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.
+
+inline void OrderAccess::loadload()   { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::storestore() { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::loadstore()  { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::storeload()  { FULL_MEM_BARRIER;  }
+
+inline void OrderAccess::acquire()    { LIGHT_MEM_BARRIER; }
+inline void OrderAccess::release()    { LIGHT_MEM_BARRIER; }
+
+inline void OrderAccess::fence()      { FULL_MEM_BARRIER;  }
+
+#endif // OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_HPP
--- a/src/hotspot/os_cpu/linux_zero/orderAccess_linux_zero.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2007, 2008, 2009 Red Hat, Inc.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_INLINE_HPP
-#define OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-
-#ifdef ARM
-
-/*
- * ARM Kernel helper for memory barrier.
- * Using __asm __volatile ("":::"memory") does not work reliable on ARM
- * and gcc __sync_synchronize(); implementation does not use the kernel
- * helper for all gcc versions so it is unreliable to use as well.
- */
-typedef void (__kernel_dmb_t) (void);
-#define __kernel_dmb (*(__kernel_dmb_t *) 0xffff0fa0)
-
-#define FULL_MEM_BARRIER __kernel_dmb()
-#define LIGHT_MEM_BARRIER __kernel_dmb()
-
-#else // ARM
-
-#define FULL_MEM_BARRIER __sync_synchronize()
-
-#ifdef PPC
-
-#ifdef __NO_LWSYNC__
-#define LIGHT_MEM_BARRIER __asm __volatile ("sync":::"memory")
-#else
-#define LIGHT_MEM_BARRIER __asm __volatile ("lwsync":::"memory")
-#endif
-
-#else // PPC
-
-#ifdef ALPHA
-
-#define LIGHT_MEM_BARRIER __sync_synchronize()
-
-#else // ALPHA
-
-#define LIGHT_MEM_BARRIER __asm __volatile ("":::"memory")
-
-#endif // ALPHA
-
-#endif // PPC
-
-#endif // ARM
-
-// Note: What is meant by LIGHT_MEM_BARRIER is a barrier which is sufficient
-// to provide TSO semantics, i.e. StoreStore | LoadLoad | LoadStore.
-
-inline void OrderAccess::loadload()   { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::storestore() { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::loadstore()  { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::storeload()  { FULL_MEM_BARRIER;  }
-
-inline void OrderAccess::acquire()    { LIGHT_MEM_BARRIER; }
-inline void OrderAccess::release()    { LIGHT_MEM_BARRIER; }
-
-inline void OrderAccess::fence()      { FULL_MEM_BARRIER;  }
-
-#endif // OS_CPU_LINUX_ZERO_VM_ORDERACCESS_LINUX_ZERO_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/solaris_sparc/orderAccess_solaris_sparc.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_HPP
+#define OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_HPP
+
+// Included in orderAccess.hpp header file.
+
+// Compiler version last used for testing: solaris studio 12u3
+// Please update this information when this file changes
+
+// Implementation of class OrderAccess.
+
+// Assume TSO.
+
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+inline void compiler_barrier() {
+  __asm__ volatile ("" : : : "memory");
+}
+
+inline void OrderAccess::loadload()   { compiler_barrier(); }
+inline void OrderAccess::storestore() { compiler_barrier(); }
+inline void OrderAccess::loadstore()  { compiler_barrier(); }
+inline void OrderAccess::storeload()  { fence();            }
+
+inline void OrderAccess::acquire()    { compiler_barrier(); }
+inline void OrderAccess::release()    { compiler_barrier(); }
+
+inline void OrderAccess::fence() {
+  __asm__ volatile ("membar  #StoreLoad" : : : "memory");
+}
+
+#endif // OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_HPP
--- a/src/hotspot/os_cpu/solaris_sparc/orderAccess_solaris_sparc.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP
-#define OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/orderAccess.hpp"
-
-// Compiler version last used for testing: solaris studio 12u3
-// Please update this information when this file changes
-
-// Implementation of class OrderAccess.
-
-// Assume TSO.
-
-// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
-inline void compiler_barrier() {
-  __asm__ volatile ("" : : : "memory");
-}
-
-inline void OrderAccess::loadload()   { compiler_barrier(); }
-inline void OrderAccess::storestore() { compiler_barrier(); }
-inline void OrderAccess::loadstore()  { compiler_barrier(); }
-inline void OrderAccess::storeload()  { fence();            }
-
-inline void OrderAccess::acquire()    { compiler_barrier(); }
-inline void OrderAccess::release()    { compiler_barrier(); }
-
-inline void OrderAccess::fence() {
-  __asm__ volatile ("membar  #StoreLoad" : : : "memory");
-}
-
-#endif // OS_CPU_SOLARIS_SPARC_VM_ORDERACCESS_SOLARIS_SPARC_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/solaris_x86/orderAccess_solaris_x86.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_HPP
+#define OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_HPP
+
+// Included in orderAccess.hpp header file.
+
+// Compiler version last used for testing: solaris studio 12u3
+// Please update this information when this file changes
+
+// Implementation of class OrderAccess.
+
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+inline void compiler_barrier() {
+  __asm__ volatile ("" : : : "memory");
+}
+
+inline void OrderAccess::loadload()   { compiler_barrier(); }
+inline void OrderAccess::storestore() { compiler_barrier(); }
+inline void OrderAccess::loadstore()  { compiler_barrier(); }
+inline void OrderAccess::storeload()  { fence();            }
+
+inline void OrderAccess::acquire()    { compiler_barrier(); }
+inline void OrderAccess::release()    { compiler_barrier(); }
+
+inline void OrderAccess::fence() {
+#ifdef AMD64
+  __asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
+#else
+  __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
+#endif
+  compiler_barrier();
+}
+
+#endif // OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_HPP
--- a/src/hotspot/os_cpu/solaris_x86/orderAccess_solaris_x86.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-#ifndef OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP
-#define OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP
-
-#include "runtime/atomic.hpp"
-#include "runtime/orderAccess.hpp"
-#include "runtime/os.hpp"
-
-// Compiler version last used for testing: solaris studio 12u3
-// Please update this information when this file changes
-
-// Implementation of class OrderAccess.
-
-// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
-inline void compiler_barrier() {
-  __asm__ volatile ("" : : : "memory");
-}
-
-inline void OrderAccess::loadload()   { compiler_barrier(); }
-inline void OrderAccess::storestore() { compiler_barrier(); }
-inline void OrderAccess::loadstore()  { compiler_barrier(); }
-inline void OrderAccess::storeload()  { fence();            }
-
-inline void OrderAccess::acquire()    { compiler_barrier(); }
-inline void OrderAccess::release()    { compiler_barrier(); }
-
-inline void OrderAccess::fence() {
-  if (os::is_MP()) {
-#ifdef AMD64
-    __asm__ volatile ("lock; addl $0,0(%%rsp)" : : : "cc", "memory");
-#else
-    __asm__ volatile ("lock; addl $0,0(%%esp)" : : : "cc", "memory");
-#endif
-  }
-  compiler_barrier();
-}
-
-#endif // OS_CPU_SOLARIS_X86_VM_ORDERACCESS_SOLARIS_X86_INLINE_HPP
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/os_cpu/windows_x86/orderAccess_windows_x86.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_HPP
+#define OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_HPP
+
+// Included in orderAccess.hpp header file.
+
+#include <intrin.h>
+
+// Compiler version last used for testing: Microsoft Visual Studio 2010
+// Please update this information when this file changes
+
+// Implementation of class OrderAccess.
+
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+inline void compiler_barrier() {
+  _ReadWriteBarrier();
+}
+
+// Note that in MSVC, volatile memory accesses are explicitly
+// guaranteed to have acquire release semantics (w.r.t. compiler
+// reordering) and therefore does not even need a compiler barrier
+// for normal acquire release accesses. And all generalized
+// bound calls like release_store go through OrderAccess::load
+// and OrderAccess::store which do volatile memory accesses.
+template<> inline void ScopedFence<X_ACQUIRE>::postfix()       { }
+template<> inline void ScopedFence<RELEASE_X>::prefix()        { }
+template<> inline void ScopedFence<RELEASE_X_FENCE>::prefix()  { }
+template<> inline void ScopedFence<RELEASE_X_FENCE>::postfix() { OrderAccess::fence(); }
+
+inline void OrderAccess::loadload()   { compiler_barrier(); }
+inline void OrderAccess::storestore() { compiler_barrier(); }
+inline void OrderAccess::loadstore()  { compiler_barrier(); }
+inline void OrderAccess::storeload()  { fence(); }
+
+inline void OrderAccess::acquire()    { compiler_barrier(); }
+inline void OrderAccess::release()    { compiler_barrier(); }
+
+inline void OrderAccess::fence() {
+#ifdef AMD64
+  StubRoutines_fence();
+#else
+  __asm {
+    lock add dword ptr [esp], 0;
+  }
+#endif // AMD64
+  compiler_barrier();
+}
+
+#ifndef AMD64
+template<>
+struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm {
+      mov edx, p;
+      mov al, v;
+      xchg al, byte ptr [edx];
+    }
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm {
+      mov edx, p;
+      mov ax, v;
+      xchg ax, word ptr [edx];
+    }
+  }
+};
+
+template<>
+struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
+{
+  template <typename T>
+  void operator()(T v, volatile T* p) const {
+    __asm {
+      mov edx, p;
+      mov eax, v;
+      xchg eax, dword ptr [edx];
+    }
+  }
+};
+#endif // AMD64
+
+#endif // OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_HPP
--- a/src/hotspot/os_cpu/windows_x86/orderAccess_windows_x86.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
- * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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 OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP
-#define OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP
-
-#include <intrin.h>
-#include "runtime/atomic.hpp"
-#include "runtime/orderAccess.hpp"
-#include "runtime/os.hpp"
-
-// Compiler version last used for testing: Microsoft Visual Studio 2010
-// Please update this information when this file changes
-
-// Implementation of class OrderAccess.
-
-// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
-inline void compiler_barrier() {
-  _ReadWriteBarrier();
-}
-
-// Note that in MSVC, volatile memory accesses are explicitly
-// guaranteed to have acquire release semantics (w.r.t. compiler
-// reordering) and therefore does not even need a compiler barrier
-// for normal acquire release accesses. And all generalized
-// bound calls like release_store go through OrderAccess::load
-// and OrderAccess::store which do volatile memory accesses.
-template<> inline void ScopedFence<X_ACQUIRE>::postfix()       { }
-template<> inline void ScopedFence<RELEASE_X>::prefix()        { }
-template<> inline void ScopedFence<RELEASE_X_FENCE>::prefix()  { }
-template<> inline void ScopedFence<RELEASE_X_FENCE>::postfix() { OrderAccess::fence(); }
-
-inline void OrderAccess::loadload()   { compiler_barrier(); }
-inline void OrderAccess::storestore() { compiler_barrier(); }
-inline void OrderAccess::loadstore()  { compiler_barrier(); }
-inline void OrderAccess::storeload()  { fence(); }
-
-inline void OrderAccess::acquire()    { compiler_barrier(); }
-inline void OrderAccess::release()    { compiler_barrier(); }
-
-inline void OrderAccess::fence() {
-#ifdef AMD64
-  StubRoutines_fence();
-#else
-  if (os::is_MP()) {
-    __asm {
-      lock add dword ptr [esp], 0;
-    }
-  }
-#endif // AMD64
-  compiler_barrier();
-}
-
-#ifndef AMD64
-template<>
-struct OrderAccess::PlatformOrderedStore<1, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm {
-      mov edx, p;
-      mov al, v;
-      xchg al, byte ptr [edx];
-    }
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<2, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm {
-      mov edx, p;
-      mov ax, v;
-      xchg ax, word ptr [edx];
-    }
-  }
-};
-
-template<>
-struct OrderAccess::PlatformOrderedStore<4, RELEASE_X_FENCE>
-{
-  template <typename T>
-  void operator()(T v, volatile T* p) const {
-    __asm {
-      mov edx, p;
-      mov eax, v;
-      xchg eax, dword ptr [edx];
-    }
-  }
-};
-#endif // AMD64
-
-#endif // OS_CPU_WINDOWS_X86_VM_ORDERACCESS_WINDOWS_X86_INLINE_HPP
--- a/src/hotspot/share/aot/aotCompiledMethod.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/aot/aotCompiledMethod.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -75,7 +75,7 @@
   return (address*) ((address)fr->unextended_sp() + _meta->orig_pc_offset());
 }
 
-bool AOTCompiledMethod::do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred) {
+bool AOTCompiledMethod::do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive) {
   return false;
 }
 
@@ -245,7 +245,7 @@
 // more conservative than for nmethods.
 void AOTCompiledMethod::flush_evol_dependents_on(InstanceKlass* dependee) {
   if (is_java_method()) {
-    cleanup_inline_caches();
+    clear_inline_caches();
     mark_for_deoptimization();
     make_not_entrant();
   }
--- a/src/hotspot/share/aot/aotCompiledMethod.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/aot/aotCompiledMethod.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -284,8 +284,8 @@
   bool is_aot_runtime_stub() const { return _method == NULL; }
 
 protected:
-  virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred);
-  virtual bool do_unloading_jvmci(bool unloading_occurred) { return false; }
+  virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive);
+  virtual bool do_unloading_jvmci() { return false; }
 
 };
 
--- a/src/hotspot/share/classfile/classLoader.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/classLoader.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #define SHARE_VM_CLASSFILE_CLASSLOADER_INLINE_HPP
 
 #include "classfile/classLoader.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 // Next entry in class path
 inline ClassPathEntry* ClassPathEntry::next() const { return OrderAccess::load_acquire(&_next); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,456 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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/classLoaderData.inline.hpp"
+#include "classfile/classLoaderHierarchyDCmd.hpp"
+#include "memory/allocation.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/safepoint.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/ostream.hpp"
+
+
+ClassLoaderHierarchyDCmd::ClassLoaderHierarchyDCmd(outputStream* output, bool heap)
+  : DCmdWithParser(output, heap)
+  , _show_classes("show-classes", "Print loaded classes.", "BOOLEAN", false, "false")
+  , _verbose("verbose", "Print detailed information.", "BOOLEAN", false, "false") {
+  _dcmdparser.add_dcmd_option(&_show_classes);
+  _dcmdparser.add_dcmd_option(&_verbose);
+}
+
+
+int ClassLoaderHierarchyDCmd::num_arguments() {
+  ResourceMark rm;
+  ClassLoaderHierarchyDCmd* dcmd = new ClassLoaderHierarchyDCmd(NULL, false);
+  if (dcmd != NULL) {
+    DCmdMark mark(dcmd);
+    return dcmd->_dcmdparser.num_arguments();
+  } else {
+    return 0;
+  }
+}
+
+// Helper class for drawing the branches to the left of a node.
+class BranchTracker : public StackObj {
+  //       "<x>"
+  //       " |---<y>"
+  //       " |    |
+  //       " |   <z>"
+  //       " |    |---<z1>
+  //       " |    |---<z2>
+  //       ^^^^^^^ ^^^
+  //        A       B
+
+  // Some terms for the graphics:
+  // - branch: vertical connection between a node's ancestor to a later sibling.
+  // - branchwork: (A) the string to print as a prefix at the start of each line, contains all branches.
+  // - twig (B): Length of the dashed line connecting a node to its branch.
+  // - branch spacing: how many spaces between branches are printed.
+
+public:
+
+  enum { max_depth = 64, twig_len = 2, branch_spacing = 5 };
+
+private:
+
+  char _branches[max_depth];
+  int _pos;
+
+public:
+  BranchTracker()
+    : _pos(0) {}
+
+  void push(bool has_branch) {
+    if (_pos < max_depth) {
+      _branches[_pos] = has_branch ? '|' : ' ';
+    }
+    _pos ++; // beyond max depth, omit branch drawing but do count on.
+  }
+
+  void pop() {
+    assert(_pos > 0, "must be");
+    _pos --;
+  }
+
+  void print(outputStream* st) {
+    for (int i = 0; i < _pos; i ++) {
+      st->print("%c%.*s", _branches[i], branch_spacing, "          ");
+    }
+  }
+
+  class Mark {
+    BranchTracker& _tr;
+  public:
+    Mark(BranchTracker& tr, bool has_branch_here)
+      : _tr(tr)  { _tr.push(has_branch_here); }
+    ~Mark() { _tr.pop(); }
+  };
+
+}; // end: BranchTracker
+
+struct LoadedClassInfo : public ResourceObj {
+public:
+  LoadedClassInfo* _next;
+  Klass* const _klass;
+  const ClassLoaderData* const _cld;
+
+  LoadedClassInfo(Klass* klass, const ClassLoaderData* cld)
+    : _klass(klass), _cld(cld) {}
+
+};
+
+class LoaderTreeNode : public ResourceObj {
+
+  // We walk the CLDG and, for each CLD which is non-anonymous, add
+  // a tree node. To add a node we need its parent node; if it itself
+  // does not exist yet, we add a preliminary node for it. This preliminary
+  // node just contains its loader oop; later, when encountering its CLD in
+  // our CLDG walk, we complete the missing information in this node.
+
+  const oop _loader_oop;
+  const ClassLoaderData* _cld;
+
+  LoaderTreeNode* _child;
+  LoaderTreeNode* _next;
+
+  LoadedClassInfo* _classes;
+  int _num_classes;
+
+  LoadedClassInfo* _anon_classes;
+  int _num_anon_classes;
+
+  void print_with_childs(outputStream* st, BranchTracker& branchtracker,
+      bool print_classes, bool verbose) const {
+
+    ResourceMark rm;
+
+    if (_cld == NULL) {
+      // Not sure how this could happen: we added a preliminary node for a parent but then never encountered
+      // its CLD?
+      return;
+    }
+
+    // Retrieve information.
+    const Klass* const loader_klass = _cld->class_loader_klass();
+    const Symbol* const loader_name = _cld->class_loader_name();
+
+    branchtracker.print(st);
+
+    // e.g. "+--- jdk.internal.reflect.DelegatingClassLoader"
+    st->print("+%.*s", BranchTracker::twig_len, "----------");
+    if (_cld->is_the_null_class_loader_data()) {
+      st->print(" <bootstrap>");
+    } else {
+      if (loader_name != NULL) {
+        st->print(" \"%s\",", loader_name->as_C_string());
+      }
+      st->print(" %s", loader_klass != NULL ? loader_klass->external_name() : "??");
+      st->print(" {" PTR_FORMAT "}", p2i(_loader_oop));
+    }
+    st->cr();
+
+    // Output following this node (node details and child nodes) - up to the next sibling node
+    // needs to be prefixed with "|" if there is a follow up sibling.
+    const bool have_sibling = _next != NULL;
+    BranchTracker::Mark trm(branchtracker, have_sibling);
+
+    {
+      // optional node details following this node needs to be prefixed with "|"
+      // if there are follow up child nodes.
+      const bool have_child = _child != NULL;
+      BranchTracker::Mark trm(branchtracker, have_child);
+
+      // Empty line
+      branchtracker.print(st);
+      st->cr();
+
+      const int indentation = 18;
+
+      if (verbose) {
+        branchtracker.print(st);
+        st->print_cr("%*s " PTR_FORMAT, indentation, "Loader Data:", p2i(_cld));
+        branchtracker.print(st);
+        st->print_cr("%*s " PTR_FORMAT, indentation, "Loader Klass:", p2i(loader_klass));
+
+        // Empty line
+        branchtracker.print(st);
+        st->cr();
+      }
+
+      if (print_classes) {
+
+        if (_classes != NULL) {
+          for (LoadedClassInfo* lci = _classes; lci; lci = lci->_next) {
+            branchtracker.print(st);
+            if (lci == _classes) { // first iteration
+              st->print("%*s ", indentation, "Classes:");
+            } else {
+              st->print("%*s ", indentation, "");
+            }
+            st->print("%s", lci->_klass->external_name());
+            st->cr();
+            // Non-anonymous classes should live in the primary CLD of its loader
+            assert(lci->_cld == _cld, "must be");
+          }
+          branchtracker.print(st);
+          st->print("%*s ", indentation, "");
+          st->print_cr("(%u class%s)", _num_classes, (_num_classes == 1) ? "" : "es");
+
+          // Empty line
+          branchtracker.print(st);
+          st->cr();
+        }
+
+        if (_anon_classes != NULL) {
+          for (LoadedClassInfo* lci = _anon_classes; lci; lci = lci->_next) {
+            branchtracker.print(st);
+            if (lci == _anon_classes) { // first iteration
+              st->print("%*s ", indentation, "Anonymous Classes:");
+            } else {
+              st->print("%*s ", indentation, "");
+            }
+            st->print("%s", lci->_klass->external_name());
+            // For anonymous classes, also print CLD if verbose. Should be a different one than the primary CLD.
+            assert(lci->_cld != _cld, "must be");
+            if (verbose) {
+              st->print("  (CLD: " PTR_FORMAT ")", p2i(lci->_cld));
+            }
+            st->cr();
+          }
+          branchtracker.print(st);
+          st->print("%*s ", indentation, "");
+          st->print_cr("(%u anonymous class%s)", _num_anon_classes, (_num_anon_classes == 1) ? "" : "es");
+
+          // Empty line
+          branchtracker.print(st);
+          st->cr();
+        }
+
+      } // end: print_classes
+
+    } // Pop branchtracker mark
+
+    // Print children, recursively
+    LoaderTreeNode* c = _child;
+    while (c != NULL) {
+      c->print_with_childs(st, branchtracker, print_classes, verbose);
+      c = c->_next;
+    }
+
+  }
+
+public:
+
+  LoaderTreeNode(const oop loader_oop)
+    : _loader_oop(loader_oop), _cld(NULL)
+    , _child(NULL), _next(NULL)
+    , _classes(NULL), _anon_classes(NULL)
+    , _num_classes(0), _num_anon_classes(0) {}
+
+  void set_cld(const ClassLoaderData* cld) {
+    _cld = cld;
+  }
+
+  void add_child(LoaderTreeNode* info) {
+    info->_next = _child;
+    _child = info;
+  }
+
+  void add_sibling(LoaderTreeNode* info) {
+    assert(info->_next == NULL, "must be");
+    info->_next = _next;
+    _next = info;
+  }
+
+  void add_classes(LoadedClassInfo* first_class, int num_classes, bool anonymous) {
+    LoadedClassInfo** p_list_to_add_to = anonymous ? &_anon_classes : &_classes;
+    // Search tail.
+    while ((*p_list_to_add_to) != NULL) {
+      p_list_to_add_to = &(*p_list_to_add_to)->_next;
+    }
+    *p_list_to_add_to = first_class;
+    if (anonymous) {
+      _num_anon_classes += num_classes;
+    } else {
+      _num_classes += num_classes;
+    }
+  }
+
+  const ClassLoaderData* cld() const {
+    return _cld;
+  }
+
+  const oop loader_oop() const {
+    return _loader_oop;
+  }
+
+  LoaderTreeNode* find(const oop loader_oop) {
+    LoaderTreeNode* result = NULL;
+    if (_loader_oop == loader_oop) {
+      result = this;
+    } else {
+      LoaderTreeNode* c = _child;
+      while (c != NULL && result == NULL) {
+        result = c->find(loader_oop);
+        c = c->_next;
+      }
+    }
+    return result;
+  }
+
+  void print_with_childs(outputStream* st, bool print_classes, bool print_add_info) const {
+    BranchTracker bwt;
+    print_with_childs(st, bwt, print_classes, print_add_info);
+  }
+
+};
+
+class LoadedClassCollectClosure : public KlassClosure {
+public:
+  LoadedClassInfo* _list;
+  const ClassLoaderData* _cld;
+  int _num_classes;
+  LoadedClassCollectClosure(const ClassLoaderData* cld)
+    : _list(NULL), _cld(cld), _num_classes(0) {}
+  void do_klass(Klass* k) {
+    LoadedClassInfo* lki = new LoadedClassInfo(k, _cld);
+    lki->_next = _list;
+    _list = lki;
+    _num_classes ++;
+  }
+};
+
+class LoaderInfoScanClosure : public CLDClosure {
+
+  const bool _print_classes;
+  const bool _verbose;
+  LoaderTreeNode* _root;
+
+  static void fill_in_classes(LoaderTreeNode* info, const ClassLoaderData* cld) {
+    assert(info != NULL && cld != NULL, "must be");
+    LoadedClassCollectClosure lccc(cld);
+    const_cast<ClassLoaderData*>(cld)->classes_do(&lccc);
+    if (lccc._num_classes > 0) {
+      info->add_classes(lccc._list, lccc._num_classes, cld->is_anonymous());
+    }
+  }
+
+  LoaderTreeNode* find_node_or_add_empty_node(oop loader_oop) {
+
+    assert(_root != NULL, "root node must exist");
+
+    if (loader_oop == NULL) {
+      return _root;
+    }
+
+    // Check if a node for this oop already exists.
+    LoaderTreeNode* info = _root->find(loader_oop);
+
+    if (info == NULL) {
+      // It does not. Create a node.
+      info = new LoaderTreeNode(loader_oop);
+
+      // Add it to tree.
+      LoaderTreeNode* parent_info = NULL;
+
+      // Recursively add parent nodes if needed.
+      const oop parent_oop = java_lang_ClassLoader::parent(loader_oop);
+      if (parent_oop == NULL) {
+        parent_info = _root;
+      } else {
+        parent_info = find_node_or_add_empty_node(parent_oop);
+      }
+      assert(parent_info != NULL, "must be");
+
+      parent_info->add_child(info);
+    }
+    return info;
+  }
+
+
+public:
+  LoaderInfoScanClosure(bool print_classes, bool verbose)
+    : _print_classes(print_classes), _verbose(verbose), _root(NULL) {
+    _root = new LoaderTreeNode(NULL);
+  }
+
+  void print_results(outputStream* st) const {
+    _root->print_with_childs(st, _print_classes, _verbose);
+  }
+
+  void do_cld (ClassLoaderData* cld) {
+
+    // We do not display unloading loaders, for now.
+    if (cld->is_unloading()) {
+      return;
+    }
+
+    const oop loader_oop = cld->class_loader();
+
+    LoaderTreeNode* info = find_node_or_add_empty_node(loader_oop);
+    assert(info != NULL, "must be");
+
+    // Update CLD in node, but only if this is the primary CLD for this loader.
+    if (cld->is_anonymous() == false) {
+      assert(info->cld() == NULL, "there should be only one primary CLD per loader");
+      info->set_cld(cld);
+    }
+
+    // Add classes.
+    fill_in_classes(info, cld);
+  }
+
+};
+
+
+class ClassLoaderHierarchyVMOperation : public VM_Operation {
+  outputStream* const _out;
+  const bool _show_classes;
+  const bool _verbose;
+public:
+  ClassLoaderHierarchyVMOperation(outputStream* out, bool show_classes, bool verbose) :
+    _out(out), _show_classes(show_classes), _verbose(verbose)
+  {}
+
+  VMOp_Type type() const {
+    return VMOp_ClassLoaderHierarchyOperation;
+  }
+
+  void doit() {
+    assert(SafepointSynchronize::is_at_safepoint(), "must be a safepoint");
+    ResourceMark rm;
+    LoaderInfoScanClosure cl (_show_classes, _verbose);
+    ClassLoaderDataGraph::cld_do(&cl);
+    cl.print_results(_out);
+  }
+};
+
+// This command needs to be executed at a safepoint.
+void ClassLoaderHierarchyDCmd::execute(DCmdSource source, TRAPS) {
+  ClassLoaderHierarchyVMOperation op(output(), _show_classes.value(), _verbose.value());
+  VMThread::execute(&op);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/classfile/classLoaderHierarchyDCmd.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018 SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 HOTSPOT_SHARE_CLASSFILE_CLASSLOADERHIERARCHYDCMD_HPP_
+#define HOTSPOT_SHARE_CLASSFILE_CLASSLOADERHIERARCHYDCMD_HPP_
+
+#include "services/diagnosticCommand.hpp"
+
+class ClassLoaderHierarchyDCmd: public DCmdWithParser {
+  DCmdArgument<bool> _show_classes;
+  DCmdArgument<bool> _verbose;
+public:
+
+  ClassLoaderHierarchyDCmd(outputStream* output, bool heap);
+
+  static const char* name() {
+    return "VM.classloaders";
+  }
+
+  static const char* description() {
+    return "Prints classloader hierarchy.";
+  }
+  static const char* impact() {
+      return "Medium: Depends on number of class loaders and classes loaded.";
+  }
+  static const JavaPermission permission() {
+    JavaPermission p = {"java.lang.management.ManagementPermission",
+                        "monitor", NULL};
+    return p;
+  }
+  static int num_arguments();
+  virtual void execute(DCmdSource source, TRAPS);
+
+};
+
+#endif /* HOTSPOT_SHARE_CLASSFILE_CLASSLOADERHIERARCHYDCMD_HPP_ */
--- a/src/hotspot/share/classfile/dictionary.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/dictionary.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -35,7 +35,7 @@
 #include "memory/resourceArea.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/safepointVerifiers.hpp"
 #include "utilities/hashtable.inline.hpp"
 
--- a/src/hotspot/share/classfile/dictionary.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/dictionary.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #define SHARE_VM_CLASSFILE_DICTIONARY_INLINE_HPP
 
 #include "classfile/dictionary.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 inline ProtectionDomainEntry* DictionaryEntry::pd_set_acquire() const {
   return OrderAccess::load_acquire(&_pd_set);
--- a/src/hotspot/share/classfile/javaClasses.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -4257,7 +4257,7 @@
 int java_lang_AssertionStatusDirectives::packageEnabled_offset;
 int java_lang_AssertionStatusDirectives::deflt_offset;
 int java_nio_Buffer::_limit_offset;
-int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset = 0;
+int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset;
 int reflect_ConstantPool::_oop_offset;
 int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
 
@@ -4399,13 +4399,12 @@
 }
 #endif
 
-void java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(TRAPS) {
-  if (_owner_offset != 0) return;
-
-  SystemDictionary::load_abstract_ownable_synchronizer_klass(CHECK);
-  InstanceKlass* k = SystemDictionary::abstract_ownable_synchronizer_klass();
-  compute_offset(_owner_offset, k,
-                 "exclusiveOwnerThread", vmSymbols::thread_signature());
+#define AOS_FIELDS_DO(macro) \
+  macro(_owner_offset, k, "exclusiveOwnerThread", thread_signature, false)
+
+void java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets() {
+  InstanceKlass* k = SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass();
+  AOS_FIELDS_DO(FIELD_COMPUTE_OFFSET);
 }
 
 oop java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(oop obj) {
@@ -4473,6 +4472,7 @@
   java_lang_StackTraceElement::compute_offsets();
   java_lang_StackFrameInfo::compute_offsets();
   java_lang_LiveStackFrameInfo::compute_offsets();
+  java_util_concurrent_locks_AbstractOwnableSynchronizer::compute_offsets();
 
   // generated interpreter code wants to know about the offsets we just computed:
   AbstractAssembler::update_delayed_values();
--- a/src/hotspot/share/classfile/javaClasses.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/javaClasses.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1483,7 +1483,7 @@
  private:
   static int  _owner_offset;
  public:
-  static void initialize(TRAPS);
+  static void compute_offsets();
   static oop  get_owner_threadObj(oop obj);
 };
 
--- a/src/hotspot/share/classfile/stringTable.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/stringTable.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,10 @@
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "gc/shared/collectedHeap.hpp"
+#include "gc/shared/oopStorage.inline.hpp"
+#include "gc/shared/oopStorageParState.inline.hpp"
 #include "logging/log.hpp"
+#include "logging/logStream.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/filemap.hpp"
 #include "memory/metaspaceShared.hpp"
@@ -38,171 +41,196 @@
 #include "oops/access.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "oops/typeArrayOop.inline.hpp"
+#include "oops/weakHandle.inline.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/safepointVerifiers.hpp"
+#include "runtime/timerTrace.hpp"
+#include "runtime/interfaceSupport.inline.hpp"
 #include "services/diagnosticCommand.hpp"
-#include "utilities/hashtable.inline.hpp"
+#include "utilities/concurrentHashTable.inline.hpp"
+#include "utilities/concurrentHashTableTasks.inline.hpp"
 #include "utilities/macros.hpp"
 
-// the number of buckets a thread claims
-const int ClaimChunkSize = 32;
-
-#ifdef ASSERT
-class StableMemoryChecker : public StackObj {
-  enum { _bufsize = wordSize*4 };
-
-  address _region;
-  jint    _size;
-  u1      _save_buf[_bufsize];
-
-  int sample(u1* save_buf) {
-    if (_size <= _bufsize) {
-      memcpy(save_buf, _region, _size);
-      return _size;
-    } else {
-      // copy head and tail
-      memcpy(&save_buf[0],          _region,                      _bufsize/2);
-      memcpy(&save_buf[_bufsize/2], _region + _size - _bufsize/2, _bufsize/2);
-      return (_bufsize/2)*2;
-    }
-  }
-
- public:
-  StableMemoryChecker(const void* region, jint size) {
-    _region = (address) region;
-    _size   = size;
-    sample(_save_buf);
-  }
-
-  bool verify() {
-    u1 check_buf[sizeof(_save_buf)];
-    int check_size = sample(check_buf);
-    return (0 == memcmp(_save_buf, check_buf, check_size));
-  }
-
-  void set_region(const void* region) { _region = (address) region; }
-};
-#endif
-
+// We prefer short chains of avg 2
+#define PREF_AVG_LIST_LEN   2
+// 2^24 is max size
+#define END_SIZE           24
+// If a chain gets to 32 something might be wrong
+#define REHASH_LEN         32
+// If we have as many dead items as 50% of the number of bucket
+#define CLEAN_DEAD_HIGH_WATER_MARK 0.5
 
 // --------------------------------------------------------------------------
 StringTable* StringTable::_the_table = NULL;
 bool StringTable::_shared_string_mapped = false;
-bool StringTable::_needs_rehashing = false;
-
-volatile int StringTable::_parallel_claimed_idx = 0;
-
 CompactHashtable<oop, char> StringTable::_shared_table;
+bool StringTable::_alt_hash = false;
 
-// Pick hashing algorithm
-unsigned int StringTable::hash_string(const jchar* s, int len) {
-  return use_alternate_hashcode() ? alt_hash_string(s, len) :
-                                    java_lang_String::hash_code(s, len);
-}
-
-unsigned int StringTable::alt_hash_string(const jchar* s, int len) {
-  return AltHashing::murmur3_32(seed(), s, len);
-}
+static juint murmur_seed = 0;
 
-unsigned int StringTable::hash_string(oop string) {
-  EXCEPTION_MARK;
-  if (string == NULL) {
-    return hash_string((jchar*)NULL, 0);
-  }
-  ResourceMark rm(THREAD);
-  // All String oops are hashed as unicode
-  int length;
-  jchar* chars = java_lang_String::as_unicode_string(string, length, THREAD);
-  if (chars != NULL) {
-    return hash_string(chars, length);
-  } else {
-    vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "unable to create Unicode string for verification");
-    return 0;
-  }
-}
-
-oop StringTable::string_object(HashtableEntry<oop, mtSymbol>* entry) {
-  return RootAccess<ON_PHANTOM_OOP_REF>::oop_load(entry->literal_addr());
-}
-
-oop StringTable::string_object_no_keepalive(HashtableEntry<oop, mtSymbol>* entry) {
-  // The AS_NO_KEEPALIVE peeks at the oop without keeping it alive.
-  // This is *very dangerous* in general but is okay in this specific
-  // case. The subsequent oop_load keeps the oop alive if it it matched
-  // the jchar* string.
-  return RootAccess<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>::oop_load(entry->literal_addr());
-}
-
-void StringTable::set_string_object(HashtableEntry<oop, mtSymbol>* entry, oop string) {
-  RootAccess<ON_PHANTOM_OOP_REF>::oop_store(entry->literal_addr(), string);
-}
-
-oop StringTable::lookup_shared(jchar* name, int len, unsigned int hash) {
-  assert(hash == java_lang_String::hash_code(name, len),
-         "hash must be computed using java_lang_String::hash_code");
-  return _shared_table.lookup((const char*)name, hash, len);
+uintx hash_string(const jchar* s, int len, bool useAlt) {
+  return  useAlt ?
+    AltHashing::murmur3_32(murmur_seed, s, len) :
+    java_lang_String::hash_code(s, len);
 }
 
-oop StringTable::lookup_in_main_table(int index, jchar* name,
-                                      int len, unsigned int hash) {
-  int count = 0;
-  for (HashtableEntry<oop, mtSymbol>* l = bucket(index); l != NULL; l = l->next()) {
-    count++;
-    if (l->hash() == hash) {
-      if (java_lang_String::equals(string_object_no_keepalive(l), name, len)) {
-        // We must perform a new load with string_object() that keeps the string
-        // alive as we must expose the oop as strongly reachable when exiting
-        // this context, in case the oop gets published.
-        return string_object(l);
-      }
+class StringTableConfig : public StringTableHash::BaseConfig {
+ private:
+ public:
+  static uintx get_hash(WeakHandle<vm_string_table_data> const& value,
+                        bool* is_dead) {
+    EXCEPTION_MARK;
+    oop val_oop = value.peek();
+    if (val_oop == NULL) {
+      *is_dead = true;
+      return 0;
+    }
+    *is_dead = false;
+    ResourceMark rm(THREAD);
+    // All String oops are hashed as unicode
+    int length;
+    jchar* chars = java_lang_String::as_unicode_string(val_oop, length, THREAD);
+    if (chars != NULL) {
+      return hash_string(chars, length, StringTable::_alt_hash);
     }
+    vm_exit_out_of_memory(length, OOM_MALLOC_ERROR, "get hash from oop");
+    return 0;
   }
-  // If the bucket size is too deep check if this hash code is insufficient.
-  if (count >= rehash_count && !needs_rehashing()) {
-    _needs_rehashing = check_rehash_table(count);
+  // We use default allocation/deallocation but counted
+  static void* allocate_node(size_t size,
+                             WeakHandle<vm_string_table_data> const& value) {
+    StringTable::item_added();
+    return StringTableHash::BaseConfig::allocate_node(size, value);
+  }
+  static void free_node(void* memory,
+                        WeakHandle<vm_string_table_data> const& value) {
+    value.release();
+    StringTableHash::BaseConfig::free_node(memory, value);
+    StringTable::item_removed();
+  }
+};
+
+class StringTableLookupJchar : StackObj {
+ private:
+  Thread* _thread;
+  uintx _hash;
+  int _len;
+  const jchar* _str;
+  Handle _found;
+
+ public:
+  StringTableLookupJchar(Thread* thread, uintx hash, const jchar* key, int len)
+    : _thread(thread), _hash(hash), _str(key), _len(len) {
+  }
+  uintx get_hash() const {
+    return _hash;
   }
-  return NULL;
+  bool equals(WeakHandle<vm_string_table_data>* value, bool* is_dead) {
+    oop val_oop = value->peek();
+    if (val_oop == NULL) {
+      // dead oop, mark this hash dead for cleaning
+      *is_dead = true;
+      return false;
+    }
+    bool equals = java_lang_String::equals(val_oop, (jchar*)_str, _len);
+    if (!equals) {
+      return false;
+    }
+    // Need to resolve weak handle and Handleize through possible safepoint.
+     _found = Handle(_thread, value->resolve());
+    return true;
+  }
+};
+
+class StringTableLookupOop : public StackObj {
+ private:
+  Thread* _thread;
+  uintx _hash;
+  Handle _find;
+  Handle _found;  // Might be a different oop with the same value that's already
+                  // in the table, which is the point.
+ public:
+  StringTableLookupOop(Thread* thread, uintx hash, Handle handle)
+    : _thread(thread), _hash(hash), _find(handle) { }
+
+  uintx get_hash() const {
+    return _hash;
+  }
+
+  bool equals(WeakHandle<vm_string_table_data>* value, bool* is_dead) {
+    oop val_oop = value->peek();
+    if (val_oop == NULL) {
+      // dead oop, mark this hash dead for cleaning
+      *is_dead = true;
+      return false;
+    }
+    bool equals = java_lang_String::equals(_find(), val_oop);
+    if (!equals) {
+      return false;
+    }
+    // Need to resolve weak handle and Handleize through possible safepoint.
+    _found = Handle(_thread, value->resolve());
+    return true;
+  }
+};
+
+static size_t ceil_pow_2(uintx val) {
+  size_t ret;
+  for (ret = 1; ((size_t)1 << ret) < val; ++ret);
+  return ret;
 }
 
-
-oop StringTable::basic_add(int index_arg, Handle string, jchar* name,
-                           int len, unsigned int hashValue_arg, TRAPS) {
-
-  assert(java_lang_String::equals(string(), name, len),
-         "string must be properly initialized");
-  // Cannot hit a safepoint in this function because the "this" pointer can move.
-  NoSafepointVerifier nsv;
+StringTable::StringTable() : _local_table(NULL), _current_size(0), _has_work(0),
+  _needs_rehashing(false), _weak_handles(NULL), _items(0), _uncleaned_items(0) {
+  _weak_handles = new OopStorage("StringTable weak",
+                                 StringTableWeakAlloc_lock,
+                                 StringTableWeakActive_lock);
+  size_t start_size_log_2 = ceil_pow_2(StringTableSize);
+  _current_size = ((size_t)1) << start_size_log_2;
+  log_trace(stringtable)("Start size: " SIZE_FORMAT " (" SIZE_FORMAT ")",
+                         _current_size, start_size_log_2);
+  _local_table = new StringTableHash(start_size_log_2, END_SIZE, REHASH_LEN);
+}
 
-  // Check if the symbol table has been rehashed, if so, need to recalculate
-  // the hash value and index before second lookup.
-  unsigned int hashValue;
-  int index;
-  if (use_alternate_hashcode()) {
-    hashValue = alt_hash_string(name, len);
-    index = hash_to_index(hashValue);
-  } else {
-    hashValue = hashValue_arg;
-    index = index_arg;
-  }
+size_t StringTable::item_added() {
+  return Atomic::add((size_t)1, &(the_table()->_items));
+}
 
-  // Since look-up was done lock-free, we need to check if another
-  // thread beat us in the race to insert the symbol.
-
-  // No need to lookup the shared table from here since the caller (intern()) already did
-  oop test = lookup_in_main_table(index, name, len, hashValue); // calls lookup(u1*, int)
-  if (test != NULL) {
-    // Entry already added
-    return test;
-  }
-
-  HashtableEntry<oop, mtSymbol>* entry = new_entry(hashValue, string());
-  add_entry(index, entry);
-  return string();
+size_t StringTable::items_to_clean(size_t ncl) {
+  size_t total = Atomic::add((size_t)ncl, &(the_table()->_uncleaned_items));
+  log_trace(stringtable)(
+     "Uncleaned items:" SIZE_FORMAT " added: " SIZE_FORMAT " total:" SIZE_FORMAT,
+     the_table()->_uncleaned_items, ncl, total);
+  return total;
 }
 
+void StringTable::item_removed() {
+  Atomic::add((size_t)-1, &(the_table()->_items));
+  Atomic::add((size_t)-1, &(the_table()->_uncleaned_items));
+}
 
+double StringTable::get_load_factor() {
+  return (_items*1.0)/_current_size;
+}
+
+double StringTable::get_dead_factor() {
+  return (_uncleaned_items*1.0)/_current_size;
+}
+
+size_t StringTable::table_size(Thread* thread) {
+  return ((size_t)(1)) << _local_table->get_size_log2(thread != NULL ? thread
+                                                      : Thread::current());
+}
+
+void StringTable::trigger_concurrent_work() {
+  MutexLockerEx ml(Service_lock, Mutex::_no_safepoint_check_flag);
+  the_table()->_has_work = true;
+  Service_lock->notify_all();
+}
+
+// Probing
 oop StringTable::lookup(Symbol* symbol) {
   ResourceMark rm;
   int length;
@@ -211,71 +239,45 @@
 }
 
 oop StringTable::lookup(jchar* name, int len) {
-  // shared table always uses java_lang_String::hash_code
   unsigned int hash = java_lang_String::hash_code(name, len);
-  oop string = lookup_shared(name, len, hash);
+  oop string = StringTable::the_table()->lookup_shared(name, len, hash);
   if (string != NULL) {
     return string;
   }
-  if (use_alternate_hashcode()) {
-    hash = alt_hash_string(name, len);
+  if (StringTable::_alt_hash) {
+    hash = hash_string(name, len, true);
   }
-  int index = the_table()->hash_to_index(hash);
-  string = the_table()->lookup_in_main_table(index, name, len, hash);
-
-  return string;
+  return StringTable::the_table()->do_lookup(name, len, hash);
 }
 
-oop StringTable::intern(Handle string_or_null, jchar* name,
-                        int len, TRAPS) {
-  // shared table always uses java_lang_String::hash_code
-  unsigned int hashValue = java_lang_String::hash_code(name, len);
-  oop found_string = lookup_shared(name, len, hashValue);
-  if (found_string != NULL) {
-    return found_string;
-  }
-  if (use_alternate_hashcode()) {
-    hashValue = alt_hash_string(name, len);
+class StringTableGet : public StackObj {
+  Thread* _thread;
+  Handle  _return;
+ public:
+  StringTableGet(Thread* thread) : _thread(thread) {}
+  void operator()(WeakHandle<vm_string_table_data>* val) {
+    oop result = val->resolve();
+    assert(result != NULL, "Result should be reachable");
+    _return = Handle(_thread, result);
   }
-  int index = the_table()->hash_to_index(hashValue);
-  found_string = the_table()->lookup_in_main_table(index, name, len, hashValue);
-
-  // Found
-  if (found_string != NULL) {
-    return found_string;
+  oop get_res_oop() {
+    return _return();
   }
-
-  debug_only(StableMemoryChecker smc(name, len * sizeof(name[0])));
-  assert(!Universe::heap()->is_in_reserved(name),
-         "proposed name of symbol must be stable");
+};
 
-  HandleMark hm(THREAD);  // cleanup strings created
-  Handle string;
-  // try to reuse the string if possible
-  if (!string_or_null.is_null()) {
-    string = string_or_null;
-  } else {
-    string = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
+oop StringTable::do_lookup(jchar* name, int len, uintx hash) {
+  Thread* thread = Thread::current();
+  StringTableLookupJchar lookup(thread, hash, name, len);
+  StringTableGet stg(thread);
+  bool rehash_warning;
+  _local_table->get(thread, lookup, stg, &rehash_warning);
+  if (rehash_warning) {
+    _needs_rehashing = true;
   }
-
-  // Deduplicate the string before it is interned. Note that we should never
-  // deduplicate a string after it has been interned. Doing so will counteract
-  // compiler optimizations done on e.g. interned string literals.
-  Universe::heap()->deduplicate_string(string());
-
-  // Grab the StringTable_lock before getting the_table() because it could
-  // change at safepoint.
-  oop added_or_found;
-  {
-    MutexLocker ml(StringTable_lock, THREAD);
-    // Otherwise, add to symbol to table
-    added_or_found = the_table()->basic_add(index, string, name, len,
-                                  hashValue, CHECK_NULL);
-  }
-
-  return added_or_found;
+  return stg.get_res_oop();
 }
 
+// Interning
 oop StringTable::intern(Symbol* symbol, TRAPS) {
   if (symbol == NULL) return NULL;
   ResourceMark rm(THREAD);
@@ -286,19 +288,17 @@
   return result;
 }
 
-
-oop StringTable::intern(oop string, TRAPS)
-{
+oop StringTable::intern(oop string, TRAPS) {
   if (string == NULL) return NULL;
   ResourceMark rm(THREAD);
   int length;
   Handle h_string (THREAD, string);
-  jchar* chars = java_lang_String::as_unicode_string(string, length, CHECK_NULL);
+  jchar* chars = java_lang_String::as_unicode_string(string, length,
+                                                     CHECK_NULL);
   oop result = intern(h_string, chars, length, CHECK_NULL);
   return result;
 }
 
-
 oop StringTable::intern(const char* utf8_string, TRAPS) {
   if (utf8_string == NULL) return NULL;
   ResourceMark rm(THREAD);
@@ -310,340 +310,449 @@
   return result;
 }
 
-void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
-  BucketUnlinkContext context;
-  buckets_unlink_or_oops_do(is_alive, f, 0, the_table()->table_size(), &context);
-  _the_table->bulk_free_entries(&context);
-  *processed = context._num_processed;
-  *removed = context._num_removed;
-}
-
-void StringTable::possibly_parallel_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int* processed, int* removed) {
-  // Readers of the table are unlocked, so we should only be removing
-  // entries at a safepoint.
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  const int limit = the_table()->table_size();
-
-  BucketUnlinkContext context;
-  for (;;) {
-    // Grab next set of buckets to scan
-    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
-    if (start_idx >= limit) {
-      // End of table
-      break;
-    }
-
-    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
-    buckets_unlink_or_oops_do(is_alive, f, start_idx, end_idx, &context);
+oop StringTable::intern(Handle string_or_null_h, jchar* name, int len, TRAPS) {
+  // shared table always uses java_lang_String::hash_code
+  unsigned int hash = java_lang_String::hash_code(name, len);
+  oop found_string = StringTable::the_table()->lookup_shared(name, len, hash);
+  if (found_string != NULL) {
+    return found_string;
   }
-  _the_table->bulk_free_entries(&context);
-  *processed = context._num_processed;
-  *removed = context._num_removed;
+  if (StringTable::_alt_hash) {
+    hash = hash_string(name, len, true);
+  }
+  return StringTable::the_table()->do_intern(string_or_null_h, name, len,
+                                             hash, CHECK_NULL);
 }
 
-void StringTable::buckets_oops_do(OopClosure* f, int start_idx, int end_idx) {
-  const int limit = the_table()->table_size();
+class StringTableCreateEntry : public StackObj {
+ private:
+   Thread* _thread;
+   Handle  _return;
+   Handle  _store;
+ public:
+  StringTableCreateEntry(Thread* thread, Handle store)
+    : _thread(thread), _store(store) {}
 
-  assert(0 <= start_idx && start_idx <= limit,
-         "start_idx (%d) is out of bounds", start_idx);
-  assert(0 <= end_idx && end_idx <= limit,
-         "end_idx (%d) is out of bounds", end_idx);
-  assert(start_idx <= end_idx,
-         "Index ordering: start_idx=%d, end_idx=%d",
-         start_idx, end_idx);
+  WeakHandle<vm_string_table_data> operator()() { // No dups found
+    WeakHandle<vm_string_table_data> wh =
+      WeakHandle<vm_string_table_data>::create(_store);
+    return wh;
+  }
+  void operator()(bool inserted, WeakHandle<vm_string_table_data>* val) {
+    oop result = val->resolve();
+    assert(result != NULL, "Result should be reachable");
+    _return = Handle(_thread, result);
+  }
+  oop get_return() const {
+    return _return();
+  }
+};
 
-  for (int i = start_idx; i < end_idx; i += 1) {
-    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
-    while (entry != NULL) {
-      assert(!entry->is_shared(), "CDS not used for the StringTable");
+oop StringTable::do_intern(Handle string_or_null_h, jchar* name,
+                           int len, uintx hash, TRAPS) {
+  HandleMark hm(THREAD);  // cleanup strings created
+  Handle string_h;
+
+  if (!string_or_null_h.is_null()) {
+    string_h = string_or_null_h;
+  } else {
+    string_h = java_lang_String::create_from_unicode(name, len, CHECK_NULL);
+  }
 
-      f->do_oop((oop*)entry->literal_addr());
+  // Deduplicate the string before it is interned. Note that we should never
+  // deduplicate a string after it has been interned. Doing so will counteract
+  // compiler optimizations done on e.g. interned string literals.
+  Universe::heap()->deduplicate_string(string_h());
 
-      entry = entry->next();
-    }
+  assert(java_lang_String::equals(string_h(), name, len),
+         "string must be properly initialized");
+  assert(len == java_lang_String::length(string_h()), "Must be same length");
+  StringTableLookupOop lookup(THREAD, hash, string_h);
+  StringTableCreateEntry stc(THREAD, string_h);
+
+  bool rehash_warning;
+  _local_table->get_insert_lazy(THREAD, lookup, stc, stc, &rehash_warning);
+  if (rehash_warning) {
+    _needs_rehashing = true;
   }
+  return stc.get_return();
 }
 
-void StringTable::buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context) {
-  const int limit = the_table()->table_size();
-
-  assert(0 <= start_idx && start_idx <= limit,
-         "start_idx (%d) is out of bounds", start_idx);
-  assert(0 <= end_idx && end_idx <= limit,
-         "end_idx (%d) is out of bounds", end_idx);
-  assert(start_idx <= end_idx,
-         "Index ordering: start_idx=%d, end_idx=%d",
-         start_idx, end_idx);
+// GC support
+class StringTableIsAliveCounter : public BoolObjectClosure {
+  BoolObjectClosure* _real_boc;
+ public:
+  size_t _count;
+  size_t _count_total;
+  StringTableIsAliveCounter(BoolObjectClosure* boc) : _real_boc(boc), _count(0),
+                                                      _count_total(0) {}
+  bool do_object_b(oop obj) {
+    bool ret = _real_boc->do_object_b(obj);
+    if (!ret) {
+      ++_count;
+    }
+    ++_count_total;
+    return ret;
+  }
+};
 
-  for (int i = start_idx; i < end_idx; ++i) {
-    HashtableEntry<oop, mtSymbol>** p = the_table()->bucket_addr(i);
-    HashtableEntry<oop, mtSymbol>* entry = the_table()->bucket(i);
-    while (entry != NULL) {
-      assert(!entry->is_shared(), "CDS not used for the StringTable");
+void StringTable::unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f,
+                                    int* processed, int* removed) {
+  DoNothingClosure dnc;
+  assert(is_alive != NULL, "No closure");
+  StringTableIsAliveCounter stiac(is_alive);
+  OopClosure* tmp = f != NULL ? f : &dnc;
 
-      if (is_alive->do_object_b(string_object_no_keepalive(entry))) {
-        if (f != NULL) {
-          f->do_oop(entry->literal_addr());
-        }
-        p = entry->next_addr();
-      } else {
-        *p = entry->next();
-        context->free_entry(entry);
-      }
-      context->_num_processed++;
-      entry = *p;
-    }
+  StringTable::the_table()->_weak_handles->weak_oops_do(&stiac, tmp);
+
+  StringTable::the_table()->items_to_clean(stiac._count);
+  StringTable::the_table()->check_concurrent_work();
+  if (processed != NULL) {
+    *processed = (int) stiac._count_total;
+  }
+  if (removed != NULL) {
+    *removed = (int) stiac._count;
   }
 }
 
 void StringTable::oops_do(OopClosure* f) {
-  buckets_oops_do(f, 0, the_table()->table_size());
+  assert(f != NULL, "No closure");
+  StringTable::the_table()->_weak_handles->oops_do(f);
+}
+
+void StringTable::possibly_parallel_unlink(
+   OopStorage::ParState<false, false>* _par_state_string, BoolObjectClosure* cl,
+   int* processed, int* removed)
+{
+  DoNothingClosure dnc;
+  assert(cl != NULL, "No closure");
+  StringTableIsAliveCounter stiac(cl);
+
+  _par_state_string->weak_oops_do(&stiac, &dnc);
+
+  StringTable::the_table()->items_to_clean(stiac._count);
+  StringTable::the_table()->check_concurrent_work();
+  *processed = (int) stiac._count_total;
+  *removed = (int) stiac._count;
+}
+
+void StringTable::possibly_parallel_oops_do(
+   OopStorage::ParState<false /* concurrent */, false /* const */>*
+   _par_state_string, OopClosure* f)
+{
+  assert(f != NULL, "No closure");
+  _par_state_string->oops_do(f);
+}
+
+// Concurrent work
+void StringTable::grow(JavaThread* jt) {
+  StringTableHash::GrowTask gt(_local_table);
+  if (!gt.prepare(jt)) {
+    return;
+  }
+  log_trace(stringtable)("Started to grow");
+  {
+    TraceTime timer("Grow", TRACETIME_LOG(Debug, stringtable, perf));
+    while (gt.doTask(jt)) {
+      gt.pause(jt);
+      {
+        ThreadBlockInVM tbivm(jt);
+      }
+      gt.cont(jt);
+    }
+  }
+  gt.done(jt);
+  _current_size = table_size(jt);
+  log_debug(stringtable)("Grown to size:" SIZE_FORMAT, _current_size);
 }
 
-void StringTable::possibly_parallel_oops_do(OopClosure* f) {
-  const int limit = the_table()->table_size();
+struct StringTableDoDelete : StackObj {
+  long _count;
+  StringTableDoDelete() : _count(0) {}
+  void operator()(WeakHandle<vm_string_table_data>* val) {
+    ++_count;
+  }
+};
+
+struct StringTableDeleteCheck : StackObj {
+  long _count;
+  long _item;
+  StringTableDeleteCheck() : _count(0), _item(0) {}
+  bool operator()(WeakHandle<vm_string_table_data>* val) {
+    ++_item;
+    oop tmp = val->peek();
+    if (tmp == NULL) {
+      ++_count;
+      return true;
+    } else {
+      return false;
+    }
+  }
+};
 
-  for (;;) {
-    // Grab next set of buckets to scan
-    int start_idx = Atomic::add(ClaimChunkSize, &_parallel_claimed_idx) - ClaimChunkSize;
-    if (start_idx >= limit) {
-      // End of table
-      break;
+void StringTable::clean_dead_entries(JavaThread* jt) {
+  StringTableHash::BulkDeleteTask bdt(_local_table);
+  if (!bdt.prepare(jt)) {
+    return;
+  }
+
+  StringTableDeleteCheck stdc;
+  StringTableDoDelete stdd;
+  bool interrupted = false;
+  {
+    TraceTime timer("Clean", TRACETIME_LOG(Debug, stringtable, perf));
+    while(bdt.doTask(jt, stdc, stdd)) {
+      bdt.pause(jt);
+      {
+        ThreadBlockInVM tbivm(jt);
+      }
+      if (!bdt.cont(jt)) {
+        interrupted = true;
+        break;
+      }
     }
-
-    int end_idx = MIN2(limit, start_idx + ClaimChunkSize);
-    buckets_oops_do(f, start_idx, end_idx);
   }
+  if (interrupted) {
+    _has_work = true;
+  } else {
+    bdt.done(jt);
+  }
+  log_debug(stringtable)("Cleaned %ld of %ld", stdc._count, stdc._item);
 }
 
-// This verification is part of Universe::verify() and needs to be quick.
-// See StringTable::verify_and_compare() below for exhaustive verification.
-void StringTable::verify() {
-  for (int i = 0; i < the_table()->table_size(); ++i) {
-    HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
-    for ( ; p != NULL; p = p->next()) {
-      oop s = string_object_no_keepalive(p);
-      guarantee(s != NULL, "interned string is NULL");
-      unsigned int h = hash_string(s);
-      guarantee(p->hash() == h, "broken hash in string table entry");
-      guarantee(the_table()->hash_to_index(h) == i,
-                "wrong index in string table");
-    }
+void StringTable::check_concurrent_work() {
+  if (_has_work) {
+    return;
+  }
+  double load_factor = StringTable::get_load_factor();
+  double dead_factor = StringTable::get_dead_factor();
+  // We should clean/resize if we have more dead than alive,
+  // more items than preferred load factor or
+  // more dead items than water mark.
+  if ((dead_factor > load_factor) ||
+      (load_factor > PREF_AVG_LIST_LEN) ||
+      (dead_factor > CLEAN_DEAD_HIGH_WATER_MARK)) {
+    log_debug(stringtable)("Concurrent work triggered, live factor:%g dead factor:%g",
+                           load_factor, dead_factor);
+    trigger_concurrent_work();
   }
 }
 
-void StringTable::dump(outputStream* st, bool verbose) {
-  if (!verbose) {
-    the_table()->print_table_statistics(st, "StringTable", string_object_no_keepalive);
+void StringTable::concurrent_work(JavaThread* jt) {
+  _has_work = false;
+  double load_factor = get_load_factor();
+  log_debug(stringtable, perf)("Concurrent work, live factor: %g", load_factor);
+  // We prefer growing, since that also removes dead items
+  if (load_factor > PREF_AVG_LIST_LEN && !_local_table->is_max_size_reached()) {
+    grow(jt);
   } else {
-    Thread* THREAD = Thread::current();
-    st->print_cr("VERSION: 1.1");
-    for (int i = 0; i < the_table()->table_size(); ++i) {
-      HashtableEntry<oop, mtSymbol>* p = the_table()->bucket(i);
-      for ( ; p != NULL; p = p->next()) {
-        oop s = string_object_no_keepalive(p);
-        typeArrayOop value     = java_lang_String::value_no_keepalive(s);
-        int          length    = java_lang_String::length(s);
-        bool         is_latin1 = java_lang_String::is_latin1(s);
-
-        if (length <= 0) {
-          st->print("%d: ", length);
-        } else {
-          ResourceMark rm(THREAD);
-          int utf8_length = length;
-          char* utf8_string;
-
-          if (!is_latin1) {
-            jchar* chars = value->char_at_addr(0);
-            utf8_string = UNICODE::as_utf8(chars, utf8_length);
-          } else {
-            jbyte* bytes = value->byte_at_addr(0);
-            utf8_string = UNICODE::as_utf8(bytes, utf8_length);
-          }
-
-          st->print("%d: ", utf8_length);
-          HashtableTextDump::put_utf8(st, utf8_string, utf8_length);
-        }
-        st->cr();
-      }
-    }
+    clean_dead_entries(jt);
   }
 }
 
-StringTable::VerifyRetTypes StringTable::compare_entries(
-                                      int bkt1, int e_cnt1,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr1,
-                                      int bkt2, int e_cnt2,
-                                      HashtableEntry<oop, mtSymbol>* e_ptr2) {
-  // These entries are sanity checked by verify_and_compare_entries()
-  // before this function is called.
-  oop str1 = string_object_no_keepalive(e_ptr1);
-  oop str2 = string_object_no_keepalive(e_ptr2);
+void StringTable::do_concurrent_work(JavaThread* jt) {
+  StringTable::the_table()->concurrent_work(jt);
+}
 
-  if (str1 == str2) {
-    tty->print_cr("ERROR: identical oop values (0x" PTR_FORMAT ") "
-                  "in entry @ bucket[%d][%d] and entry @ bucket[%d][%d]",
-                  p2i(str1), bkt1, e_cnt1, bkt2, e_cnt2);
-    return _verify_fail_continue;
+// Rehash
+bool StringTable::do_rehash() {
+  if (!_local_table->is_safepoint_safe()) {
+    return false;
   }
 
-  if (java_lang_String::equals(str1, str2)) {
-    tty->print_cr("ERROR: identical String values in entry @ "
-                  "bucket[%d][%d] and entry @ bucket[%d][%d]",
-                  bkt1, e_cnt1, bkt2, e_cnt2);
-    return _verify_fail_continue;
+  // We use max size
+  StringTableHash* new_table = new StringTableHash(END_SIZE, END_SIZE, REHASH_LEN);
+  // Use alt hash from now on
+  _alt_hash = true;
+  if (!_local_table->try_move_nodes_to(Thread::current(), new_table)) {
+    _alt_hash = false;
+    delete new_table;
+    return false;
   }
 
-  return _verify_pass;
+  // free old table
+  delete _local_table;
+  _local_table = new_table;
+
+  return true;
 }
 
-StringTable::VerifyRetTypes StringTable::verify_entry(int bkt, int e_cnt,
-                                                      HashtableEntry<oop, mtSymbol>* e_ptr,
-                                                      StringTable::VerifyMesgModes mesg_mode) {
-
-  VerifyRetTypes ret = _verify_pass;  // be optimistic
+void StringTable::try_rehash_table() {
+  static bool rehashed = false;
+  log_debug(stringtable)("Table imbalanced, rehashing called.");
 
-  oop str = string_object_no_keepalive(e_ptr);
-  if (str == NULL) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: NULL oop value in entry @ bucket[%d][%d]", bkt,
-                    e_cnt);
-    }
-    // NULL oop means no more verifications are possible
-    return _verify_fail_done;
+  // Grow instead of rehash.
+  if (get_load_factor() > PREF_AVG_LIST_LEN &&
+      !_local_table->is_max_size_reached()) {
+    log_debug(stringtable)("Choosing growing over rehashing.");
+    trigger_concurrent_work();
+    _needs_rehashing = false;
+    return;
+  }
+  // Already rehashed.
+  if (rehashed) {
+    log_warning(stringtable)("Rehashing already done, still long lists.");
+    trigger_concurrent_work();
+    _needs_rehashing = false;
+    return;
   }
 
-  if (str->klass() != SystemDictionary::String_klass()) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: oop is not a String in entry @ bucket[%d][%d]",
-                    bkt, e_cnt);
+  murmur_seed = AltHashing::compute_seed();
+  {
+    if (do_rehash()) {
+      rehashed = true;
+    } else {
+      log_info(stringtable)("Resizes in progress rehashing skipped.");
     }
-    // not a String means no more verifications are possible
-    return _verify_fail_done;
   }
+  _needs_rehashing = false;
+}
+
+void StringTable::rehash_table() {
+  StringTable::the_table()->try_rehash_table();
+}
 
-  unsigned int h = hash_string(str);
-  if (e_ptr->hash() != h) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: broken hash value in entry @ bucket[%d][%d], "
-                    "bkt_hash=%d, str_hash=%d", bkt, e_cnt, e_ptr->hash(), h);
-    }
-    ret = _verify_fail_continue;
+// Statistics
+static int literal_size(oop obj) {
+  // NOTE: this would over-count if (pre-JDK8)
+  // java_lang_Class::has_offset_field() is true and the String.value array is
+  // shared by several Strings. However, starting from JDK8, the String.value
+  // array is not shared anymore.
+  if (obj == NULL) {
+    return 0;
+  } else if (obj->klass() == SystemDictionary::String_klass()) {
+    return (obj->size() + java_lang_String::value(obj)->size()) * HeapWordSize;
+  } else {
+    return obj->size();
   }
+}
 
-  if (the_table()->hash_to_index(h) != bkt) {
-    if (mesg_mode == _verify_with_mesgs) {
-      tty->print_cr("ERROR: wrong index value for entry @ bucket[%d][%d], "
-                    "str_hash=%d, hash_to_index=%d", bkt, e_cnt, h,
-                    the_table()->hash_to_index(h));
+struct SizeFunc : StackObj {
+  size_t operator()(WeakHandle<vm_string_table_data>* val) {
+    oop s = val->peek();
+    if (s == NULL) {
+      // Dead
+      return 0;
     }
-    ret = _verify_fail_continue;
-  }
+    return literal_size(s);
+  };
+};
 
-  return ret;
+void StringTable::print_table_statistics(outputStream* st,
+                                         const char* table_name) {
+  SizeFunc sz;
+  _local_table->statistics_to(Thread::current(), sz, st, table_name);
 }
 
-// See StringTable::verify() above for the quick verification that is
-// part of Universe::verify(). This verification is exhaustive and
-// reports on every issue that is found. StringTable::verify() only
-// reports on the first issue that is found.
-//
-// StringTable::verify_entry() checks:
-// - oop value != NULL (same as verify())
-// - oop value is a String
-// - hash(String) == hash in entry (same as verify())
-// - index for hash == index of entry (same as verify())
-//
-// StringTable::compare_entries() checks:
-// - oops are unique across all entries
-// - String values are unique across all entries
-//
-int StringTable::verify_and_compare_entries() {
-  assert(StringTable_lock->is_locked(), "sanity check");
+// Verification
+class VerifyStrings : StackObj {
+ public:
+  bool operator()(WeakHandle<vm_string_table_data>* val) {
+    oop s = val->peek();
+    if (s != NULL) {
+      assert(java_lang_String::length(s) >= 0, "Length on string must work.");
+    }
+    return true;
+  };
+};
+
+// This verification is part of Universe::verify() and needs to be quick.
+void StringTable::verify() {
+  Thread* thr = Thread::current();
+  VerifyStrings vs;
+  if (!the_table()->_local_table->try_scan(thr, vs)) {
+    log_info(stringtable)("verify unavailable at this moment");
+  }
+}
+
+// Verification and comp
+class VerifyCompStrings : StackObj {
+  GrowableArray<oop>* _oops;
+ public:
+  size_t _errors;
+  VerifyCompStrings(GrowableArray<oop>* oops) : _oops(oops), _errors(0) {}
+  bool operator()(WeakHandle<vm_string_table_data>* val) {
+    oop s = val->resolve();
+    if (s == NULL) {
+      return true;
+    }
+    int len = _oops->length();
+    for (int i = 0; i < len; i++) {
+      bool eq = java_lang_String::equals(s, _oops->at(i));
+      assert(!eq, "Duplicate strings");
+      if (eq) {
+        _errors++;
+      }
+    }
+    _oops->push(s);
+    return true;
+  };
+};
+
+size_t StringTable::verify_and_compare_entries() {
+  Thread* thr = Thread::current();
+  GrowableArray<oop>* oops =
+    new (ResourceObj::C_HEAP, mtInternal)
+      GrowableArray<oop>((int)the_table()->_current_size, true);
 
-  int  fail_cnt = 0;
+  VerifyCompStrings vcs(oops);
+  if (!the_table()->_local_table->try_scan(thr, vcs)) {
+    log_info(stringtable)("verify unavailable at this moment");
+  }
+  delete oops;
+  return vcs._errors;
+}
+
+// Dumping
+class PrintString : StackObj {
+  Thread* _thr;
+  outputStream* _st;
+ public:
+  PrintString(Thread* thr, outputStream* st) : _thr(thr), _st(st) {}
+  bool operator()(WeakHandle<vm_string_table_data>* val) {
+    oop s = val->peek();
+    if (s == NULL) {
+      return true;
+    }
+    typeArrayOop value     = java_lang_String::value_no_keepalive(s);
+    int          length    = java_lang_String::length(s);
+    bool         is_latin1 = java_lang_String::is_latin1(s);
 
-  // first, verify all the entries individually:
-  for (int bkt = 0; bkt < the_table()->table_size(); bkt++) {
-    HashtableEntry<oop, mtSymbol>* e_ptr = the_table()->bucket(bkt);
-    for (int e_cnt = 0; e_ptr != NULL; e_ptr = e_ptr->next(), e_cnt++) {
-      VerifyRetTypes ret = verify_entry(bkt, e_cnt, e_ptr, _verify_with_mesgs);
-      if (ret != _verify_pass) {
-        fail_cnt++;
+    if (length <= 0) {
+      _st->print("%d: ", length);
+    } else {
+      ResourceMark rm(_thr);
+      int utf8_length = length;
+      char* utf8_string;
+
+      if (!is_latin1) {
+        jchar* chars = value->char_at_addr(0);
+        utf8_string = UNICODE::as_utf8(chars, utf8_length);
+      } else {
+        jbyte* bytes = value->byte_at_addr(0);
+        utf8_string = UNICODE::as_utf8(bytes, utf8_length);
       }
+
+      _st->print("%d: ", utf8_length);
+      HashtableTextDump::put_utf8(_st, utf8_string, utf8_length);
+    }
+    _st->cr();
+    return true;
+  };
+};
+
+void StringTable::dump(outputStream* st, bool verbose) {
+  if (!verbose) {
+    the_table()->print_table_statistics(st, "StringTable");
+  } else {
+    Thread* thr = Thread::current();
+    ResourceMark rm(thr);
+    st->print_cr("VERSION: 1.1");
+    PrintString ps(thr, st);
+    if (!the_table()->_local_table->try_scan(thr, ps)) {
+      st->print_cr("dump unavailable at this moment");
     }
   }
-
-  // Optimization: if the above check did not find any failures, then
-  // the comparison loop below does not need to call verify_entry()
-  // before calling compare_entries(). If there were failures, then we
-  // have to call verify_entry() to see if the entry can be passed to
-  // compare_entries() safely. When we call verify_entry() in the loop
-  // below, we do so quietly to void duplicate messages and we don't
-  // increment fail_cnt because the failures have already been counted.
-  bool need_entry_verify = (fail_cnt != 0);
-
-  // second, verify all entries relative to each other:
-  for (int bkt1 = 0; bkt1 < the_table()->table_size(); bkt1++) {
-    HashtableEntry<oop, mtSymbol>* e_ptr1 = the_table()->bucket(bkt1);
-    for (int e_cnt1 = 0; e_ptr1 != NULL; e_ptr1 = e_ptr1->next(), e_cnt1++) {
-      if (need_entry_verify) {
-        VerifyRetTypes ret = verify_entry(bkt1, e_cnt1, e_ptr1,
-                                          _verify_quietly);
-        if (ret == _verify_fail_done) {
-          // cannot use the current entry to compare against other entries
-          continue;
-        }
-      }
-
-      for (int bkt2 = bkt1; bkt2 < the_table()->table_size(); bkt2++) {
-        HashtableEntry<oop, mtSymbol>* e_ptr2 = the_table()->bucket(bkt2);
-        int e_cnt2;
-        for (e_cnt2 = 0; e_ptr2 != NULL; e_ptr2 = e_ptr2->next(), e_cnt2++) {
-          if (bkt1 == bkt2 && e_cnt2 <= e_cnt1) {
-            // skip the entries up to and including the one that
-            // we're comparing against
-            continue;
-          }
-
-          if (need_entry_verify) {
-            VerifyRetTypes ret = verify_entry(bkt2, e_cnt2, e_ptr2,
-                                              _verify_quietly);
-            if (ret == _verify_fail_done) {
-              // cannot compare against this entry
-              continue;
-            }
-          }
-
-          // compare two entries, report and count any failures:
-          if (compare_entries(bkt1, e_cnt1, e_ptr1, bkt2, e_cnt2, e_ptr2)
-              != _verify_pass) {
-            fail_cnt++;
-          }
-        }
-      }
-    }
-  }
-  return fail_cnt;
-}
-
-// Create a new table and using alternate hash code, populate the new table
-// with the existing strings.   Set flag to use the alternate hash code afterwards.
-void StringTable::rehash_table() {
-  assert(SafepointSynchronize::is_at_safepoint(), "must be at safepoint");
-  // This should never happen with -Xshare:dump but it might in testing mode.
-  if (DumpSharedSpaces) return;
-  StringTable* new_table = new StringTable();
-
-  // Rehash the table
-  the_table()->move_to(new_table);
-
-  // Delete the table and buckets (entries are reused in new table).
-  delete _the_table;
-  // Don't check if we need rehashing until the table gets unbalanced again.
-  // Then rehash with a new global seed.
-  _needs_rehashing = false;
-  _the_table = new_table;
 }
 
 // Utility for dumping strings
@@ -671,14 +780,21 @@
   }
 }
 
+// Sharing
 #if INCLUDE_CDS_JAVA_HEAP
-// Sharing
+oop StringTable::lookup_shared(jchar* name, int len, unsigned int hash) {
+  assert(hash == java_lang_String::hash_code(name, len),
+         "hash must be computed using java_lang_String::hash_code");
+  return _shared_table.lookup((const char*)name, hash, len);
+}
+
 oop StringTable::create_archived_string(oop s, Thread* THREAD) {
   assert(DumpSharedSpaces, "this function is only used with -Xshare:dump");
 
   oop new_s = NULL;
   typeArrayOop v = java_lang_String::value_no_keepalive(s);
-  typeArrayOop new_v = (typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
+  typeArrayOop new_v =
+    (typeArrayOop)MetaspaceShared::archive_heap_object(v, THREAD);
   if (new_v == NULL) {
     return NULL;
   }
@@ -692,51 +808,51 @@
   return new_s;
 }
 
-bool StringTable::copy_shared_string(GrowableArray<MemRegion> *string_space,
-                                     CompactStringTableWriter* writer) {
+struct CopyToArchive : StackObj {
+  CompactStringTableWriter* _writer;
+  CopyToArchive(CompactStringTableWriter* writer) : _writer(writer) {}
+  bool operator()(WeakHandle<vm_string_table_data>* val) {
+    oop s = val->peek();
+    if (s == NULL) {
+      return true;
+    }
+    unsigned int hash = java_lang_String::hash_code(s);
+    if (hash == 0) {
+      return true;
+    }
+
+    java_lang_String::set_hash(s, hash);
+    oop new_s = StringTable::create_archived_string(s, Thread::current());
+    if (new_s == NULL) {
+      return true;
+    }
+
+    val->replace(new_s);
+    // add to the compact table
+    _writer->add(hash, new_s);
+    return true;
+  }
+};
+
+void StringTable::copy_shared_string_table(CompactStringTableWriter* writer) {
   assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
 
-  Thread* THREAD = Thread::current();
-  for (int i = 0; i < the_table()->table_size(); ++i) {
-    HashtableEntry<oop, mtSymbol>* bucket = the_table()->bucket(i);
-    for ( ; bucket != NULL; bucket = bucket->next()) {
-      oop s = string_object_no_keepalive(bucket);
-      unsigned int hash = java_lang_String::hash_code(s);
-      if (hash == 0) {
-        continue;
-      }
-
-      java_lang_String::set_hash(s, hash);
-      oop new_s = create_archived_string(s, THREAD);
-      if (new_s == NULL) {
-        continue;
-      }
-
-      // set the archived string in bucket
-      set_string_object(bucket, new_s);
-
-      // add to the compact table
-      writer->add(hash, new_s);
-    }
-  }
-
-  return true;
+  CopyToArchive copy(writer);
+  StringTable::the_table()->_local_table->do_scan(Thread::current(), copy);
 }
 
-void StringTable::write_to_archive(GrowableArray<MemRegion> *string_space) {
+void StringTable::write_to_archive() {
   assert(MetaspaceShared::is_heap_object_archiving_allowed(), "must be");
 
   _shared_table.reset();
-  int num_buckets = the_table()->number_of_entries() /
-                         SharedSymbolTableBucketSize;
+  int num_buckets = the_table()->_items / SharedSymbolTableBucketSize;
   // calculation of num_buckets can result in zero buckets, we need at least one
   CompactStringTableWriter writer(num_buckets > 1 ? num_buckets : 1,
                                   &MetaspaceShared::stats()->string);
 
   // Copy the interned strings into the "string space" within the java heap
-  if (copy_shared_string(string_space, &writer)) {
-    writer.dump(&_shared_table);
-  }
+  copy_shared_string_table(&writer);
+  writer.dump(&_shared_table);
 }
 
 void StringTable::serialize(SerializeClosure* soc) {
@@ -744,7 +860,8 @@
   _shared_table.serialize(soc);
 
   if (soc->writing()) {
-    _shared_table.reset(); // Sanity. Make sure we don't use the shared table at dump time
+    // Sanity. Make sure we don't use the shared table at dump time
+    _shared_table.reset();
   } else if (!_shared_string_mapped) {
     _shared_table.reset();
   }
--- a/src/hotspot/share/classfile/stringTable.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/stringTable.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,109 +25,111 @@
 #ifndef SHARE_VM_CLASSFILE_STRINGTABLE_HPP
 #define SHARE_VM_CLASSFILE_STRINGTABLE_HPP
 
-#include "utilities/hashtable.hpp"
+#include "gc/shared/oopStorage.hpp"
+#include "gc/shared/oopStorageParState.hpp"
+#include "memory/allocation.hpp"
+#include "memory/padded.hpp"
+#include "oops/oop.hpp"
+#include "oops/weakHandle.hpp"
+#include "utilities/concurrentHashTable.hpp"
 
 template <class T, class N> class CompactHashtable;
 class CompactStringTableWriter;
-class FileMapInfo;
 class SerializeClosure;
 
-class StringTable : public RehashableHashtable<oop, mtSymbol> {
+class StringTable;
+class StringTableConfig;
+typedef ConcurrentHashTable<WeakHandle<vm_string_table_data>,
+                            StringTableConfig, mtSymbol> StringTableHash;
+
+class StringTableCreateEntry;
+
+class StringTable : public CHeapObj<mtSymbol>{
   friend class VMStructs;
   friend class Symbol;
+  friend class StringTableConfig;
+  friend class StringTableCreateEntry;
 
 private:
+  void grow(JavaThread* jt);
+  void clean_dead_entries(JavaThread* jt);
+
   // The string table
   static StringTable* _the_table;
-
   // Shared string table
   static CompactHashtable<oop, char> _shared_table;
   static bool _shared_string_mapped;
+  static bool _alt_hash;
+private:
 
-  // Set if one bucket is out of balance due to hash algorithm deficiency
-  static bool _needs_rehashing;
-
-  // Claimed high water mark for parallel chunked scanning
-  static volatile int _parallel_claimed_idx;
+   // Set if one bucket is out of balance due to hash algorithm deficiency
+  StringTableHash* _local_table;
+  size_t _current_size;
+  volatile bool _has_work;
+  volatile bool _needs_rehashing;
 
-  static oop intern(Handle string_or_null, jchar* chars, int length, TRAPS);
-  oop basic_add(int index, Handle string_or_null, jchar* name, int len,
-                unsigned int hashValue, TRAPS);
+  OopStorage* _weak_handles;
 
-  oop lookup_in_main_table(int index, jchar* chars, int length, unsigned int hashValue);
-  static oop lookup_shared(jchar* name, int len, unsigned int hash);
+  volatile size_t _items;
+  DEFINE_PAD_MINUS_SIZE(1, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
+  volatile size_t _uncleaned_items;
+  DEFINE_PAD_MINUS_SIZE(2, DEFAULT_CACHE_LINE_SIZE, sizeof(volatile size_t));
 
-  // Apply the give oop closure to the entries to the buckets
-  // in the range [start_idx, end_idx).
-  static void buckets_oops_do(OopClosure* f, int start_idx, int end_idx);
+  double get_load_factor();
+  double get_dead_factor();
 
-  typedef StringTable::BucketUnlinkContext BucketUnlinkContext;
-  // Unlink or apply the give oop closure to the entries to the buckets
-  // in the range [start_idx, end_idx). Unlinked bucket entries are collected in the given
-  // context to be freed later.
-  // This allows multiple threads to work on the table at once.
-  static void buckets_unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f, int start_idx, int end_idx, BucketUnlinkContext* context);
+  void check_concurrent_work();
+  void trigger_concurrent_work();
 
-  // Hashing algorithm, used as the hash value used by the
-  //     StringTable for bucket selection and comparison (stored in the
-  //     HashtableEntry structures).  This is used in the String.intern() method.
-  static unsigned int hash_string(const jchar* s, int len);
-  static unsigned int hash_string(oop string);
-  static unsigned int alt_hash_string(const jchar* s, int len);
+  static uintx item_added();
+  static void item_removed();
+  static size_t items_to_clean(size_t ncl);
+
+  StringTable();
 
-  // Accessors for the string roots in the hashtable entries.
-  // Use string_object_no_keepalive() only when the value is not returned
-  // outside of a scope where a thread transition is possible.
-  static oop string_object(HashtableEntry<oop, mtSymbol>* entry);
-  static oop string_object_no_keepalive(HashtableEntry<oop, mtSymbol>* entry);
-  static void set_string_object(HashtableEntry<oop, mtSymbol>* entry, oop string);
+  static oop intern(Handle string_or_null_h, jchar* name, int len, TRAPS);
+  oop do_intern(Handle string_or_null, jchar* name, int len, uintx hash, TRAPS);
+  oop do_lookup(jchar* name, int len, uintx hash);
 
-  StringTable() : RehashableHashtable<oop, mtSymbol>((int)StringTableSize,
-                              sizeof (HashtableEntry<oop, mtSymbol>)) {}
+  void concurrent_work(JavaThread* jt);
+  void print_table_statistics(outputStream* st, const char* table_name);
 
-  StringTable(HashtableBucket<mtSymbol>* t, int number_of_entries)
-    : RehashableHashtable<oop, mtSymbol>((int)StringTableSize, sizeof (HashtableEntry<oop, mtSymbol>), t,
-                     number_of_entries) {}
-public:
+  void try_rehash_table();
+  bool do_rehash();
+
+ public:
   // The string table
   static StringTable* the_table() { return _the_table; }
+  size_t table_size(Thread* thread = NULL);
 
-  // Size of one bucket in the string table.  Used when checking for rollover.
-  static uint bucket_size() { return sizeof(HashtableBucket<mtSymbol>); }
+  static OopStorage* weak_storage() { return the_table()->_weak_handles; }
 
   static void create_table() {
     assert(_the_table == NULL, "One string table allowed.");
     _the_table = new StringTable();
   }
 
+  static void do_concurrent_work(JavaThread* jt);
+  static bool has_work() { return the_table()->_has_work; }
+
   // GC support
   //   Delete pointers to otherwise-unreachable objects.
-  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f) {
-    int processed = 0;
-    int removed = 0;
-    unlink_or_oops_do(cl, f, &processed, &removed);
+  static void unlink(BoolObjectClosure* cl) {
+    unlink_or_oops_do(cl);
   }
-  static void unlink(BoolObjectClosure* cl) {
-    int processed = 0;
-    int removed = 0;
-    unlink_or_oops_do(cl, NULL, &processed, &removed);
-  }
-  static void unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
-  static void unlink(BoolObjectClosure* cl, int* processed, int* removed) {
-    unlink_or_oops_do(cl, NULL, processed, removed);
-  }
+  static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* f = NULL,
+                                int* processed = NULL, int* removed = NULL);
+
   // Serially invoke "f->do_oop" on the locations of all oops in the table.
   static void oops_do(OopClosure* f);
 
   // Possibly parallel versions of the above
-  static void possibly_parallel_unlink_or_oops_do(BoolObjectClosure* cl, OopClosure* f, int* processed, int* removed);
-  static void possibly_parallel_unlink(BoolObjectClosure* cl, int* processed, int* removed) {
-    possibly_parallel_unlink_or_oops_do(cl, NULL, processed, removed);
-  }
-  static void possibly_parallel_oops_do(OopClosure* f);
-
-  // Internal test.
-  static void test_alt_hash() PRODUCT_RETURN;
+  static void possibly_parallel_unlink(
+     OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
+     BoolObjectClosure* cl, int* processed, int* removed);
+  static void possibly_parallel_oops_do(
+     OopStorage::ParState<false /* concurrent */, false /* const*/>* par_state_string,
+     OopClosure* f);
 
   // Probing
   static oop lookup(Symbol* symbol);
@@ -138,46 +140,28 @@
   static oop intern(oop string, TRAPS);
   static oop intern(const char *utf8_string, TRAPS);
 
-  // Debugging
-  static void verify();
-  static void dump(outputStream* st, bool verbose=false);
-
-  enum VerifyMesgModes {
-    _verify_quietly    = 0,
-    _verify_with_mesgs = 1
-  };
-
-  enum VerifyRetTypes {
-    _verify_pass          = 0,
-    _verify_fail_continue = 1,
-    _verify_fail_done     = 2
-  };
-
-  static VerifyRetTypes compare_entries(int bkt1, int e_cnt1,
-                                        HashtableEntry<oop, mtSymbol>* e_ptr1,
-                                        int bkt2, int e_cnt2,
-                                        HashtableEntry<oop, mtSymbol>* e_ptr2);
-  static VerifyRetTypes verify_entry(int bkt, int e_cnt,
-                                     HashtableEntry<oop, mtSymbol>* e_ptr,
-                                     VerifyMesgModes mesg_mode);
-  static int verify_and_compare_entries();
+  // Rehash the string table if it gets out of balance
+  static void rehash_table();
+  static bool needs_rehashing()
+    { return StringTable::the_table()->_needs_rehashing; }
 
   // Sharing
+ private:
+  oop lookup_shared(jchar* name, int len, unsigned int hash) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
+  static void copy_shared_string_table(CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN;
+ public:
+  static oop create_archived_string(oop s, Thread* THREAD);
   static void set_shared_string_mapped() { _shared_string_mapped = true; }
   static bool shared_string_mapped()       { return _shared_string_mapped; }
   static void shared_oops_do(OopClosure* f) NOT_CDS_JAVA_HEAP_RETURN;
-  static bool copy_shared_string(GrowableArray<MemRegion> *string_space,
-                                 CompactStringTableWriter* ch_table) NOT_CDS_JAVA_HEAP_RETURN_(false);
-  static oop  create_archived_string(oop s, Thread* THREAD) NOT_CDS_JAVA_HEAP_RETURN_(NULL);
-  static void write_to_archive(GrowableArray<MemRegion> *string_space) NOT_CDS_JAVA_HEAP_RETURN;
+  static void write_to_archive() NOT_CDS_JAVA_HEAP_RETURN;
   static void serialize(SerializeClosure* soc) NOT_CDS_JAVA_HEAP_RETURN;
 
-  // Rehash the symbol table if it gets out of balance
-  static void rehash_table();
-  static bool needs_rehashing() { return _needs_rehashing; }
+  // Jcmd
+  static void dump(outputStream* st, bool verbose=false);
+  // Debugging
+  static size_t verify_and_compare_entries();
+  static void verify();
+};
 
-  // Parallel chunked scanning
-  static void clear_parallel_claimed_index() { _parallel_claimed_idx = 0; }
-  static int parallel_claimed_index() { return _parallel_claimed_idx; }
-};
 #endif // SHARE_VM_CLASSFILE_STRINGTABLE_HPP
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -76,7 +76,7 @@
 #include "runtime/java.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/signature.hpp"
 #include "services/classLoadingService.hpp"
@@ -110,9 +110,6 @@
 
 bool        SystemDictionary::_has_checkPackageAccess     =  false;
 
-// lazily initialized klass variables
-InstanceKlass* volatile SystemDictionary::_abstract_ownable_synchronizer_klass = NULL;
-
 // Default ProtectionDomainCacheSize value
 
 const int defaultProtectionDomainCacheSize = 1009;
@@ -1897,22 +1894,6 @@
 }
 
 // ----------------------------------------------------------------------------
-// Lazily load klasses
-
-void SystemDictionary::load_abstract_ownable_synchronizer_klass(TRAPS) {
-  // if multiple threads calling this function, only one thread will load
-  // the class.  The other threads will find the loaded version once the
-  // class is loaded.
-  Klass* aos = _abstract_ownable_synchronizer_klass;
-  if (aos == NULL) {
-    Klass* k = resolve_or_fail(vmSymbols::java_util_concurrent_locks_AbstractOwnableSynchronizer(), true, CHECK);
-    // Force a fence to prevent any read before the write completes
-    OrderAccess::fence();
-    _abstract_ownable_synchronizer_klass = InstanceKlass::cast(k);
-  }
-}
-
-// ----------------------------------------------------------------------------
 // Initialization
 
 void SystemDictionary::initialize(TRAPS) {
--- a/src/hotspot/share/classfile/systemDictionary.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -199,6 +199,9 @@
   do_klass(StackFrameInfo_klass,                        java_lang_StackFrameInfo,                  Opt                 ) \
   do_klass(LiveStackFrameInfo_klass,                    java_lang_LiveStackFrameInfo,              Opt                 ) \
                                                                                                                          \
+  /* support for stack dump lock analysis */                                                                             \
+  do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer, Pre ) \
+                                                                                                                         \
   /* Preload boxing klasses */                                                                                           \
   do_klass(Boolean_klass,                               java_lang_Boolean,                         Pre                 ) \
   do_klass(Character_klass,                             java_lang_Character,                       Pre                 ) \
@@ -449,12 +452,6 @@
   }
   static BasicType box_klass_type(Klass* k);  // inverse of box_klass
 
-  // methods returning lazily loaded klasses
-  // The corresponding method to load the class must be called before calling them.
-  static InstanceKlass* abstract_ownable_synchronizer_klass() { return check_klass(_abstract_ownable_synchronizer_klass); }
-
-  static void load_abstract_ownable_synchronizer_klass(TRAPS);
-
 protected:
   // Returns the class loader data to be used when looking up/updating the
   // system dictionary.
@@ -729,9 +726,6 @@
   // Variables holding commonly used klasses (preloaded)
   static InstanceKlass* _well_known_klasses[];
 
-  // Lazily loaded klasses
-  static InstanceKlass* volatile _abstract_ownable_synchronizer_klass;
-
   // table of box klasses (int_klass, etc.)
   static InstanceKlass* _box_klasses[T_VOID+1];
 
--- a/src/hotspot/share/classfile/verifier.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/classfile/verifier.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -47,7 +47,7 @@
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/jniHandles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/safepointVerifiers.hpp"
 #include "runtime/thread.hpp"
--- a/src/hotspot/share/code/codeCache.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/codeCache.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -685,8 +685,15 @@
   assert_locked_or_safepoint(CodeCache_lock);
   CompiledMethodIterator iter;
   while(iter.next_alive()) {
-    iter.method()->do_unloading(is_alive, unloading_occurred);
+    iter.method()->do_unloading(is_alive);
   }
+
+  // Now that all the unloaded nmethods are known, cleanup caches
+  // before CLDG is purged.
+  // This is another code cache walk but it is moved from gc_epilogue.
+  // G1 does a parallel walk of the nmethods so cleans them up
+  // as it goes and doesn't call this.
+  do_unloading_nmethod_caches(unloading_occurred);
 }
 
 void CodeCache::blobs_do(CodeBlobClosure* f) {
@@ -720,8 +727,11 @@
     assert(cur->on_scavenge_root_list(), "else shouldn't be on this list");
 
     bool is_live = (!cur->is_zombie() && !cur->is_unloaded());
-    if (TraceScavenge) {
-      cur->print_on(tty, is_live ? "scavenge root" : "dead scavenge root"); tty->cr();
+    LogTarget(Trace, gc, nmethod) lt;
+    if (lt.is_enabled()) {
+      LogStream ls(lt);
+      CompileTask::print(&ls, cur,
+        is_live ? "scavenge root " : "dead scavenge root", /*short_form:*/ true);
     }
     if (is_live) {
       // Perform cur->oops_do(f), maybe just once per nmethod.
@@ -892,18 +902,26 @@
 #endif
 }
 
-void CodeCache::gc_prologue() {
+void CodeCache::gc_prologue() { }
+
+void CodeCache::gc_epilogue() {
+  prune_scavenge_root_nmethods();
 }
 
-void CodeCache::gc_epilogue() {
+
+void CodeCache::do_unloading_nmethod_caches(bool class_unloading_occurred) {
   assert_locked_or_safepoint(CodeCache_lock);
-  NOT_DEBUG(if (needs_cache_clean())) {
+  // Even if classes are not unloaded, there may have been some nmethods that are
+  // unloaded because oops in them are no longer reachable.
+  NOT_DEBUG(if (needs_cache_clean() || class_unloading_occurred)) {
     CompiledMethodIterator iter;
     while(iter.next_alive()) {
       CompiledMethod* cm = iter.method();
       assert(!cm->is_unloaded(), "Tautology");
-      DEBUG_ONLY(if (needs_cache_clean())) {
-        cm->cleanup_inline_caches();
+      DEBUG_ONLY(if (needs_cache_clean() || class_unloading_occurred)) {
+        // Clean up both unloaded klasses from nmethods and unloaded nmethods
+        // from inline caches.
+        cm->unload_nmethod_caches(/*parallel*/false, class_unloading_occurred);
       }
       DEBUG_ONLY(cm->verify());
       DEBUG_ONLY(cm->verify_oop_relocations());
@@ -911,8 +929,6 @@
   }
 
   set_needs_cache_clean(false);
-  prune_scavenge_root_nmethods();
-
   verify_icholder_relocations();
 }
 
--- a/src/hotspot/share/code/codeCache.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/codeCache.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -168,9 +168,10 @@
   static void gc_epilogue();
   static void gc_prologue();
   static void verify_oops();
-  // If "unloading_occurred" is true, then unloads (i.e., breaks root links
+  // If any oops are not marked this method unloads (i.e., breaks root links
   // to) any unmarked codeBlobs in the cache.  Sets "marked_for_unloading"
   // to "true" iff some code got unloaded.
+  // "unloading_occurred" controls whether metadata should be cleaned because of class unloading.
   static void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred);
   static void asserted_non_scavengable_nmethods_do(CodeBlobClosure* f = NULL) PRODUCT_RETURN;
 
@@ -223,8 +224,10 @@
 
   static bool needs_cache_clean()                     { return _needs_cache_clean; }
   static void set_needs_cache_clean(bool v)           { _needs_cache_clean = v;    }
+
   static void clear_inline_caches();                  // clear all inline caches
-  static void cleanup_inline_caches();
+  static void cleanup_inline_caches();                // clean unloaded/zombie nmethods from inline caches
+  static void do_unloading_nmethod_caches(bool class_unloading_occurred);  // clean all nmethod caches for unloading, including inline caches
 
   // Returns true if an own CodeHeap for the given CodeBlobType is available
   static bool heap_available(int code_blob_type);
--- a/src/hotspot/share/code/compiledIC.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/compiledIC.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -552,7 +552,8 @@
 
 // ----------------------------------------------------------------------------
 
-void CompiledStaticCall::set_to_clean() {
+void CompiledStaticCall::set_to_clean(bool in_use) {
+  // in_use is unused but needed to match template function in CompiledMethod
   assert (CompiledIC_lock->is_locked() || SafepointSynchronize::is_at_safepoint(), "mt unsafe call");
   // Reset call site
   MutexLockerEx pl(SafepointSynchronize::is_at_safepoint() ? NULL : Patching_lock, Mutex::_no_safepoint_check_flag);
--- a/src/hotspot/share/code/compiledIC.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/compiledIC.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -358,7 +358,7 @@
   virtual address destination() const = 0;
 
   // Clean static call (will force resolving on next use)
-  void set_to_clean();
+  void set_to_clean(bool in_use = true);
 
   // Set state. The entry must be the same, as computed by compute_entry.
   // Computation and setting is split up, since the actions are separate during
--- a/src/hotspot/share/code/compiledMethod.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/compiledMethod.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -28,6 +28,8 @@
 #include "code/scopeDesc.hpp"
 #include "code/codeCache.hpp"
 #include "interpreter/bytecode.inline.hpp"
+#include "logging/log.hpp"
+#include "logging/logTag.hpp"
 #include "memory/resourceArea.hpp"
 #include "oops/methodData.hpp"
 #include "oops/method.inline.hpp"
@@ -222,9 +224,7 @@
                        pd->return_oop());
 }
 
-void CompiledMethod::cleanup_inline_caches(bool clean_all/*=false*/) {
-  assert_locked_or_safepoint(CompiledIC_lock);
-
+address CompiledMethod::oops_reloc_begin() const {
   // If the method is not entrant or zombie then a JMP is plastered over the
   // first few bytes.  If an oop in the old code was there, that oop
   // should not get GC'd.  Skip the first few bytes of oops on
@@ -237,41 +237,7 @@
     // This shouldn't matter, since oops of non-entrant methods are never used.
     // In fact, why are we bothering to look at oops in a non-entrant method??
   }
-
-  // Find all calls in an nmethod and clear the ones that point to non-entrant,
-  // zombie and unloaded nmethods.
-  ResourceMark rm;
-  RelocIterator iter(this, low_boundary);
-  while(iter.next()) {
-    switch(iter.type()) {
-      case relocInfo::virtual_call_type:
-      case relocInfo::opt_virtual_call_type: {
-        CompiledIC *ic = CompiledIC_at(&iter);
-        // Ok, to lookup references to zombies here
-        CodeBlob *cb = CodeCache::find_blob_unsafe(ic->ic_destination());
-        if( cb != NULL && cb->is_compiled() ) {
-          CompiledMethod* nm = cb->as_compiled_method();
-          // Clean inline caches pointing to zombie, non-entrant and unloaded methods
-          if (clean_all || !nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(is_alive());
-        }
-        break;
-      }
-      case relocInfo::static_call_type: {
-          CompiledStaticCall *csc = compiledStaticCall_at(iter.reloc());
-          CodeBlob *cb = CodeCache::find_blob_unsafe(csc->destination());
-          if( cb != NULL && cb->is_compiled() ) {
-            CompiledMethod* cm = cb->as_compiled_method();
-            // Clean inline caches pointing to zombie, non-entrant and unloaded methods
-            if (clean_all || !cm->is_in_use() || (cm->method()->code() != cm)) {
-              csc->set_to_clean();
-            }
-          }
-        break;
-      }
-      default:
-        break;
-    }
-  }
+  return low_boundary;
 }
 
 int CompiledMethod::verify_icholder_relocations() {
@@ -437,17 +403,15 @@
   return OrderAccess::load_acquire(&_unloading_clock);
 }
 
-// Processing of oop references should have been sufficient to keep
-// all strong references alive.  Any weak references should have been
-// cleared as well.  Visit all the metadata and ensure that it's
-// really alive.
-void CompiledMethod::verify_metadata_loaders(address low_boundary) {
+
+// static_stub_Relocations may have dangling references to
+// nmethods so trim them out here.  Otherwise it looks like
+// compiled code is maintaining a link to dead metadata.
+void CompiledMethod::clean_ic_stubs() {
 #ifdef ASSERT
-    RelocIterator iter(this, low_boundary);
-    while (iter.next()) {
-    // static_stub_Relocations may have dangling references to
-    // Method*s so trim them out here.  Otherwise it looks like
-    // compiled code is maintaining a link to dead metadata.
+  address low_boundary = oops_reloc_begin();
+  RelocIterator iter(this, low_boundary);
+  while (iter.next()) {
     address static_call_addr = NULL;
     if (iter.type() == relocInfo::opt_virtual_call_type) {
       CompiledIC* cic = CompiledIC_at(&iter);
@@ -470,8 +434,6 @@
       }
     }
   }
-  // Check that the metadata embedded in the nmethod is alive
-  metadata_do(check_class);
 #endif
 }
 
@@ -479,67 +441,43 @@
 // GC to unload an nmethod if it contains otherwise unreachable
 // oops.
 
-void CompiledMethod::do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred) {
+void CompiledMethod::do_unloading(BoolObjectClosure* is_alive) {
   // Make sure the oop's ready to receive visitors
   assert(!is_zombie() && !is_unloaded(),
          "should not call follow on zombie or unloaded nmethod");
 
-  // If the method is not entrant then a JMP is plastered over the
-  // first few bytes.  If an oop in the old code was there, that oop
-  // should not get GC'd.  Skip the first few bytes of oops on
-  // not-entrant methods.
-  address low_boundary = verified_entry_point();
-  if (is_not_entrant()) {
-    low_boundary += NativeJump::instruction_size;
-    // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
-    // (See comment above.)
-  }
-
-  // Exception cache
-  clean_exception_cache();
+  address low_boundary = oops_reloc_begin();
 
-  // If class unloading occurred we first iterate over all inline caches and
-  // clear ICs where the cached oop is referring to an unloaded klass or method.
-  // The remaining live cached oops will be traversed in the relocInfo::oop_type
-  // iteration below.
-  if (unloading_occurred) {
-    RelocIterator iter(this, low_boundary);
-    while(iter.next()) {
-      if (iter.type() == relocInfo::virtual_call_type) {
-        CompiledIC *ic = CompiledIC_at(&iter);
-        clean_ic_if_metadata_is_dead(ic);
-      }
-    }
-  }
-
-  if (do_unloading_oops(low_boundary, is_alive, unloading_occurred)) {
+  if (do_unloading_oops(low_boundary, is_alive)) {
     return;
   }
 
 #if INCLUDE_JVMCI
-  if (do_unloading_jvmci(unloading_occurred)) {
+  if (do_unloading_jvmci()) {
     return;
   }
 #endif
 
-  // Ensure that all metadata is still alive
-  verify_metadata_loaders(low_boundary);
+  // Cleanup exception cache and inline caches happens
+  // after all the unloaded methods are found.
 }
 
+// Clean references to unloaded nmethods at addr from this one, which is not unloaded.
 template <class CompiledICorStaticCall>
-static bool clean_if_nmethod_is_unloaded(CompiledICorStaticCall *ic, address addr, CompiledMethod* from) {
+static bool clean_if_nmethod_is_unloaded(CompiledICorStaticCall *ic, address addr, CompiledMethod* from,
+                                         bool parallel, bool clean_all) {
   // Ok, to lookup references to zombies here
   CodeBlob *cb = CodeCache::find_blob_unsafe(addr);
   CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
   if (nm != NULL) {
-    if (nm->unloading_clock() != CompiledMethod::global_unloading_clock()) {
+    if (parallel && nm->unloading_clock() != CompiledMethod::global_unloading_clock()) {
       // The nmethod has not been processed yet.
       return true;
     }
 
     // Clean inline caches pointing to both zombie and not_entrant methods
-    if (!nm->is_in_use() || (nm->method()->code() != nm)) {
-      ic->set_to_clean();
+    if (clean_all || !nm->is_in_use() || (nm->method()->code() != nm)) {
+      ic->set_to_clean(from->is_alive());
       assert(ic->is_clean(), "nmethod " PTR_FORMAT "not clean %s", p2i(from), from->method()->name_and_sig_as_C_string());
     }
   }
@@ -547,12 +485,14 @@
   return false;
 }
 
-static bool clean_if_nmethod_is_unloaded(CompiledIC *ic, CompiledMethod* from) {
-  return clean_if_nmethod_is_unloaded(ic, ic->ic_destination(), from);
+static bool clean_if_nmethod_is_unloaded(CompiledIC *ic, CompiledMethod* from,
+                                         bool parallel, bool clean_all = false) {
+  return clean_if_nmethod_is_unloaded(ic, ic->ic_destination(), from, parallel, clean_all);
 }
 
-static bool clean_if_nmethod_is_unloaded(CompiledStaticCall *csc, CompiledMethod* from) {
-  return clean_if_nmethod_is_unloaded(csc, csc->destination(), from);
+static bool clean_if_nmethod_is_unloaded(CompiledStaticCall *csc, CompiledMethod* from,
+                                         bool parallel, bool clean_all = false) {
+  return clean_if_nmethod_is_unloaded(csc, csc->destination(), from, parallel, clean_all);
 }
 
 bool CompiledMethod::do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_occurred) {
@@ -562,47 +502,79 @@
   assert(!is_zombie() && !is_unloaded(),
          "should not call follow on zombie or unloaded nmethod");
 
-  // If the method is not entrant then a JMP is plastered over the
-  // first few bytes.  If an oop in the old code was there, that oop
-  // should not get GC'd.  Skip the first few bytes of oops on
-  // not-entrant methods.
-  address low_boundary = verified_entry_point();
-  if (is_not_entrant()) {
-    low_boundary += NativeJump::instruction_size;
-    // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
-    // (See comment above.)
+  address low_boundary = oops_reloc_begin();
+
+  if (do_unloading_oops(low_boundary, is_alive)) {
+    return false;
   }
 
-  // Exception cache
-  clean_exception_cache();
+#if INCLUDE_JVMCI
+  if (do_unloading_jvmci()) {
+    return false;
+  }
+#endif
+
+  return unload_nmethod_caches(/*parallel*/true, unloading_occurred);
+}
+
+// Cleans caches in nmethods that point to either classes that are unloaded
+// or nmethods that are unloaded.
+//
+// Can be called either in parallel by G1 currently or after all
+// nmethods are unloaded.  Return postponed=true in the parallel case for
+// inline caches found that point to nmethods that are not yet visited during
+// the do_unloading walk.
+bool CompiledMethod::unload_nmethod_caches(bool parallel, bool unloading_occurred) {
 
+  // Exception cache only needs to be called if unloading occurred
+  if (unloading_occurred) {
+    clean_exception_cache();
+  }
+
+  bool postponed = cleanup_inline_caches_impl(parallel, unloading_occurred, /*clean_all*/false);
+
+  // All static stubs need to be cleaned.
+  clean_ic_stubs();
+
+  // Check that the metadata embedded in the nmethod is alive
+  DEBUG_ONLY(metadata_do(check_class));
+
+  return postponed;
+}
+
+// Called to clean up after class unloading for live nmethods and from the sweeper
+// for all methods.
+bool CompiledMethod::cleanup_inline_caches_impl(bool parallel, bool unloading_occurred, bool clean_all) {
+  assert_locked_or_safepoint(CompiledIC_lock);
   bool postponed = false;
 
-  RelocIterator iter(this, low_boundary);
+  // Find all calls in an nmethod and clear the ones that point to non-entrant,
+  // zombie and unloaded nmethods.
+  RelocIterator iter(this, oops_reloc_begin());
   while(iter.next()) {
 
     switch (iter.type()) {
 
     case relocInfo::virtual_call_type:
       if (unloading_occurred) {
-        // If class unloading occurred we first iterate over all inline caches and
-        // clear ICs where the cached oop is referring to an unloaded klass or method.
+        // If class unloading occurred we first clear ICs where the cached metadata
+        // is referring to an unloaded klass or method.
         clean_ic_if_metadata_is_dead(CompiledIC_at(&iter));
       }
 
-      postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this);
+      postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, parallel, clean_all);
       break;
 
     case relocInfo::opt_virtual_call_type:
-      postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this);
+      postponed |= clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, parallel, clean_all);
       break;
 
     case relocInfo::static_call_type:
-      postponed |= clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), this);
+      postponed |= clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), this, parallel, clean_all);
       break;
 
     case relocInfo::oop_type:
-      // handled by do_unloading_oops below
+      // handled by do_unloading_oops already
       break;
 
     case relocInfo::metadata_type:
@@ -613,19 +585,6 @@
     }
   }
 
-  if (do_unloading_oops(low_boundary, is_alive, unloading_occurred)) {
-    return postponed;
-  }
-
-#if INCLUDE_JVMCI
-  if (do_unloading_jvmci(unloading_occurred)) {
-    return postponed;
-  }
-#endif
-
-  // Ensure that all metadata is still alive
-  verify_metadata_loaders(low_boundary);
-
   return postponed;
 }
 
@@ -636,32 +595,21 @@
   assert(!is_zombie(),
          "should not call follow on zombie nmethod");
 
-  // If the method is not entrant then a JMP is plastered over the
-  // first few bytes.  If an oop in the old code was there, that oop
-  // should not get GC'd.  Skip the first few bytes of oops on
-  // not-entrant methods.
-  address low_boundary = verified_entry_point();
-  if (is_not_entrant()) {
-    low_boundary += NativeJump::instruction_size;
-    // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
-    // (See comment above.)
-  }
-
-  RelocIterator iter(this, low_boundary);
+  RelocIterator iter(this, oops_reloc_begin());
   while(iter.next()) {
 
     switch (iter.type()) {
 
     case relocInfo::virtual_call_type:
-      clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this);
+      clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, true);
       break;
 
     case relocInfo::opt_virtual_call_type:
-      clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this);
+      clean_if_nmethod_is_unloaded(CompiledIC_at(&iter), this, true);
       break;
 
     case relocInfo::static_call_type:
-      clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), this);
+      clean_if_nmethod_is_unloaded(compiledStaticCall_at(iter.reloc()), this, true);
       break;
 
     default:
--- a/src/hotspot/share/code/compiledMethod.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/compiledMethod.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -331,8 +331,19 @@
 
   static address get_deopt_original_pc(const frame* fr);
 
-  // Inline cache support
-  void cleanup_inline_caches(bool clean_all = false);
+  // GC unloading support
+  // Cleans unloaded klasses and unloaded nmethods in inline caches
+  bool unload_nmethod_caches(bool parallel, bool class_unloading_occurred);
+
+  // Inline cache support for class unloading and nmethod unloading
+ private:
+  bool cleanup_inline_caches_impl(bool parallel, bool unloading_occurred, bool clean_all);
+ public:
+  bool cleanup_inline_caches(bool clean_all = false) {
+    // Serial version used by sweeper and whitebox test
+    return cleanup_inline_caches_impl(false, false, clean_all);
+  }
+
   virtual void clear_inline_caches();
   void clear_ic_stubs();
 
@@ -364,12 +375,15 @@
   void set_unloading_next(CompiledMethod* next) { _unloading_next = next; }
   CompiledMethod* unloading_next()              { return _unloading_next; }
 
+ protected:
+  address oops_reloc_begin() const;
+ private:
   void static clean_ic_if_metadata_is_dead(CompiledIC *ic);
 
-  // Check that all metadata is still alive
-  void verify_metadata_loaders(address low_boundary);
+  void clean_ic_stubs();
 
-  virtual void do_unloading(BoolObjectClosure* is_alive, bool unloading_occurred);
+ public:
+  virtual void do_unloading(BoolObjectClosure* is_alive);
   //  The parallel versions are used by G1.
   virtual bool do_unloading_parallel(BoolObjectClosure* is_alive, bool unloading_occurred);
   virtual void do_unloading_parallel_postponed();
@@ -381,9 +395,9 @@
   unsigned char unloading_clock();
 
 protected:
-  virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred) = 0;
+  virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive) = 0;
 #if INCLUDE_JVMCI
-  virtual bool do_unloading_jvmci(bool unloading_occurred) = 0;
+  virtual bool do_unloading_jvmci() = 0;
 #endif
 
 private:
--- a/src/hotspot/share/code/nmethod.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/nmethod.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -51,7 +51,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/jniHandles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/safepointVerifiers.hpp"
 #include "runtime/sharedRuntime.hpp"
@@ -946,21 +946,8 @@
 void nmethod::verify_clean_inline_caches() {
   assert_locked_or_safepoint(CompiledIC_lock);
 
-  // If the method is not entrant or zombie then a JMP is plastered over the
-  // first few bytes.  If an oop in the old code was there, that oop
-  // should not get GC'd.  Skip the first few bytes of oops on
-  // not-entrant methods.
-  address low_boundary = verified_entry_point();
-  if (!is_in_use()) {
-    low_boundary += NativeJump::instruction_size;
-    // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
-    // This means that the low_boundary is going to be a little too high.
-    // This shouldn't matter, since oops of non-entrant methods are never used.
-    // In fact, why are we bothering to look at oops in a non-entrant method??
-  }
-
   ResourceMark rm;
-  RelocIterator iter(this, low_boundary);
+  RelocIterator iter(this, oops_reloc_begin());
   while(iter.next()) {
     switch(iter.type()) {
       case relocInfo::virtual_call_type:
@@ -1041,13 +1028,17 @@
   flush_dependencies(/*delete_immediately*/false);
 
   // Break cycle between nmethod & method
-  LogTarget(Trace, class, unload) lt;
+  LogTarget(Trace, class, unload, nmethod) lt;
   if (lt.is_enabled()) {
     LogStream ls(lt);
-    ls.print_cr("making nmethod " INTPTR_FORMAT
-                  " unloadable, Method*(" INTPTR_FORMAT
-                  "), cause(" INTPTR_FORMAT ")",
-                  p2i(this), p2i(_method), p2i(cause));
+    ls.print("making nmethod " INTPTR_FORMAT
+             " unloadable, Method*(" INTPTR_FORMAT
+             "), cause(" INTPTR_FORMAT ") ",
+             p2i(this), p2i(_method), p2i(cause));
+     if (cause != NULL) {
+       cause->print_value_on(&ls);
+     }
+     ls.cr();
   }
   // Unlink the osr method, so we do not look this up again
   if (is_osr_method()) {
@@ -1378,17 +1369,15 @@
 
 
 // If this oop is not live, the nmethod can be unloaded.
-bool nmethod::can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_occurred) {
+bool nmethod::can_unload(BoolObjectClosure* is_alive, oop* root) {
   assert(root != NULL, "just checking");
   oop obj = *root;
   if (obj == NULL || is_alive->do_object_b(obj)) {
       return false;
   }
 
-  // If ScavengeRootsInCode is true, an nmethod might be unloaded
-  // simply because one of its constant oops has gone dead.
+  // An nmethod might be unloaded simply because one of its constant oops has gone dead.
   // No actual classes need to be unloaded in order for this to occur.
-  assert(unloading_occurred || ScavengeRootsInCode, "Inconsistency in unloading");
   make_unloaded(obj);
   return true;
 }
@@ -1466,7 +1455,7 @@
   set_unload_reported();
 }
 
-bool nmethod::unload_if_dead_at(RelocIterator* iter_at_oop, BoolObjectClosure *is_alive, bool unloading_occurred) {
+bool nmethod::unload_if_dead_at(RelocIterator* iter_at_oop, BoolObjectClosure *is_alive) {
   assert(iter_at_oop->type() == relocInfo::oop_type, "Wrong relocation type");
 
   oop_Relocation* r = iter_at_oop->oop_reloc();
@@ -1477,7 +1466,7 @@
          "oop must be found in exactly one place");
   if (r->oop_is_immediate() && r->oop_value() != NULL) {
     // Unload this nmethod if the oop is dead.
-    if (can_unload(is_alive, r->oop_addr(), unloading_occurred)) {
+    if (can_unload(is_alive, r->oop_addr())) {
       return true;;
     }
   }
@@ -1485,18 +1474,18 @@
   return false;
 }
 
-bool nmethod::do_unloading_scopes(BoolObjectClosure* is_alive, bool unloading_occurred) {
+bool nmethod::do_unloading_scopes(BoolObjectClosure* is_alive) {
   // Scopes
   for (oop* p = oops_begin(); p < oops_end(); p++) {
     if (*p == Universe::non_oop_word())  continue;  // skip non-oops
-    if (can_unload(is_alive, p, unloading_occurred)) {
+    if (can_unload(is_alive, p)) {
       return true;
     }
   }
   return false;
 }
 
-bool nmethod::do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred) {
+bool nmethod::do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive) {
   // Compiled code
 
   // Prevent extra code cache walk for platforms that don't have immediate oops.
@@ -1504,18 +1493,18 @@
     RelocIterator iter(this, low_boundary);
     while (iter.next()) {
       if (iter.type() == relocInfo::oop_type) {
-        if (unload_if_dead_at(&iter, is_alive, unloading_occurred)) {
+        if (unload_if_dead_at(&iter, is_alive)) {
           return true;
         }
       }
     }
   }
 
-  return do_unloading_scopes(is_alive, unloading_occurred);
+  return do_unloading_scopes(is_alive);
 }
 
 #if INCLUDE_JVMCI
-bool nmethod::do_unloading_jvmci(bool unloading_occurred) {
+bool nmethod::do_unloading_jvmci() {
   if (_jvmci_installed_code != NULL) {
     if (JNIHandles::is_global_weak_cleared(_jvmci_installed_code)) {
       if (_jvmci_installed_code_triggers_unloading) {
@@ -1533,15 +1522,9 @@
 
 // Iterate over metadata calling this function.   Used by RedefineClasses
 void nmethod::metadata_do(void f(Metadata*)) {
-  address low_boundary = verified_entry_point();
-  if (is_not_entrant()) {
-    low_boundary += NativeJump::instruction_size;
-    // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
-    // (See comment above.)
-  }
   {
     // Visit all immediate references that are embedded in the instruction stream.
-    RelocIterator iter(this, low_boundary);
+    RelocIterator iter(this, oops_reloc_begin());
     while (iter.next()) {
       if (iter.type() == relocInfo::metadata_type ) {
         metadata_Relocation* r = iter.metadata_reloc();
@@ -1588,20 +1571,9 @@
   assert(allow_zombie || !is_zombie(), "should not call follow on zombie nmethod");
   assert(!is_unloaded(), "should not call follow on unloaded nmethod");
 
-  // If the method is not entrant or zombie then a JMP is plastered over the
-  // first few bytes.  If an oop in the old code was there, that oop
-  // should not get GC'd.  Skip the first few bytes of oops on
-  // not-entrant methods.
-  address low_boundary = verified_entry_point();
-  if (is_not_entrant()) {
-    low_boundary += NativeJump::instruction_size;
-    // %%% Note:  On SPARC we patch only a 4-byte trap, not a full NativeJump.
-    // (See comment above.)
-  }
-
   // Prevent extra code cache walk for platforms that don't have immediate oops.
   if (relocInfo::mustIterateImmediateOopsInCode()) {
-    RelocIterator iter(this, low_boundary);
+    RelocIterator iter(this, oops_reloc_begin());
 
     while (iter.next()) {
       if (iter.type() == relocInfo::oop_type ) {
@@ -1650,7 +1622,11 @@
           break;
       }
       // Mark was clear when we first saw this guy.
-      if (TraceScavenge) { print_on(tty, "oops_do, mark"); }
+      LogTarget(Trace, gc, nmethod) lt;
+      if (lt.is_enabled()) {
+        LogStream ls(lt);
+        CompileTask::print(&ls, this, "oops_do, mark", /*short_form:*/ true);
+      }
       return false;
     }
   }
@@ -1659,7 +1635,7 @@
 }
 
 void nmethod::oops_do_marking_prologue() {
-  if (TraceScavenge) { tty->print_cr("[oops_do_marking_prologue"); }
+  log_trace(gc, nmethod)("oops_do_marking_prologue");
   assert(_oops_do_mark_nmethods == NULL, "must not call oops_do_marking_prologue twice in a row");
   // We use cmpxchg instead of regular assignment here because the user
   // may fork a bunch of threads, and we need them all to see the same state.
@@ -1675,20 +1651,26 @@
     nmethod* next = cur->_oops_do_mark_link;
     cur->_oops_do_mark_link = NULL;
     DEBUG_ONLY(cur->verify_oop_relocations());
-    NOT_PRODUCT(if (TraceScavenge)  cur->print_on(tty, "oops_do, unmark"));
+
+    LogTarget(Trace, gc, nmethod) lt;
+    if (lt.is_enabled()) {
+      LogStream ls(lt);
+      CompileTask::print(&ls, cur, "oops_do, unmark", /*short_form:*/ true);
+    }
     cur = next;
   }
   nmethod* required = _oops_do_mark_nmethods;
   nmethod* observed = Atomic::cmpxchg((nmethod*)NULL, &_oops_do_mark_nmethods, required);
   guarantee(observed == required, "no races in this sequential code");
-  if (TraceScavenge) { tty->print_cr("oops_do_marking_epilogue]"); }
+  log_trace(gc, nmethod)("oops_do_marking_epilogue");
 }
 
 class DetectScavengeRoot: public OopClosure {
   bool     _detected_scavenge_root;
+  nmethod* _print_nm;
 public:
-  DetectScavengeRoot() : _detected_scavenge_root(false)
-  { NOT_PRODUCT(_print_nm = NULL); }
+  DetectScavengeRoot(nmethod* nm) : _detected_scavenge_root(false), _print_nm(nm) {}
+
   bool detected_scavenge_root() { return _detected_scavenge_root; }
   virtual void do_oop(oop* p) {
     if ((*p) != NULL && Universe::heap()->is_scavengable(*p)) {
@@ -1699,21 +1681,25 @@
   virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); }
 
 #ifndef PRODUCT
-  nmethod* _print_nm;
   void maybe_print(oop* p) {
-    if (_print_nm == NULL)  return;
-    if (!_detected_scavenge_root)  _print_nm->print_on(tty, "new scavenge root");
-    tty->print_cr("" PTR_FORMAT "[offset=%d] detected scavengable oop " PTR_FORMAT " (found at " PTR_FORMAT ")",
-                  p2i(_print_nm), (int)((intptr_t)p - (intptr_t)_print_nm),
-                  p2i(*p), p2i(p));
-    (*p)->print();
+    LogTarget(Trace, gc, nmethod) lt;
+    if (lt.is_enabled()) {
+      LogStream ls(lt);
+      if (!_detected_scavenge_root) {
+        CompileTask::print(&ls, _print_nm, "new scavenge root", /*short_form:*/ true);
+      }
+      ls.print("" PTR_FORMAT "[offset=%d] detected scavengable oop " PTR_FORMAT " (found at " PTR_FORMAT ") ",
+               p2i(_print_nm), (int)((intptr_t)p - (intptr_t)_print_nm),
+               p2i(*p), p2i(p));
+      (*p)->print_value_on(&ls);
+      ls.cr();
+    }
   }
 #endif //PRODUCT
 };
 
 bool nmethod::detect_scavenge_root_oops() {
-  DetectScavengeRoot detect_scavenge_root;
-  NOT_PRODUCT(if (TraceScavenge)  detect_scavenge_root._print_nm = this);
+  DetectScavengeRoot detect_scavenge_root(this);
   oops_do(&detect_scavenge_root);
   return detect_scavenge_root.detected_scavenge_root();
 }
--- a/src/hotspot/share/code/nmethod.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/code/nmethod.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -484,18 +484,18 @@
 #endif
 
  protected:
-  virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive, bool unloading_occurred);
+  virtual bool do_unloading_oops(address low_boundary, BoolObjectClosure* is_alive);
 #if INCLUDE_JVMCI
   // See comment for _jvmci_installed_code_triggers_unloading field.
   // Returns whether this nmethod was unloaded.
-  virtual bool do_unloading_jvmci(bool unloading_occurred);
+  virtual bool do_unloading_jvmci();
 #endif
 
  private:
-  bool do_unloading_scopes(BoolObjectClosure* is_alive, bool unloading_occurred);
+  bool do_unloading_scopes(BoolObjectClosure* is_alive);
   //  Unload a nmethod if the *root object is dead.
-  bool can_unload(BoolObjectClosure* is_alive, oop* root, bool unloading_occurred);
-  bool unload_if_dead_at(RelocIterator *iter_at_oop, BoolObjectClosure* is_alive, bool unloading_occurred);
+  bool can_unload(BoolObjectClosure* is_alive, oop* root);
+  bool unload_if_dead_at(RelocIterator *iter_at_oop, BoolObjectClosure* is_alive);
 
  public:
   void oops_do(OopClosure* f) { oops_do(f, false); }
--- a/src/hotspot/share/gc/cms/adaptiveFreeList.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/adaptiveFreeList.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 #include "memory/freeList.inline.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/mutex.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/vmThread.hpp"
 
 template <>
--- a/src/hotspot/share/gc/cms/cmsCardTable.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/cmsCardTable.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -34,7 +34,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/vmThread.hpp"
 
 CMSCardTable::CMSCardTable(MemRegion whole_heap) :
--- a/src/hotspot/share/gc/cms/cmsHeap.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/cmsHeap.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -220,13 +220,14 @@
                                 ScanningOption so,
                                 bool only_strong_roots,
                                 OopsInGenClosure* root_closure,
-                                CLDClosure* cld_closure) {
+                                CLDClosure* cld_closure,
+                                OopStorage::ParState<false, false>* par_state_string) {
   MarkingCodeBlobClosure mark_code_closure(root_closure, !CodeBlobToOopClosure::FixRelocations);
   CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
 
   process_roots(scope, so, root_closure, cld_closure, weak_cld_closure, &mark_code_closure);
   if (!only_strong_roots) {
-    process_string_table_roots(scope, root_closure);
+    process_string_table_roots(scope, root_closure, par_state_string);
   }
 
   if (young_gen_as_roots &&
--- a/src/hotspot/share/gc/cms/cmsHeap.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/cmsHeap.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -30,6 +30,7 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/gcCause.hpp"
 #include "gc/shared/genCollectedHeap.hpp"
+#include "gc/shared/oopStorageParState.hpp"
 #include "utilities/growableArray.hpp"
 
 class CLDClosure;
@@ -90,7 +91,8 @@
                          ScanningOption so,
                          bool only_strong_roots,
                          OopsInGenClosure* root_closure,
-                         CLDClosure* cld_closure);
+                         CLDClosure* cld_closure,
+                         OopStorage::ParState<false, false>* par_state_string = NULL);
 
   GCMemoryManager* old_manager() const { return _old_manager; }
 
--- a/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -45,7 +45,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/java.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/align.hpp"
 #include "utilities/copy.hpp"
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -54,6 +54,7 @@
 #include "gc/shared/genCollectedHeap.hpp"
 #include "gc/shared/genOopClosures.inline.hpp"
 #include "gc/shared/isGCActiveMark.hpp"
+#include "gc/shared/oopStorageParState.hpp"
 #include "gc/shared/referencePolicy.hpp"
 #include "gc/shared/space.inline.hpp"
 #include "gc/shared/strongRootsScope.hpp"
@@ -74,7 +75,7 @@
 #include "runtime/globals_extension.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/java.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/timer.hpp"
 #include "runtime/vmThread.hpp"
 #include "services/memoryService.hpp"
@@ -2769,10 +2770,12 @@
  protected:
   CMSCollector*     _collector;
   uint              _n_workers;
+  OopStorage::ParState<false, false> _par_state_string;
   CMSParMarkTask(const char* name, CMSCollector* collector, uint n_workers) :
       AbstractGangTask(name),
       _collector(collector),
-      _n_workers(n_workers) {}
+      _n_workers(n_workers),
+      _par_state_string(StringTable::weak_storage()) {}
   // Work method in support of parallel rescan ... of young gen spaces
   void do_young_space_rescan(OopsInGenClosure* cl,
                              ContiguousSpace* space,
@@ -4274,7 +4277,9 @@
                           GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
                           _collector->should_unload_classes(),
                           &par_mri_cl,
-                          &cld_closure);
+                          &cld_closure,
+                          &_par_state_string);
+
   assert(_collector->should_unload_classes()
          || (_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");
@@ -4403,7 +4408,8 @@
                           GenCollectedHeap::ScanningOption(_collector->CMSCollector::roots_scanning_options()),
                           _collector->should_unload_classes(),
                           &par_mrias_cl,
-                          NULL);     // The dirty klasses will be handled below
+                          NULL,     // The dirty klasses will be handled below
+                          &_par_state_string);
 
   assert(_collector->should_unload_classes()
          || (_collector->CMSCollector::roots_scanning_options() & GenCollectedHeap::SO_AllCodeCache),
--- a/src/hotspot/share/gc/cms/parNewGeneration.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/parNewGeneration.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/stringTable.hpp"
 #include "gc/cms/cmsHeap.inline.hpp"
 #include "gc/cms/compactibleFreeListSpace.hpp"
 #include "gc/cms/concurrentMarkSweepGeneration.hpp"
@@ -589,7 +590,8 @@
     _young_gen(young_gen), _old_gen(old_gen),
     _young_old_boundary(young_old_boundary),
     _state_set(state_set),
-    _strong_roots_scope(strong_roots_scope)
+    _strong_roots_scope(strong_roots_scope),
+    _par_state_string(StringTable::weak_storage())
 {}
 
 void ParNewGenTask::work(uint worker_id) {
@@ -611,7 +613,8 @@
   heap->young_process_roots(_strong_roots_scope,
                            &par_scan_state.to_space_root_closure(),
                            &par_scan_state.older_gen_closure(),
-                           &cld_scan_closure);
+                           &cld_scan_closure,
+                           &_par_state_string);
 
   par_scan_state.end_strong_roots();
 
--- a/src/hotspot/share/gc/cms/parNewGeneration.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/cms/parNewGeneration.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -29,6 +29,7 @@
 #include "gc/serial/defNewGeneration.hpp"
 #include "gc/shared/copyFailedInfo.hpp"
 #include "gc/shared/gcTrace.hpp"
+#include "gc/shared/oopStorageParState.hpp"
 #include "gc/shared/plab.hpp"
 #include "gc/shared/preservedMarks.hpp"
 #include "gc/shared/taskqueue.hpp"
@@ -236,6 +237,7 @@
   HeapWord*                    _young_old_boundary;
   class ParScanThreadStateSet* _state_set;
   StrongRootsScope*            _strong_roots_scope;
+  OopStorage::ParState<false, false> _par_state_string;
 
 public:
   ParNewGenTask(ParNewGeneration*      young_gen,
--- a/src/hotspot/share/gc/g1/collectionSetChooser.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/collectionSetChooser.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -147,7 +147,7 @@
 void CollectionSetChooser::add_region(HeapRegion* hr) {
   assert(!hr->is_pinned(),
          "Pinned region shouldn't be added to the collection set (index %u)", hr->hrm_index());
-  assert(!hr->is_young(), "should not be young!");
+  assert(hr->is_old(), "should be old but is %s", hr->get_type_str());
   assert(hr->rem_set()->is_complete(),
          "Trying to add region %u to the collection set with incomplete remembered set", hr->hrm_index());
   _regions.append(hr);
@@ -185,7 +185,7 @@
 
 void CollectionSetChooser::set_region(uint index, HeapRegion* hr) {
   assert(regions_at(index) == NULL, "precondition");
-  assert(!hr->is_young(), "should not be young!");
+  assert(hr->is_old(), "should be old but is %s", hr->get_type_str());
   regions_at_put(index, hr);
   hr->calc_gc_efficiency();
 }
@@ -233,18 +233,19 @@
     _cset_updater(hrSorted, true /* parallel */, chunk_size) { }
 
   bool do_heap_region(HeapRegion* r) {
-    // Do we have any marking information for this region?
-    if (r->is_marked()) {
-      // We will skip any region that's currently used as an old GC
-      // alloc region (we should not consider those for collection
-      // before we fill them up).
-      if (_cset_updater.should_add(r) && !_g1h->is_old_gc_alloc_region(r)) {
-        _cset_updater.add_region(r);
-      } else if (r->is_old()) {
-        // Can clean out the remembered sets of all regions that we did not choose but
-        // we created the remembered set for.
-        r->rem_set()->clear(true);
-      }
+    // We will skip any region that's currently used as an old GC
+    // alloc region (we should not consider those for collection
+    // before we fill them up).
+    if (_cset_updater.should_add(r) && !_g1h->is_old_gc_alloc_region(r)) {
+      _cset_updater.add_region(r);
+    } else if (r->is_old()) {
+      // Keep remembered sets for humongous regions, otherwise clean out remembered
+      // sets for old regions.
+      r->rem_set()->clear(true /* only_cardset */);
+    } else {
+      assert(!r->is_old() || !r->rem_set()->is_tracked(),
+             "Missed to clear unused remembered set of region %u (%s) that is %s",
+             r->hrm_index(), r->get_type_str(), r->rem_set()->get_state_str());
     }
     return false;
   }
@@ -280,11 +281,10 @@
 }
 
 bool CollectionSetChooser::should_add(HeapRegion* hr) const {
-  assert(hr->is_marked(), "pre-condition");
-  assert(!hr->is_young(), "should never consider young regions");
-  return !hr->is_pinned() &&
-          region_occupancy_low_enough_for_evac(hr->live_bytes()) &&
-          hr->rem_set()->is_complete();
+  return !hr->is_young() &&
+         !hr->is_pinned() &&
+         region_occupancy_low_enough_for_evac(hr->live_bytes()) &&
+         hr->rem_set()->is_complete();
 }
 
 void CollectionSetChooser::rebuild(WorkGang* workers, uint n_regions) {
--- a/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1AllocRegion.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 #include "logging/log.hpp"
 #include "logging/logStream.hpp"
 #include "memory/resourceArea.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/align.hpp"
 
 G1CollectedHeap* G1AllocRegion::_g1h = NULL;
--- a/src/hotspot/share/gc/g1/g1CardTable.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1CardTable.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -28,7 +28,7 @@
 #include "gc/shared/memset_with_concurrent_readers.hpp"
 #include "logging/log.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 bool G1CardTable::mark_card_deferred(size_t card_index) {
   jbyte val = _byte_map[card_index];
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -69,6 +69,7 @@
 #include "gc/shared/gcTraceTime.inline.hpp"
 #include "gc/shared/generationSpec.hpp"
 #include "gc/shared/isGCActiveMark.hpp"
+#include "gc/shared/oopStorageParState.hpp"
 #include "gc/shared/preservedMarks.inline.hpp"
 #include "gc/shared/suspendibleThreadSet.hpp"
 #include "gc/shared/referenceProcessor.inline.hpp"
@@ -86,7 +87,7 @@
 #include "runtime/flags/flagSetting.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/threadSMR.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/align.hpp"
@@ -3218,6 +3219,7 @@
 private:
   BoolObjectClosure* _is_alive;
   G1StringDedupUnlinkOrOopsDoClosure _dedup_closure;
+  OopStorage::ParState<false /* concurrent */, false /* const */> _par_state_string;
 
   int _initial_string_table_size;
   int _initial_symbol_table_size;
@@ -3237,24 +3239,19 @@
     AbstractGangTask("String/Symbol Unlinking"),
     _is_alive(is_alive),
     _dedup_closure(is_alive, NULL, false),
+    _par_state_string(StringTable::weak_storage()),
     _process_strings(process_strings), _strings_processed(0), _strings_removed(0),
     _process_symbols(process_symbols), _symbols_processed(0), _symbols_removed(0),
     _process_string_dedup(process_string_dedup) {
 
-    _initial_string_table_size = StringTable::the_table()->table_size();
+    _initial_string_table_size = (int) StringTable::the_table()->table_size();
     _initial_symbol_table_size = SymbolTable::the_table()->table_size();
-    if (process_strings) {
-      StringTable::clear_parallel_claimed_index();
-    }
     if (process_symbols) {
       SymbolTable::clear_parallel_claimed_index();
     }
   }
 
   ~G1StringAndSymbolCleaningTask() {
-    guarantee(!_process_strings || StringTable::parallel_claimed_index() >= _initial_string_table_size,
-              "claim value %d after unlink less than initial string table size %d",
-              StringTable::parallel_claimed_index(), _initial_string_table_size);
     guarantee(!_process_symbols || SymbolTable::parallel_claimed_index() >= _initial_symbol_table_size,
               "claim value %d after unlink less than initial symbol table size %d",
               SymbolTable::parallel_claimed_index(), _initial_symbol_table_size);
@@ -3273,7 +3270,7 @@
     int symbols_processed = 0;
     int symbols_removed = 0;
     if (_process_strings) {
-      StringTable::possibly_parallel_unlink(_is_alive, &strings_processed, &strings_removed);
+      StringTable::possibly_parallel_unlink(&_par_state_string, _is_alive, &strings_processed, &strings_removed);
       Atomic::add(strings_processed, &_strings_processed);
       Atomic::add(strings_removed, &_strings_removed);
     }
@@ -3355,7 +3352,7 @@
       add_to_postponed_list(nm);
     }
 
-    // Mark that this thread has been cleaned/unloaded.
+    // Mark that this nmethod has been cleaned/unloaded.
     // After this call, it will be safe to ask if this nmethod was unloaded or not.
     nm->set_unloading_clock(CompiledMethod::global_unloading_clock());
   }
--- a/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1CollectedHeap.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -32,7 +32,7 @@
 #include "gc/g1/heapRegionManager.inline.hpp"
 #include "gc/g1/heapRegionSet.inline.hpp"
 #include "gc/shared/taskqueue.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 G1EvacStats* G1CollectedHeap::alloc_buffer_stats(InCSetState dest) {
   switch (dest.value()) {
--- a/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1ConcurrentMark.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1651,7 +1651,11 @@
   }
 
   if (has_overflown()) {
-    // We can not trust g1_is_alive if the marking stack overflowed
+    // We can not trust g1_is_alive and the contents of the heap if the marking stack
+    // overflowed while processing references. Exit the VM.
+    fatal("Overflow during reference processing, can not continue. Please "
+          "increase MarkStackSizeMax (current value: " SIZE_FORMAT ") and "
+          "restart.", MarkStackSizeMax);
     return;
   }
 
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -468,15 +468,24 @@
   _pss(pss),
   _start(Ticks::now()),
   _total_time(total_time),
-  _trim_time(trim_time) {
+  _trim_time(trim_time),
+  _stopped(false) {
 
   assert(_pss->trim_ticks().value() == 0, "Possibly remaining trim ticks left over from previous use");
 }
 
 G1EvacPhaseWithTrimTimeTracker::~G1EvacPhaseWithTrimTimeTracker() {
+  if (!_stopped) {
+    stop();
+  }
+}
+
+void G1EvacPhaseWithTrimTimeTracker::stop() {
+  assert(!_stopped, "Should only be called once");
   _total_time += (Ticks::now() - _start) - _pss->trim_ticks();
   _trim_time += _pss->trim_ticks();
   _pss->reset_trim_ticks();
+  _stopped = true;
 }
 
 G1GCParPhaseTimesTracker::G1GCParPhaseTimesTracker(G1GCPhaseTimes* phase_times, G1GCPhaseTimes::GCParPhases phase, uint worker_id) :
@@ -504,6 +513,8 @@
 
 G1EvacPhaseTimesTracker::~G1EvacPhaseTimesTracker() {
   if (_phase_times != NULL) {
+    // Explicitly stop the trim tracker since it's not yet destructed.
+    _trim_tracker.stop();
     // Exclude trim time by increasing the start time.
     _start_time += _trim_time;
     _phase_times->record_or_add_objcopy_time_secs(_worker_id, _trim_time.seconds());
--- a/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1GCPhaseTimes.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -373,9 +373,13 @@
 
   Tickspan& _total_time;
   Tickspan& _trim_time;
+
+  bool _stopped;
 public:
   G1EvacPhaseWithTrimTimeTracker(G1ParScanThreadState* pss, Tickspan& total_time, Tickspan& trim_time);
   ~G1EvacPhaseWithTrimTimeTracker();
+
+  void stop();
 };
 
 class G1GCParPhaseTimesTracker : public CHeapObj<mtGC> {
--- a/src/hotspot/share/gc/g1/g1Policy.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1Policy.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -825,10 +825,10 @@
 
 size_t G1Policy::predict_bytes_to_copy(HeapRegion* hr) const {
   size_t bytes_to_copy;
-  if (hr->is_marked())
+  if (!hr->is_young()) {
     bytes_to_copy = hr->max_live_bytes();
-  else {
-    assert(hr->is_young() && hr->age_in_surv_rate_group() != -1, "invariant");
+  } else {
+    assert(hr->age_in_surv_rate_group() != -1, "invariant");
     int age = hr->age_in_surv_rate_group();
     double yg_surv_rate = predict_yg_surv_rate(age, hr->surv_rate_group());
     bytes_to_copy = (size_t) (hr->used() * yg_surv_rate);
--- a/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -38,6 +38,7 @@
 #include "gc/g1/g1RootClosures.hpp"
 #include "gc/g1/g1RootProcessor.hpp"
 #include "gc/g1/heapRegion.inline.hpp"
+#include "gc/shared/oopStorageParState.hpp"
 #include "gc/shared/referenceProcessor.hpp"
 #include "gc/shared/weakProcessor.hpp"
 #include "memory/allocation.inline.hpp"
@@ -72,6 +73,7 @@
     _process_strong_tasks(G1RP_PS_NumElements),
     _srs(n_workers),
     _lock(Mutex::leaf, "G1 Root Scanning barrier lock", false, Monitor::_safepoint_check_never),
+    _par_state_string(StringTable::weak_storage()),
     _n_workers_discovered_strong_classes(0) {}
 
 void G1RootProcessor::evacuate_roots(G1ParScanThreadState* pss, uint worker_i) {
@@ -301,7 +303,7 @@
   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.
-  StringTable::possibly_parallel_oops_do(closures->weak_oops());
+  StringTable::possibly_parallel_oops_do(&_par_state_string, closures->weak_oops());
 }
 
 void G1RootProcessor::process_code_cache_roots(CodeBlobClosure* code_closure,
--- a/src/hotspot/share/gc/g1/g1RootProcessor.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1RootProcessor.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,6 +25,7 @@
 #ifndef SHARE_VM_GC_G1_G1ROOTPROCESSOR_HPP
 #define SHARE_VM_GC_G1_G1ROOTPROCESSOR_HPP
 
+#include "gc/shared/oopStorageParState.hpp"
 #include "gc/shared/strongRootsScope.hpp"
 #include "memory/allocation.hpp"
 #include "runtime/mutex.hpp"
@@ -49,6 +50,7 @@
   G1CollectedHeap* _g1h;
   SubTasksDone _process_strong_tasks;
   StrongRootsScope _srs;
+  OopStorage::ParState<false, false> _par_state_string;
 
   // Used to implement the Thread work barrier.
   Monitor _lock;
--- a/src/hotspot/share/gc/g1/g1_globals.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1_globals.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -108,9 +108,6 @@
           "When expanding, % of uncommitted space to claim.")               \
           range(0, 100)                                                     \
                                                                             \
-  develop(bool, G1RSBarrierRegionFilter, true,                              \
-          "If true, generate region filtering code in RS barrier")          \
-                                                                            \
   product(size_t, G1UpdateBufferSize, 256,                                  \
           "Size of an update buffer")                                       \
           range(1, NOT_LP64(32*M) LP64_ONLY(1*G))                           \
--- a/src/hotspot/share/gc/g1/heapRegion.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/heapRegion.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -43,7 +43,7 @@
 #include "oops/compressedOops.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/growableArray.hpp"
 
 int    HeapRegion::LogOfHRGrainBytes = 0;
--- a/src/hotspot/share/gc/g1/heapRegion.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/g1/heapRegion.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -541,10 +541,6 @@
   // objects during evac failure handling.
   void note_self_forwarding_removal_end(size_t marked_bytes);
 
-  // Returns "false" iff no object in the region was allocated when the
-  // last mark phase ended.
-  bool is_marked() { return _prev_top_at_mark_start != bottom(); }
-
   void reset_during_compaction() {
     assert(is_humongous(),
            "should only be called for humongous regions");
--- a/src/hotspot/share/gc/parallel/gcTaskManager.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/parallel/gcTaskManager.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,7 @@
 #include "memory/resourceArea.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 
 //
--- a/src/hotspot/share/gc/shared/cardTableBarrierSet.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/cardTableBarrierSet.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 
 #include "gc/shared/cardTableBarrierSet.hpp"
 #include "gc/shared/cardTable.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 template <DecoratorSet decorators, typename T>
 inline void CardTableBarrierSet::write_ref_field_post(T* field, oop newVal) {
--- a/src/hotspot/share/gc/shared/collectedHeap.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -373,7 +373,8 @@
       return result;
     }
   }
-  return Universe::heap()->mem_allocate(size, gc_overhead_limit_was_exceeded);
+
+  return allocate_outside_tlab(klass, size, gc_overhead_limit_was_exceeded, THREAD);
 }
 
 HeapWord* CollectedHeap::allocate_from_tlab_slow(Klass* klass, size_t size, TRAPS) {
--- a/src/hotspot/share/gc/shared/collectedHeap.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -144,6 +144,9 @@
   inline static HeapWord* allocate_from_tlab(Klass* klass, size_t size, TRAPS);
   static HeapWord* allocate_from_tlab_slow(Klass* klass, size_t size, TRAPS);
 
+  inline static HeapWord* allocate_outside_tlab(Klass* klass, size_t size,
+                                                bool* gc_overhead_limit_was_exceeded, TRAPS);
+
   // Raw memory allocation facilities
   // The obj and array allocate methods are covers for these methods.
   // mem_allocate() should never be
--- a/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/collectedHeap.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -142,14 +142,6 @@
   HeapWord* result = heap->obj_allocate_raw(klass, size, &gc_overhead_limit_was_exceeded, THREAD);
 
   if (result != NULL) {
-    NOT_PRODUCT(Universe::heap()->
-      check_for_non_bad_heap_word_value(result, size));
-    assert(!HAS_PENDING_EXCEPTION,
-           "Unexpected exception, will result in uninitialized storage");
-    THREAD->incr_allocated_bytes(size * HeapWordSize);
-
-    AllocTracer::send_allocation_outside_tlab(klass, result, size * HeapWordSize, THREAD);
-
     return result;
   }
 
@@ -198,6 +190,22 @@
   return obj;
 }
 
+HeapWord* CollectedHeap::allocate_outside_tlab(Klass* klass, size_t size,
+                                               bool* gc_overhead_limit_was_exceeded, TRAPS) {
+  HeapWord* result = Universe::heap()->mem_allocate(size, gc_overhead_limit_was_exceeded);
+  if (result == NULL) {
+    return result;
+  }
+
+  NOT_PRODUCT(Universe::heap()->check_for_non_bad_heap_word_value(result, size));
+  assert(!HAS_PENDING_EXCEPTION,
+         "Unexpected exception, will result in uninitialized storage");
+  THREAD->incr_allocated_bytes(size * HeapWordSize);
+
+  AllocTracer::send_allocation_outside_tlab(klass, result, size * HeapWordSize, THREAD);
+  return result;
+}
+
 void CollectedHeap::init_obj(HeapWord* obj, size_t size) {
   assert(obj != NULL, "cannot initialize NULL object");
   const size_t hs = oopDesc::header_size();
--- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -44,6 +44,7 @@
 #include "gc/shared/genCollectedHeap.hpp"
 #include "gc/shared/genOopClosures.inline.hpp"
 #include "gc/shared/generationSpec.hpp"
+#include "gc/shared/oopStorageParState.inline.hpp"
 #include "gc/shared/space.hpp"
 #include "gc/shared/strongRootsScope.hpp"
 #include "gc/shared/vmGCOperations.hpp"
@@ -851,12 +852,17 @@
 }
 
 void GenCollectedHeap::process_string_table_roots(StrongRootsScope* scope,
-                                                  OopClosure* root_closure) {
+                                                  OopClosure* root_closure,
+                                                  OopStorage::ParState<false, false>* par_state_string) {
   assert(root_closure != NULL, "Must be set");
   // All threads execute the following. A specific chunk of buckets
   // from the StringTable are the individual tasks.
+
+  // Either we should be single threaded or have a ParState
+  assert((scope->n_threads() <= 1) || par_state_string != NULL, "Parallel but no ParState");
+
   if (scope->n_threads() > 1) {
-    StringTable::possibly_parallel_oops_do(root_closure);
+    StringTable::possibly_parallel_oops_do(par_state_string, root_closure);
   } else {
     StringTable::oops_do(root_closure);
   }
@@ -865,12 +871,13 @@
 void GenCollectedHeap::young_process_roots(StrongRootsScope* scope,
                                            OopsInGenClosure* root_closure,
                                            OopsInGenClosure* old_gen_closure,
-                                           CLDClosure* cld_closure) {
+                                           CLDClosure* cld_closure,
+                                           OopStorage::ParState<false, false>* par_state_string) {
   MarkingCodeBlobClosure mark_code_closure(root_closure, CodeBlobToOopClosure::FixRelocations);
 
   process_roots(scope, SO_ScavengeCodeCache, root_closure,
                 cld_closure, cld_closure, &mark_code_closure);
-  process_string_table_roots(scope, root_closure);
+  process_string_table_roots(scope, root_closure, par_state_string);
 
   if (!_process_strong_tasks->is_task_claimed(GCH_PS_younger_gens)) {
     root_closure->reset_generation();
@@ -890,7 +897,8 @@
                                           ScanningOption so,
                                           bool only_strong_roots,
                                           OopsInGenClosure* root_closure,
-                                          CLDClosure* cld_closure) {
+                                          CLDClosure* cld_closure,
+                                          OopStorage::ParState<false, false>* par_state_string) {
   MarkingCodeBlobClosure mark_code_closure(root_closure, is_adjust_phase);
   CLDClosure* weak_cld_closure = only_strong_roots ? NULL : cld_closure;
 
@@ -899,7 +907,7 @@
     // We never treat the string table as roots during marking
     // for the full gc, so we only need to process it during
     // the adjust phase.
-    process_string_table_roots(scope, root_closure);
+    process_string_table_roots(scope, root_closure, par_state_string);
   }
 
   _process_strong_tasks->all_tasks_completed(scope->n_threads());
--- a/src/hotspot/share/gc/shared/genCollectedHeap.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/genCollectedHeap.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -28,6 +28,7 @@
 #include "gc/shared/collectedHeap.hpp"
 #include "gc/shared/collectorPolicy.hpp"
 #include "gc/shared/generation.hpp"
+#include "gc/shared/oopStorageParState.hpp"
 #include "gc/shared/softRefGenPolicy.hpp"
 
 class AdaptiveSizePolicy;
@@ -401,7 +402,8 @@
                      CodeBlobToOopClosure* code_roots);
 
   void process_string_table_roots(StrongRootsScope* scope,
-                                  OopClosure* root_closure);
+                                  OopClosure* root_closure,
+                                  OopStorage::ParState<false, false>* par_state_string);
 
   // Accessor for memory state verification support
   NOT_PRODUCT(
@@ -415,14 +417,16 @@
   void young_process_roots(StrongRootsScope* scope,
                            OopsInGenClosure* root_closure,
                            OopsInGenClosure* old_gen_closure,
-                           CLDClosure* cld_closure);
+                           CLDClosure* cld_closure,
+                           OopStorage::ParState<false, false>* par_state_string = NULL);
 
   void full_process_roots(StrongRootsScope* scope,
                           bool is_adjust_phase,
                           ScanningOption so,
                           bool only_strong_roots,
                           OopsInGenClosure* root_closure,
-                          CLDClosure* cld_closure);
+                          CLDClosure* cld_closure,
+                          OopStorage::ParState<false, false>* par_state_string = NULL);
 
   // Apply "root_closure" to all the weak roots of the system.
   // These include JNI weak roots, string table,
--- a/src/hotspot/share/gc/shared/oopStorage.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/oopStorage.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -33,7 +33,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/thread.hpp"
--- a/src/hotspot/share/gc/shared/space.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/space.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -36,7 +36,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/java.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "runtime/safepoint.hpp"
 #include "utilities/align.hpp"
--- a/src/hotspot/share/gc/shared/strongRootsScope.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/strongRootsScope.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -38,8 +38,6 @@
 
 StrongRootsScope::StrongRootsScope(uint n_threads) : _n_threads(n_threads) {
   Threads::change_thread_claim_parity();
-  // Zero the claimed high water mark in the StringTable
-  StringTable::clear_parallel_claimed_index();
 }
 
 StrongRootsScope::~StrongRootsScope() {
--- a/src/hotspot/share/gc/shared/taskqueue.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/gc/shared/taskqueue.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 #include "memory/allocation.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/stack.inline.hpp"
 
--- a/src/hotspot/share/interpreter/bytecodeInterpreter.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/interpreter/bytecodeInterpreter.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -49,7 +49,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/threadCritical.hpp"
 #include "utilities/exceptions.hpp"
--- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -32,7 +32,7 @@
 #include "memory/iterator.hpp"
 #include "oops/oop.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/ostream.hpp"
--- a/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -38,7 +38,7 @@
 #include "logging/log.hpp"
 #include "memory/resourceArea.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/safepoint.hpp"
 
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceId.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -33,7 +33,7 @@
 #include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/vm_version.hpp"
 #include "runtime/jniHandles.inline.hpp"
 #include "runtime/thread.inline.hpp"
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdBits.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 
 #include "jfr/utilities/jfrTypes.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/macros.hpp"
 
 #ifdef VM_LITTLE_ENDIAN
--- a/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "jfr/recorder/checkpoint/types/traceid/jfrTraceIdEpoch.hpp"
 #include "runtime/safepoint.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 // Alternating epochs on each rotation allow for concurrent tagging.
 // The regular epoch shift happens only during a safepoint.
--- a/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/service/jfrPostBox.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #include "jfr/recorder/service/jfrPostBox.hpp"
 #include "jfr/utilities/jfrTryLock.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.inline.hpp"
 
 #define MSG_IS_SYNCHRONOUS ( (MSGBIT(MSG_ROTATE)) |          \
--- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -46,7 +46,7 @@
 #include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
--- a/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/storage/jfrBuffer.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "jfr/recorder/storage/jfrBuffer.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.inline.hpp"
 
 static const u1* const MUTEX_CLAIM = NULL;
--- a/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/storage/jfrStorage.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -38,7 +38,7 @@
 #include "jfr/writers/jfrNativeEventWriter.hpp"
 #include "logging/log.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.hpp"
--- a/src/hotspot/share/jfr/recorder/storage/jfrStorageControl.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/storage/jfrStorageControl.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #include "jfr/recorder/storage/jfrStorageControl.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 // returns the updated value
 static jlong atomic_add(size_t value, size_t volatile* const dest) {
--- a/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/storage/jfrVirtualMemory.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "jfr/recorder/storage/jfrVirtualMemory.hpp"
 #include "memory/virtualspace.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/globalDefinitions.hpp"
--- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPool.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -35,7 +35,7 @@
 #include "logging/log.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/thread.inline.hpp"
 
--- a/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolBuffer.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/recorder/stringpool/jfrStringPoolBuffer.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,7 +25,7 @@
 #include "precompiled.hpp"
 #include "jfr/recorder/stringpool/jfrStringPoolBuffer.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.inline.hpp"
 
 JfrStringPoolBuffer::JfrStringPoolBuffer() : JfrBuffer(), _string_count_pos(0), _string_count_top(0) {}
--- a/src/hotspot/share/jfr/utilities/jfrAllocation.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/utilities/jfrAllocation.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -28,7 +28,7 @@
 #include "logging/log.hpp"
 #include "memory/allocation.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/vm_version.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
--- a/src/hotspot/share/jfr/utilities/jfrHashtable.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/jfr/utilities/jfrHashtable.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #define SHARE_VM_JFR_UTILITIES_JFRHASHTABLE_HPP
 
 #include "memory/allocation.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/macros.hpp"
 
--- a/src/hotspot/share/logging/logOutputList.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/logging/logOutputList.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #include "logging/logOutputList.hpp"
 #include "memory/allocation.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/globalDefinitions.hpp"
 
 jint LogOutputList::increase_readers() {
--- a/src/hotspot/share/memory/metaspace.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/memory/metaspace.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -40,7 +40,7 @@
 #include "memory/metaspaceTracer.hpp"
 #include "memory/universe.hpp"
 #include "runtime/init.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
--- a/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/memory/metaspace/virtualSpaceList.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -15,7 +15,7 @@
 #include "memory/metaspace/metaspaceCommon.hpp"
 #include "memory/metaspace/virtualSpaceList.hpp"
 #include "memory/metaspace/virtualSpaceNode.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/safepoint.hpp"
 
--- a/src/hotspot/share/memory/metaspaceShared.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/memory/metaspaceShared.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1841,7 +1841,7 @@
   G1CollectedHeap::heap()->begin_archive_alloc_range();
 
   // Archive interned string objects
-  StringTable::write_to_archive(closed_archive);
+  StringTable::write_to_archive();
 
   G1CollectedHeap::heap()->end_archive_alloc_range(closed_archive,
                                                    os::vm_allocation_granularity());
--- a/src/hotspot/share/oops/accessBackend.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/accessBackend.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -247,14 +247,14 @@
 }
 
 class RawAccessBarrierArrayCopy: public AllStatic {
+  template<typename T> struct IsHeapWordSized: public IntegralConstant<bool, sizeof(T) == HeapWordSize> { };
 public:
   template <DecoratorSet decorators, typename T>
   static inline typename EnableIf<
-  HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value>::type
+    HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value>::type
   arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
             arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
             size_t length) {
-
     src_raw = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
     dst_raw = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
 
@@ -270,48 +270,68 @@
 
   template <DecoratorSet decorators, typename T>
   static inline typename EnableIf<
-    !HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value>::type
-  arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, const T* src_raw, arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw, size_t length) {
+    !HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value &&
+    HasDecorator<decorators, ARRAYCOPY_ARRAYOF>::value>::type
+  arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
+            arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
+            size_t length) {
+    src_raw = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
+    dst_raw = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
 
+    AccessInternal::arraycopy_arrayof_conjoint(src_raw, dst_raw, length);
+  }
+
+  template <DecoratorSet decorators, typename T>
+  static inline typename EnableIf<
+    !HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value &&
+    HasDecorator<decorators, ARRAYCOPY_DISJOINT>::value && IsHeapWordSized<T>::value>::type
+  arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
+            arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
+            size_t length) {
     src_raw = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
     dst_raw = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
 
-    if (HasDecorator<decorators, ARRAYCOPY_ARRAYOF>::value) {
-      AccessInternal::arraycopy_arrayof_conjoint(const_cast<T*>(src_raw), dst_raw, length);
-    } else if (HasDecorator<decorators, ARRAYCOPY_DISJOINT>::value && sizeof(T) == HeapWordSize) {
-      // There is only a disjoint optimization for word granularity copying
-      if (HasDecorator<decorators, ARRAYCOPY_ATOMIC>::value) {
-        AccessInternal::arraycopy_disjoint_words_atomic(const_cast<T*>(src_raw), dst_raw, length);
-      } else {
-        AccessInternal::arraycopy_disjoint_words(const_cast<T*>(src_raw), dst_raw, length);
-      }
+    // There is only a disjoint optimization for word granularity copying
+    if (HasDecorator<decorators, ARRAYCOPY_ATOMIC>::value) {
+      AccessInternal::arraycopy_disjoint_words_atomic(src_raw, dst_raw, length);
     } else {
-      if (HasDecorator<decorators, ARRAYCOPY_ATOMIC>::value) {
-        AccessInternal::arraycopy_conjoint_atomic(const_cast<T*>(src_raw), dst_raw, length);
-      } else {
-        AccessInternal::arraycopy_conjoint(const_cast<T*>(src_raw), dst_raw, length);
-      }
+      AccessInternal::arraycopy_disjoint_words(src_raw, dst_raw, length);
     }
   }
 
-  template <DecoratorSet decorators>
+  template <DecoratorSet decorators, typename T>
   static inline typename EnableIf<
-    !HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value>::type
-  arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, const void* src_raw,
-            arrayOop dst_obj, size_t dst_offset_in_bytes, void* dst_raw,
+    !HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value &&
+    !(HasDecorator<decorators, ARRAYCOPY_DISJOINT>::value && IsHeapWordSized<T>::value) &&
+    !HasDecorator<decorators, ARRAYCOPY_ARRAYOF>::value &&
+    !HasDecorator<decorators, ARRAYCOPY_ATOMIC>::value>::type
+  arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
+            arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
             size_t length) {
-
     src_raw = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
     dst_raw = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
 
-    if (HasDecorator<decorators, ARRAYCOPY_ATOMIC>::value) {
-      AccessInternal::arraycopy_conjoint_atomic(const_cast<void*>(src_raw), dst_raw, length);
-    } else {
-      AccessInternal::arraycopy_conjoint(const_cast<void*>(src_raw), dst_raw, length);
-    }
+    AccessInternal::arraycopy_conjoint(src_raw, dst_raw, length);
+  }
+
+  template <DecoratorSet decorators, typename T>
+  static inline typename EnableIf<
+    !HasDecorator<decorators, INTERNAL_VALUE_IS_OOP>::value &&
+    !(HasDecorator<decorators, ARRAYCOPY_DISJOINT>::value && IsHeapWordSized<T>::value) &&
+    !HasDecorator<decorators, ARRAYCOPY_ARRAYOF>::value &&
+    HasDecorator<decorators, ARRAYCOPY_ATOMIC>::value>::type
+  arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
+            arrayOop dst_obj, size_t dst_offset_in_bytes, T* dst_raw,
+            size_t length) {
+    src_raw = arrayOopDesc::obj_offset_to_raw(src_obj, src_offset_in_bytes, src_raw);
+    dst_raw = arrayOopDesc::obj_offset_to_raw(dst_obj, dst_offset_in_bytes, dst_raw);
+
+    AccessInternal::arraycopy_conjoint_atomic(src_raw, dst_raw, length);
   }
 };
 
+template<> struct RawAccessBarrierArrayCopy::IsHeapWordSized<void>: public IntegralConstant<bool, false> { };
+
 template <DecoratorSet decorators>
 template <typename T>
 inline bool RawAccessBarrier<decorators>::arraycopy(arrayOop src_obj, size_t src_offset_in_bytes, T* src_raw,
--- a/src/hotspot/share/oops/array.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/array.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #define SHARE_VM_OOPS_ARRAY_INLINE_HPP
 
 #include "oops/array.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 template <typename T>
 inline T Array<T>::at_acquire(const int which) { return OrderAccess::load_acquire(adr_at(which)); }
--- a/src/hotspot/share/oops/arrayKlass.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/arrayKlass.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 #ifndef SHARE_VM_OOPS_ARRAYKLASS_INLINE_HPP
 #define SHARE_VM_OOPS_ARRAYKLASS_INLINE_HPP
 
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "oops/arrayKlass.hpp"
 
 inline Klass* ArrayKlass::higher_dimension_acquire() const {
--- a/src/hotspot/share/oops/constantPool.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/constantPool.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 
 #include "oops/constantPool.hpp"
 #include "oops/cpCache.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 inline CPSlot ConstantPool::slot_at(int which) const {
   assert(is_within_bounds(which), "index out of bounds");
--- a/src/hotspot/share/oops/cpCache.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/cpCache.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -42,7 +42,7 @@
 #include "prims/methodHandles.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/macros.hpp"
 
 // Implementation of ConstantPoolCacheEntry
--- a/src/hotspot/share/oops/cpCache.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/cpCache.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 
 #include "oops/cpCache.hpp"
 #include "oops/oopHandle.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 inline int ConstantPoolCacheEntry::indices_ord() const { return OrderAccess::load_acquire(&_indices); }
 
--- a/src/hotspot/share/oops/instanceKlass.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -71,7 +71,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.inline.hpp"
 #include "services/classLoadingService.hpp"
 #include "services/threadService.hpp"
--- a/src/hotspot/share/oops/instanceKlass.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 #include "oops/instanceKlass.hpp"
 #include "oops/klass.hpp"
 #include "oops/oop.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/debug.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/macros.hpp"
--- a/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/instanceRefKlass.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -53,13 +53,20 @@
   }
 }
 
+static inline oop load_referent(oop obj, ReferenceType type) {
+  if (type == REF_PHANTOM) {
+    return HeapAccess<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>::oop_load(java_lang_ref_Reference::referent_addr_raw(obj));
+  } else {
+    return HeapAccess<ON_WEAK_OOP_REF | AS_NO_KEEPALIVE>::oop_load(java_lang_ref_Reference::referent_addr_raw(obj));
+  }
+}
+
 template <typename T, class OopClosureType>
 bool InstanceRefKlass::try_discover(oop obj, ReferenceType type, OopClosureType* closure) {
   ReferenceDiscoverer* rd = closure->ref_discoverer();
   if (rd != NULL) {
-    T referent_oop = RawAccess<>::oop_load((T*)java_lang_ref_Reference::referent_addr_raw(obj));
-    if (!CompressedOops::is_null(referent_oop)) {
-      oop referent = CompressedOops::decode_not_null(referent_oop);
+    oop referent = load_referent(obj, type);
+    if (referent != NULL) {
       if (!referent->is_gc_marked()) {
         // Only try to discover if not yet marked.
         return rd->discover_reference(obj, type);
@@ -179,9 +186,9 @@
 
   log_develop_trace(gc, ref)("InstanceRefKlass %s for obj " PTR_FORMAT, s, p2i(obj));
   log_develop_trace(gc, ref)("     referent_addr/* " PTR_FORMAT " / " PTR_FORMAT,
-      p2i(referent_addr), p2i(referent_addr ? RawAccess<>::oop_load(referent_addr) : (oop)NULL));
+      p2i(referent_addr), p2i((oop)HeapAccess<ON_UNKNOWN_OOP_REF | AS_NO_KEEPALIVE>::oop_load_at(obj, java_lang_ref_Reference::referent_offset)));
   log_develop_trace(gc, ref)("     discovered_addr/* " PTR_FORMAT " / " PTR_FORMAT,
-      p2i(discovered_addr), p2i(discovered_addr ? RawAccess<>::oop_load(discovered_addr) : (oop)NULL));
+      p2i(discovered_addr), p2i((oop)HeapAccess<AS_NO_KEEPALIVE>::oop_load(discovered_addr)));
 }
 #endif
 
--- a/src/hotspot/share/oops/klass.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/klass.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -43,7 +43,7 @@
 #include "oops/oopHandle.inline.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/handles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/stack.inline.hpp"
 
--- a/src/hotspot/share/oops/method.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/method.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -54,7 +54,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/relocator.hpp"
 #include "runtime/safepointVerifiers.hpp"
 #include "runtime/sharedRuntime.hpp"
@@ -449,12 +449,6 @@
   return Atomic::replace_if_null(counters, &_method_counters);
 }
 
-void Method::cleanup_inline_caches() {
-  // The current system doesn't use inline caches in the interpreter
-  // => nothing to do (keep this method around for future use)
-}
-
-
 int Method::extra_stack_words() {
   // not an inline function, to avoid a header dependency on Interpreter
   return extra_stack_entries() * Interpreter::stackElementSize;
--- a/src/hotspot/share/oops/method.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/method.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -904,9 +904,6 @@
     return method_holder()->lookup_osr_nmethod(this, bci, level, match_level);
   }
 
-  // Inline cache support
-  void cleanup_inline_caches();
-
   // Find if klass for method is loaded
   bool is_klass_loaded_by_klass_index(int klass_index) const;
   bool is_klass_loaded(int refinfo_index, bool must_be_resolved = false) const;
--- a/src/hotspot/share/oops/method.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/method.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #define SHARE_VM_OOPS_METHOD_INLINE_HPP
 
 #include "oops/method.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 inline address Method::from_compiled_entry() const {
   return OrderAccess::load_acquire(&_from_compiled_entry);
--- a/src/hotspot/share/oops/methodData.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/methodData.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -37,7 +37,7 @@
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/deoptimization.hpp"
 #include "runtime/handles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/safepointVerifiers.hpp"
 #include "utilities/align.hpp"
 #include "utilities/copy.hpp"
--- a/src/hotspot/share/oops/methodData.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/methodData.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #define SHARE_VM_OOPS_METHODDATA_INLINE_HPP
 
 #include "oops/methodData.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 
 inline void DataLayout::release_set_cell_at(int index, intptr_t value) {
   OrderAccess::release_store(&_cells[index], value);
--- a/src/hotspot/share/oops/oop.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/oop.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -35,7 +35,7 @@
 #include "oops/markOop.inline.hpp"
 #include "oops/oop.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "utilities/align.hpp"
 #include "utilities/macros.hpp"
--- a/src/hotspot/share/oops/weakHandle.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/weakHandle.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "classfile/systemDictionary.hpp"
+#include "classfile/stringTable.hpp"
 #include "gc/shared/oopStorage.hpp"
 #include "oops/access.inline.hpp"
 #include "oops/oop.hpp"
@@ -35,6 +36,10 @@
   return SystemDictionary::vm_weak_oop_storage();
 }
 
+template <> OopStorage* WeakHandle<vm_string_table_data>::get_storage() {
+  return StringTable::weak_storage();
+}
+
 template <WeakHandleType T>
 WeakHandle<T> WeakHandle<T>::create(Handle obj) {
   assert(obj() != NULL, "no need to create weak null oop");
@@ -68,4 +73,5 @@
 
 // Provide instantiation.
 template class WeakHandle<vm_class_loader_data>;
+template class WeakHandle<vm_string_table_data>;
 
--- a/src/hotspot/share/oops/weakHandle.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/weakHandle.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -39,12 +39,11 @@
 // This is the vm version of jweak but has different GC lifetimes and policies,
 // depending on the type.
 
-enum WeakHandleType { vm_class_loader_data, vm_string };
+enum WeakHandleType { vm_class_loader_data, vm_string, vm_string_table_data };
 
 template <WeakHandleType T>
 class WeakHandle {
  public:
-
  private:
   oop* _obj;
 
@@ -59,6 +58,8 @@
   void release() const;
   bool is_null() const { return _obj == NULL; }
 
+  void replace(oop with_obj);
+
   void print() const;
   void print_on(outputStream* st) const;
 };
--- a/src/hotspot/share/oops/weakHandle.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/oops/weakHandle.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -40,4 +40,10 @@
   return RootAccess<ON_PHANTOM_OOP_REF | AS_NO_KEEPALIVE>::oop_load(_obj);
 }
 
+template <WeakHandleType T>
+void WeakHandle<T>::replace(oop with_obj) {
+  RootAccess<ON_PHANTOM_OOP_REF>::oop_store(_obj, with_obj);
+}
+
 #endif // SHARE_VM_OOPS_WEAKHANDLE_INLINE_HPP
+
--- a/src/hotspot/share/opto/c2_globals.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/opto/c2_globals.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -53,6 +53,9 @@
   diagnostic(bool, StressGCM, false,                                        \
           "Randomize instruction scheduling in GCM")                        \
                                                                             \
+  develop(bool, StressMethodHandleLinkerInlining, false,                    \
+          "Stress inlining through method handle linkers")                  \
+                                                                            \
   develop(intx, OptoPrologueNops, 0,                                        \
           "Insert this many extra nop instructions "                        \
           "in the prologue of every nmethod")                               \
--- a/src/hotspot/share/opto/callGenerator.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/opto/callGenerator.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -932,7 +932,7 @@
           speculative_receiver_type = (receiver_type != NULL) ? receiver_type->speculative_type() : NULL;
         }
         CallGenerator* cg = C->call_generator(target, vtable_index, call_does_dispatch, jvms,
-                                              true /* allow_inline */,
+                                              !StressMethodHandleLinkerInlining /* allow_inline */,
                                               PROB_ALWAYS,
                                               speculative_receiver_type);
         return cg;
--- a/src/hotspot/share/opto/loopnode.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/opto/loopnode.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -2641,6 +2641,9 @@
   int old_progress = C->major_progress();
   uint orig_worklist_size = _igvn._worklist.size();
 
+  // Reset major-progress flag for the driver's heuristics
+  C->clear_major_progress();
+
 #ifndef PRODUCT
   // Capture for later assert
   uint unique = C->unique();
@@ -2711,16 +2714,11 @@
   if( !_verify_me && !_verify_only && _ltree_root->_child ) {
     C->print_method(PHASE_BEFORE_BEAUTIFY_LOOPS, 3);
     if( _ltree_root->_child->beautify_loops( this ) ) {
-      // IdealLoopTree::split_outer_loop may produce phi-nodes with a single in edge.
-      // Transform them away.
-      _igvn.optimize();
-
       // Re-build loop tree!
       _ltree_root->_child = NULL;
       _nodes.clear();
       reallocate_preorders();
       build_loop_tree();
-
       // Check for bailout, and return
       if (C->failing()) {
         return;
@@ -2732,9 +2730,6 @@
     }
   }
 
-  // Reset major-progress flag for the driver's heuristics
-  C->clear_major_progress();
-
   // Build Dominators for elision of NULL checks & loop finding.
   // Since nodes do not have a slot for immediate dominator, make
   // a persistent side array for that info indexed on node->_idx.
--- a/src/hotspot/share/precompiled/precompiled.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/precompiled/precompiled.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -187,7 +187,7 @@
 # include "runtime/mutexLocker.hpp"
 # include "runtime/objectMonitor.hpp"
 # include "runtime/orderAccess.hpp"
-# include "runtime/orderAccess.inline.hpp"
+# include "runtime/orderAccess.hpp"
 # include "runtime/os.hpp"
 # include "runtime/osThread.hpp"
 # include "runtime/perfData.hpp"
--- a/src/hotspot/share/prims/jni.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/prims/jni.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -73,7 +73,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
 #include "runtime/jniHandles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/safepointVerifiers.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/src/hotspot/share/prims/jvm.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/prims/jvm.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -64,7 +64,7 @@
 #include "runtime/javaCalls.hpp"
 #include "runtime/jfieldIDWorkaround.hpp"
 #include "runtime/jniHandles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/perfData.hpp"
 #include "runtime/reflection.hpp"
@@ -1115,7 +1115,7 @@
     return NULL;
   }
 
-  objArrayOop signers = java_lang_Class::signers(JNIHandles::resolve_non_null(cls));
+  objArrayHandle signers(THREAD, java_lang_Class::signers(JNIHandles::resolve_non_null(cls)));
 
   // If there are no signers set in the class, or if the class
   // is an array, return NULL.
--- a/src/hotspot/share/prims/jvmtiRawMonitor.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiRawMonitor.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 #include "prims/jvmtiRawMonitor.hpp"
 #include "runtime/atomic.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.inline.hpp"
 
 GrowableArray<JvmtiRawMonitor*> *JvmtiPendingMonitors::_monitors = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<JvmtiRawMonitor*>(1,true);
--- a/src/hotspot/share/prims/unsafe.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/prims/unsafe.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -40,7 +40,7 @@
 #include "runtime/globals.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/jniHandles.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/reflection.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadSMR.hpp"
--- a/src/hotspot/share/runtime/arguments.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -553,6 +553,7 @@
   { "CheckEndorsedAndExtDirs",       JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "DeferThrSuspendLoopCount",      JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "DeferPollingPageLoopCount",     JDK_Version::jdk(10),     JDK_Version::jdk(11), JDK_Version::jdk(12) },
+  { "TraceScavenge",                 JDK_Version::undefined(), JDK_Version::jdk(11), JDK_Version::jdk(12) },
   { "PermSize",                      JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
   { "MaxPermSize",                   JDK_Version::undefined(), JDK_Version::jdk(8),  JDK_Version::undefined() },
   { "SharedReadWriteSize",           JDK_Version::undefined(), JDK_Version::jdk(10), JDK_Version::undefined() },
@@ -4446,6 +4447,18 @@
   PropertyList_add(plist, k, v, writeable == WriteableProperty, internal == InternalProperty);
 }
 
+// Update existing property with new value.
+void Arguments::PropertyList_update_value(SystemProperty* plist, const char* k, const char* v) {
+  SystemProperty* prop;
+  for (prop = plist; prop != NULL; prop = prop->next()) {
+    if (strcmp(k, prop->key()) == 0) {
+        prop->set_value(v);
+        return;
+    }
+  }
+  assert(false, "invalid property");
+}
+
 // Copies src into buf, replacing "%%" with "%" and "%p" with pid
 // Returns true if all of the source pointed by src has been copied over to
 // the destination buffer pointed by buf. Otherwise, returns false.
--- a/src/hotspot/share/runtime/arguments.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -651,6 +651,7 @@
   static void PropertyList_unique_add(SystemProperty** plist, const char* k, const char* v,
                                       PropertyAppendable append, PropertyWriteable writeable,
                                       PropertyInternal internal);
+  static void PropertyList_update_value(SystemProperty* plist, const char* k, const char* v);
   static const char* PropertyList_get_value(SystemProperty* plist, const char* key);
   static const char* PropertyList_get_readable_value(SystemProperty* plist, const char* key);
   static int  PropertyList_count(SystemProperty* pl);
--- a/src/hotspot/share/runtime/globals.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/globals.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1055,9 +1055,6 @@
   develop(bool, TraceFinalizerRegistration, false,                          \
           "Trace registration of final references")                         \
                                                                             \
-  notproduct(bool, TraceScavenge, false,                                    \
-          "Trace scavenge")                                                 \
-                                                                            \
   product(bool, IgnoreEmptyClassPaths, false,                               \
           "Ignore empty path elements in -classpath")                       \
                                                                             \
@@ -2545,8 +2542,9 @@
           "Relax the access control checks in the verifier")                \
                                                                             \
   product(uintx, StringTableSize, defaultStringTableSize,                   \
-          "Number of buckets in the interned String table")                 \
-          range(minimumStringTableSize, 111*defaultStringTableSize)         \
+          "Number of buckets in the interned String table "                 \
+          "(will be rounded to nearest higher power of 2)")                 \
+          range(minimumStringTableSize, 16777216ul)                         \
                                                                             \
   experimental(uintx, SymbolTableSize, defaultSymbolTableSize,              \
           "Number of buckets in the JVM internal Symbol table")             \
--- a/src/hotspot/share/runtime/interfaceSupport.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/interfaceSupport.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
 #include "runtime/handles.inline.hpp"
 #include "runtime/init.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/thread.inline.hpp"
 #include "runtime/safepointVerifiers.hpp"
--- a/src/hotspot/share/runtime/java.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/java.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -524,14 +524,9 @@
   }
 
   if (VerifyStringTableAtExit) {
-    int fail_cnt = 0;
-    {
-      MutexLocker ml(StringTable_lock);
-      fail_cnt = StringTable::verify_and_compare_entries();
-    }
-
+    size_t fail_cnt = StringTable::verify_and_compare_entries();
     if (fail_cnt != 0) {
-      tty->print_cr("ERROR: fail_cnt=%d", fail_cnt);
+      tty->print_cr("ERROR: fail_cnt=" SIZE_FORMAT, fail_cnt);
       guarantee(fail_cnt == 0, "unexpected StringTable verification failures");
     }
   }
--- a/src/hotspot/share/runtime/mutex.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/mutex.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 #include "runtime/atomic.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/mutex.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/thread.inline.hpp"
--- a/src/hotspot/share/runtime/mutexLocker.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/mutexLocker.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -48,6 +48,8 @@
 Mutex*   JNIGlobalActive_lock         = NULL;
 Mutex*   JNIWeakAlloc_lock            = NULL;
 Mutex*   JNIWeakActive_lock           = NULL;
+Mutex*   StringTableWeakAlloc_lock    = NULL;
+Mutex*   StringTableWeakActive_lock   = NULL;
 Mutex*   JNIHandleBlockFreeList_lock  = NULL;
 Mutex*   VMWeakAlloc_lock             = NULL;
 Mutex*   VMWeakActive_lock            = NULL;
@@ -186,6 +188,9 @@
   def(VMWeakAlloc_lock             , PaddedMutex  , vmweak,      true,  Monitor::_safepoint_check_never);
   def(VMWeakActive_lock            , PaddedMutex  , vmweak-1,    true,  Monitor::_safepoint_check_never);
 
+  def(StringTableWeakAlloc_lock    , PaddedMutex  , vmweak,      true,  Monitor::_safepoint_check_never);
+  def(StringTableWeakActive_lock   , PaddedMutex  , vmweak-1,    true,  Monitor::_safepoint_check_never);
+
   if (UseConcMarkSweepGC || UseG1GC) {
     def(FullGCCount_lock           , PaddedMonitor, leaf,        true,  Monitor::_safepoint_check_never);      // in support of ExplicitGCInvokesConcurrent
   }
--- a/src/hotspot/share/runtime/mutexLocker.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/mutexLocker.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -42,6 +42,8 @@
 extern Mutex*   JNIGlobalActive_lock;            // JNI global storage active list lock
 extern Mutex*   JNIWeakAlloc_lock;               // JNI weak storage allocate list lock
 extern Mutex*   JNIWeakActive_lock;              // JNI weak storage active list lock
+extern Mutex*   StringTableWeakAlloc_lock;       // StringTable weak storage allocate list lock
+extern Mutex*   StringTableWeakActive_lock;      // STringTable weak storage active list lock
 extern Mutex*   JNIHandleBlockFreeList_lock;     // a lock on the JNI handle block free list
 extern Mutex*   VMWeakAlloc_lock;                // VM Weak Handles storage allocate list lock
 extern Mutex*   VMWeakActive_lock;               // VM Weak Handles storage active list lock
--- a/src/hotspot/share/runtime/objectMonitor.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/objectMonitor.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -36,7 +36,7 @@
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
 #include "runtime/objectMonitor.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/safepointMechanism.inline.hpp"
 #include "runtime/sharedRuntime.hpp"
--- a/src/hotspot/share/runtime/orderAccess.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/orderAccess.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,6 +27,7 @@
 
 #include "memory/allocation.hpp"
 #include "runtime/atomic.hpp"
+#include "utilities/macros.hpp"
 
 //                Memory Access Ordering Model
 //
@@ -311,4 +312,38 @@
   }
 };
 
+#include OS_CPU_HEADER(orderAccess)
+
+template<> inline void ScopedFenceGeneral<X_ACQUIRE>::postfix()       { OrderAccess::acquire(); }
+template<> inline void ScopedFenceGeneral<RELEASE_X>::prefix()        { OrderAccess::release(); }
+template<> inline void ScopedFenceGeneral<RELEASE_X_FENCE>::prefix()  { OrderAccess::release(); }
+template<> inline void ScopedFenceGeneral<RELEASE_X_FENCE>::postfix() { OrderAccess::fence();   }
+
+
+template <typename FieldType, ScopedFenceType FenceType>
+inline void OrderAccess::ordered_store(volatile FieldType* p, FieldType v) {
+  ScopedFence<FenceType> f((void*)p);
+  Atomic::store(v, p);
+}
+
+template <typename FieldType, ScopedFenceType FenceType>
+inline FieldType OrderAccess::ordered_load(const volatile FieldType* p) {
+  ScopedFence<FenceType> f((void*)p);
+  return Atomic::load(p);
+}
+
+template <typename T>
+inline T OrderAccess::load_acquire(const volatile T* p) {
+  return LoadImpl<T, PlatformOrderedLoad<sizeof(T), X_ACQUIRE> >()(p);
+}
+
+template <typename T, typename D>
+inline void OrderAccess::release_store(volatile D* p, T v) {
+  StoreImpl<T, D, PlatformOrderedStore<sizeof(D), RELEASE_X> >()(v, p);
+}
+
+template <typename T, typename D>
+inline void OrderAccess::release_store_fence(volatile D* p, T v) {
+  StoreImpl<T, D, PlatformOrderedStore<sizeof(D), RELEASE_X_FENCE> >()(v, p);
+}
 #endif // SHARE_VM_RUNTIME_ORDERACCESS_HPP
--- a/src/hotspot/share/runtime/orderAccess.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2014, 2016 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please 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_RUNTIME_ORDERACCESS_INLINE_HPP
-#define SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
-
-#include "runtime/orderAccess.hpp"
-#include "utilities/macros.hpp"
-
-#include OS_CPU_HEADER_INLINE(orderAccess)
-
-template<> inline void ScopedFenceGeneral<X_ACQUIRE>::postfix()       { OrderAccess::acquire(); }
-template<> inline void ScopedFenceGeneral<RELEASE_X>::prefix()        { OrderAccess::release(); }
-template<> inline void ScopedFenceGeneral<RELEASE_X_FENCE>::prefix()  { OrderAccess::release(); }
-template<> inline void ScopedFenceGeneral<RELEASE_X_FENCE>::postfix() { OrderAccess::fence();   }
-
-
-template <typename FieldType, ScopedFenceType FenceType>
-inline void OrderAccess::ordered_store(volatile FieldType* p, FieldType v) {
-  ScopedFence<FenceType> f((void*)p);
-  Atomic::store(v, p);
-}
-
-template <typename FieldType, ScopedFenceType FenceType>
-inline FieldType OrderAccess::ordered_load(const volatile FieldType* p) {
-  ScopedFence<FenceType> f((void*)p);
-  return Atomic::load(p);
-}
-
-template <typename T>
-inline T OrderAccess::load_acquire(const volatile T* p) {
-  return LoadImpl<T, PlatformOrderedLoad<sizeof(T), X_ACQUIRE> >()(p);
-}
-
-template <typename T, typename D>
-inline void OrderAccess::release_store(volatile D* p, T v) {
-  StoreImpl<T, D, PlatformOrderedStore<sizeof(D), RELEASE_X> >()(v, p);
-}
-
-template <typename T, typename D>
-inline void OrderAccess::release_store_fence(volatile D* p, T v) {
-  StoreImpl<T, D, PlatformOrderedStore<sizeof(D), RELEASE_X_FENCE> >()(v, p);
-}
-#endif // SHARE_VM_RUNTIME_ORDERACCESS_INLINE_HPP
--- a/src/hotspot/share/runtime/perfMemory.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/perfMemory.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -30,7 +30,7 @@
 #include "runtime/java.hpp"
 #include "runtime/mutex.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/perfData.hpp"
 #include "runtime/perfMemory.hpp"
--- a/src/hotspot/share/runtime/safepoint.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/safepoint.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -50,7 +50,7 @@
 #include "runtime/frame.inline.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/safepoint.hpp"
 #include "runtime/safepointMechanism.inline.hpp"
--- a/src/hotspot/share/runtime/serviceThread.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/serviceThread.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/stringTable.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/javaCalls.hpp"
 #include "runtime/serviceThread.hpp"
@@ -82,6 +83,7 @@
     bool has_gc_notification_event = false;
     bool has_dcmd_notification_event = false;
     bool acs_notify = false;
+    bool stringtable_work = false;
     JvmtiDeferredEvent jvmti_event;
     {
       // Need state transition ThreadBlockInVM so that this thread
@@ -98,7 +100,8 @@
       while (!(sensors_changed = LowMemoryDetector::has_pending_requests()) &&
              !(has_jvmti_events = JvmtiDeferredEventQueue::has_events()) &&
               !(has_gc_notification_event = GCNotifier::has_event()) &&
-              !(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification())) {
+              !(has_dcmd_notification_event = DCmdFactory::has_pending_jmx_notification()) &&
+              !(stringtable_work = StringTable::has_work())) {
         // wait until one of the sensors has pending requests, or there is a
         // pending JVMTI event or JMX GC notification to post
         Service_lock->wait(Mutex::_no_safepoint_check_flag);
@@ -109,6 +112,10 @@
       }
     }
 
+    if (stringtable_work) {
+      StringTable::do_concurrent_work(jt);
+    }
+
     if (has_jvmti_events) {
       jvmti_event.post();
     }
--- a/src/hotspot/share/runtime/sharedRuntime.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/sharedRuntime.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1082,6 +1082,7 @@
 
   Bytecode_invoke bytecode(caller, bci);
   int bytecode_index = bytecode.index();
+  bc = bytecode.invoke_code();
 
   methodHandle attached_method = extract_attached_method(vfst);
   if (attached_method.not_null()) {
@@ -1095,6 +1096,11 @@
 
       // Adjust invocation mode according to the attached method.
       switch (bc) {
+        case Bytecodes::_invokevirtual:
+          if (attached_method->method_holder()->is_interface()) {
+            bc = Bytecodes::_invokeinterface;
+          }
+          break;
         case Bytecodes::_invokeinterface:
           if (!attached_method->method_holder()->is_interface()) {
             bc = Bytecodes::_invokevirtual;
@@ -1110,10 +1116,10 @@
           break;
       }
     }
-  } else {
-    bc = bytecode.invoke_code();
   }
 
+  assert(bc != Bytecodes::_illegal, "not initialized");
+
   bool has_receiver = bc != Bytecodes::_invokestatic &&
                       bc != Bytecodes::_invokedynamic &&
                       bc != Bytecodes::_invokehandle;
--- a/src/hotspot/share/runtime/sweeper.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/sweeper.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -38,7 +38,7 @@
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/interfaceSupport.inline.hpp"
 #include "runtime/mutexLocker.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "runtime/sweeper.hpp"
 #include "runtime/thread.inline.hpp"
--- a/src/hotspot/share/runtime/thread.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/thread.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -80,7 +80,7 @@
 #include "runtime/memprofiler.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "runtime/objectMonitor.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/osThread.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "runtime/safepoint.hpp"
@@ -1132,6 +1132,9 @@
   ResourceMark rm(THREAD);
   const char *vm_info = VM_Version::vm_info_string();
 
+  // update the native system property first
+  Arguments::PropertyList_update_value(Arguments::system_properties(), "java.vm.info", vm_info);
+
   // java.lang.System class
   Klass* klass =  SystemDictionary::resolve_or_fail(vmSymbols::java_lang_System(), true, CHECK);
 
@@ -3779,9 +3782,10 @@
 
   initialize_java_lang_classes(main_thread, CHECK_JNI_ERR);
 
-  // We need this for ClassDataSharing - the initial vm.info property is set
-  // with the default value of CDS "sharing" which may be reset through
-  // command line options.
+  // We need this to update the java.vm.info property in case any flags used
+  // to initially define it have been changed. This is needed for both CDS and
+  // AOT, since UseSharedSpaces and UseAOT may be changed after java.vm.info
+  // is initially computed. See Abstract_VM_Version::vm_info_string().
   reset_vm_info_property(CHECK_JNI_ERR);
 
   quicken_jni_functions();
--- a/src/hotspot/share/runtime/thread.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/thread.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 
 #include "runtime/atomic.hpp"
 #include "runtime/globals.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.inline.hpp"
 #include "runtime/thread.hpp"
 
--- a/src/hotspot/share/runtime/vmStructs.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -164,7 +164,6 @@
 typedef Hashtable<intptr_t, mtInternal>       IntptrHashtable;
 typedef Hashtable<Symbol*, mtSymbol>          SymbolHashtable;
 typedef HashtableEntry<Symbol*, mtClass>      SymbolHashtableEntry;
-typedef Hashtable<oop, mtSymbol>              StringHashtable;
 typedef Hashtable<InstanceKlass*, mtClass>       KlassHashtable;
 typedef HashtableEntry<InstanceKlass*, mtClass>  KlassHashtableEntry;
 typedef CompactHashtable<Symbol*, char>       SymbolCompactHashTable;
@@ -476,12 +475,6 @@
      static_field(SymbolTable,                 _shared_table,                                 SymbolCompactHashTable)                \
      static_field(RehashableSymbolHashtable,   _seed,                                         juint)                                 \
                                                                                                                                      \
-  /***************/                                                                                                                  \
-  /* StringTable */                                                                                                                  \
-  /***************/                                                                                                                  \
-                                                                                                                                     \
-     static_field(StringTable,                 _the_table,                                    StringTable*)                          \
-                                                                                                                                     \
   /********************/                                                                                                             \
   /* CompactHashTable */                                                                                                             \
   /********************/                                                                                                             \
@@ -1365,7 +1358,6 @@
   declare_toplevel_type(BasicHashtable<mtSymbol>)                         \
     declare_type(RehashableSymbolHashtable, BasicHashtable<mtSymbol>)     \
   declare_type(SymbolTable, SymbolHashtable)                              \
-  declare_type(StringTable, StringHashtable)                              \
     declare_type(Dictionary, KlassHashtable)                              \
   declare_toplevel_type(BasicHashtableEntry<mtInternal>)                  \
   declare_type(IntptrHashtableEntry, BasicHashtableEntry<mtInternal>)     \
--- a/src/hotspot/share/runtime/vm_operations.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/vm_operations.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -204,13 +204,6 @@
 }
 
 bool VM_PrintThreads::doit_prologue() {
-  // Make sure AbstractOwnableSynchronizer is loaded
-  JavaThread* jt = JavaThread::current();
-  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(jt);
-  if (jt->has_pending_exception()) {
-    return false;
-  }
-
   // Get Heap_lock if concurrent locks will be dumped
   if (_print_concurrent_locks) {
     Heap_lock->lock();
@@ -248,19 +241,6 @@
   }
 }
 
-bool VM_FindDeadlocks::doit_prologue() {
-  if (_concurrent_locks) {
-    // Make sure AbstractOwnableSynchronizer is loaded
-    JavaThread* jt = JavaThread::current();
-    java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(jt);
-    if (jt->has_pending_exception()) {
-      return false;
-    }
-  }
-
-  return true;
-}
-
 void VM_FindDeadlocks::doit() {
   // Update the hazard ptr in the originating thread to the current
   // list of threads. This VM operation needs the current list of
@@ -316,13 +296,6 @@
 }
 
 bool VM_ThreadDump::doit_prologue() {
-  // Make sure AbstractOwnableSynchronizer is loaded
-  JavaThread* jt = JavaThread::current();
-  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(jt);
-  if (jt->has_pending_exception()) {
-    return false;
-  }
-
   if (_with_locked_synchronizers) {
     // Acquire Heap_lock to dump concurrent locks
     Heap_lock->lock();
--- a/src/hotspot/share/runtime/vm_operations.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/runtime/vm_operations.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -103,6 +103,7 @@
   template(RotateGCLog)                           \
   template(WhiteBoxOperation)                     \
   template(ClassLoaderStatsOperation)             \
+  template(ClassLoaderHierarchyOperation)         \
   template(DumpHashtable)                         \
   template(DumpTouchedMethods)                    \
   template(MarkActiveNMethods)                    \
@@ -421,7 +422,6 @@
   DeadlockCycle* result()      { return _deadlocks; };
   VMOp_Type type() const       { return VMOp_FindDeadlocks; }
   void doit();
-  bool doit_prologue();
 };
 
 class ThreadDumpResult;
--- a/src/hotspot/share/services/diagnosticCommand.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/services/diagnosticCommand.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -24,6 +24,7 @@
 
 #include "precompiled.hpp"
 #include "jvm.h"
+#include "classfile/classLoaderHierarchyDCmd.hpp"
 #include "classfile/classLoaderStats.hpp"
 #include "classfile/compactHashtable.hpp"
 #include "compiler/compileBroker.hpp"
@@ -101,6 +102,7 @@
 #endif // INCLUDE_JVMTI
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ThreadDumpDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderStatsDCmd>(full_export, true, false));
+  DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<ClassLoaderHierarchyDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CompileQueueDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeListDCmd>(full_export, true, false));
   DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl<CodeCacheDCmd>(full_export, true, false));
--- a/src/hotspot/share/services/management.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/services/management.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1081,9 +1081,6 @@
                "The length of the given ThreadInfo array does not match the length of the given array of thread IDs", -1);
   }
 
-  // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
-  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_0);
-
   // Must use ThreadDumpResult to store the ThreadSnapshot.
   // GC may occur after the thread snapshots are taken but before
   // this function returns. The threadObj and other oops kept
@@ -1154,9 +1151,6 @@
                                         jboolean locked_synchronizers, jint maxDepth))
   ResourceMark rm(THREAD);
 
-  // make sure the AbstractOwnableSynchronizer klass is loaded before taking thread snapshots
-  java_util_concurrent_locks_AbstractOwnableSynchronizer::initialize(CHECK_NULL);
-
   typeArrayOop ta = typeArrayOop(JNIHandles::resolve(thread_ids));
   int num_threads = (ta != NULL ? ta->length() : 0);
   typeArrayHandle ids_ah(THREAD, ta);
--- a/src/hotspot/share/services/memTracker.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/services/memTracker.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,7 +25,7 @@
 #include "jvm.h"
 
 #include "runtime/mutex.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/vmThread.hpp"
 #include "runtime/vm_operations.hpp"
 #include "services/memBaseline.hpp"
--- a/src/hotspot/share/services/memoryManager.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/services/memoryManager.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "services/lowMemoryDetector.hpp"
 #include "services/management.hpp"
 #include "services/memoryManager.hpp"
--- a/src/hotspot/share/services/memoryPool.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/services/memoryPool.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -29,7 +29,7 @@
 #include "oops/oop.inline.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/javaCalls.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "services/lowMemoryDetector.hpp"
 #include "services/management.hpp"
 #include "services/memoryManager.hpp"
--- a/src/hotspot/share/services/threadService.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/services/threadService.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -369,7 +369,7 @@
         }
       } else {
         if (concurrent_locks) {
-          if (waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass())) {
+          if (waitingToLockBlocker->is_a(SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass())) {
             oop threadObj = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(waitingToLockBlocker);
             // This JavaThread (if there is one) is protected by the
             // ThreadsListSetter in VM_FindDeadlocks::doit().
@@ -678,8 +678,8 @@
   GrowableArray<oop>* aos_objects = new (ResourceObj::C_HEAP, mtInternal) GrowableArray<oop>(INITIAL_ARRAY_SIZE, true /* C_heap */);
 
   // Find all instances of AbstractOwnableSynchronizer
-  HeapInspection::find_instances_at_safepoint(SystemDictionary::abstract_ownable_synchronizer_klass(),
-                                                aos_objects);
+  HeapInspection::find_instances_at_safepoint(SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass(),
+                                              aos_objects);
   // Build a map of thread to its owned AQS locks
   build_map(aos_objects);
 
@@ -832,7 +832,7 @@
          _thread_status == java_lang_Thread::PARKED_TIMED)) {
 
     _blocker_object = thread->current_park_blocker();
-    if (_blocker_object != NULL && _blocker_object->is_a(SystemDictionary::abstract_ownable_synchronizer_klass())) {
+    if (_blocker_object != NULL && _blocker_object->is_a(SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass())) {
       _blocker_object_owner = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(_blocker_object);
     }
   }
@@ -923,7 +923,7 @@
       st->print("  waiting for ownable synchronizer " INTPTR_FORMAT ", (a %s)",
                 p2i(waitingToLockBlocker),
                 waitingToLockBlocker->klass()->external_name());
-      assert(waitingToLockBlocker->is_a(SystemDictionary::abstract_ownable_synchronizer_klass()),
+      assert(waitingToLockBlocker->is_a(SystemDictionary::java_util_concurrent_locks_AbstractOwnableSynchronizer_klass()),
              "Must be an AbstractOwnableSynchronizer");
       oop ownerObj = java_util_concurrent_locks_AbstractOwnableSynchronizer::get_owner_threadObj(waitingToLockBlocker);
       currentThread = java_lang_Thread::thread(ownerObj);
--- a/src/hotspot/share/utilities/concurrentHashTable.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/utilities/concurrentHashTable.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -484,6 +484,9 @@
   void statistics_to(Thread* thread, VALUE_SIZE_FUNC& vs_f, outputStream* st,
                      const char* table_name);
 
+  // Moves all nodes from this table to to_cht
+  bool try_move_nodes_to(Thread* thread, ConcurrentHashTable<VALUE, CONFIG, F>* to_cht);
+
   // This is a Curiously Recurring Template Pattern (CRPT) interface for the
   // specialization.
   struct BaseConfig {
--- a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 
 #include "memory/allocation.inline.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/prefetch.inline.hpp"
 #include "utilities/concurrentHashTable.hpp"
 #include "utilities/globalCounter.inline.hpp"
@@ -293,7 +293,7 @@
 inline void ConcurrentHashTable<VALUE, CONFIG, F>::
   write_synchonize_on_visible_epoch(Thread* thread)
 {
-  assert(_resize_lock->owned_by_self(), "Re-size lock not held");
+  assert(_resize_lock_owner == thread, "Re-size lock not held");
   OrderAccess::fence(); // Prevent below load from floating up.
   // If no reader saw this version we can skip write_synchronize.
   if (OrderAccess::load_acquire(&_invisible_epoch) == thread) {
@@ -488,7 +488,7 @@
 {
   // Here we have resize lock so table is SMR safe, and there is no new
   // table. Can do this in parallel if we want.
-  assert(_resize_lock->owned_by_self(), "Re-size lock not held");
+  assert(_resize_lock_owner == thread, "Re-size lock not held");
   Node* ndel[BULK_DELETE_LIMIT];
   InternalTable* table = get_table();
   assert(start_idx < stop_idx, "Must be");
@@ -500,9 +500,9 @@
   // own read-side.
   GlobalCounter::critical_section_begin(thread);
   for (size_t bucket_it = start_idx; bucket_it < stop_idx; bucket_it++) {
-    Bucket* bucket  = _table->get_bucket(bucket_it);
+    Bucket* bucket = table->get_bucket(bucket_it);
     Bucket* prefetch_bucket = (bucket_it+1) < stop_idx ?
-                              _table->get_bucket(bucket_it+1) : NULL;
+                              table->get_bucket(bucket_it+1) : NULL;
 
     if (!HaveDeletables<IsPointer<VALUE>::value, EVALUATE_FUNC>::
         have_deletable(bucket, eval_f, prefetch_bucket)) {
@@ -695,17 +695,13 @@
   if (!try_resize_lock(thread)) {
     return false;
   }
-
-  assert(_resize_lock->owned_by_self(), "Re-size lock not held");
-
+  assert(_resize_lock_owner == thread, "Re-size lock not held");
   if (_table->_log2_size == _log2_start_size ||
       _table->_log2_size <= log2_size) {
     unlock_resize_lock(thread);
     return false;
   }
-
   _new_table = new InternalTable(_table->_log2_size - 1);
-
   return true;
 }
 
@@ -713,8 +709,7 @@
 inline void ConcurrentHashTable<VALUE, CONFIG, F>::
   internal_shrink_epilog(Thread* thread)
 {
-  assert(_resize_lock->owned_by_self(), "Re-size lock not held");
-  assert(_resize_lock_owner, "Should be locked");
+  assert(_resize_lock_owner == thread, "Re-size lock not held");
 
   InternalTable* old_table = set_table_from_new();
   _size_limit_reached = false;
@@ -771,14 +766,13 @@
   internal_shrink(Thread* thread, size_t log2_size)
 {
   if (!internal_shrink_prolog(thread, log2_size)) {
-    assert(!_resize_lock->owned_by_self(), "Re-size lock held");
+    assert(_resize_lock_owner != thread, "Re-size lock held");
     return false;
   }
-  assert(_resize_lock->owned_by_self(), "Re-size lock not held");
   assert(_resize_lock_owner == thread, "Should be locked by me");
   internal_shrink_range(thread, 0, _new_table->_size);
   internal_shrink_epilog(thread);
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
+  assert(_resize_lock_owner != thread, "Re-size lock held");
   return true;
 }
 
@@ -815,8 +809,7 @@
 inline void ConcurrentHashTable<VALUE, CONFIG, F>::
   internal_grow_epilog(Thread* thread)
 {
-  assert(_resize_lock->owned_by_self(), "Re-size lock not held");
-  assert(_resize_lock_owner, "Should be locked");
+  assert(_resize_lock_owner == thread, "Should be locked");
 
   InternalTable* old_table = set_table_from_new();
   unlock_resize_lock(thread);
@@ -835,14 +828,13 @@
   internal_grow(Thread* thread, size_t log2_size)
 {
   if (!internal_grow_prolog(thread, log2_size)) {
-    assert(!_resize_lock->owned_by_self(), "Re-size lock held");
+    assert(_resize_lock_owner != thread, "Re-size lock held");
     return false;
   }
-  assert(_resize_lock->owned_by_self(), "Re-size lock not held");
   assert(_resize_lock_owner == thread, "Should be locked by me");
   internal_grow_range(thread, 0, _table->_size);
   internal_grow_epilog(thread);
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
+  assert(_resize_lock_owner != thread, "Re-size lock held");
   return true;
 }
 
@@ -955,15 +947,13 @@
 inline void ConcurrentHashTable<VALUE, CONFIG, F>::
   do_scan_locked(Thread* thread, FUNC& scan_f)
 {
-  assert(_resize_lock->owned_by_self() ||
-         (thread->is_VM_thread() && SafepointSynchronize::is_at_safepoint()),
-         "Re-size lock not held or not VMThread at safepoint");
+  assert(_resize_lock_owner == thread, "Re-size lock not held");
   // We can do a critical section over the entire loop but that would block
   // updates for a long time. Instead we choose to block resizes.
   InternalTable* table = get_table();
-  for (size_t bucket_it = 0; bucket_it < _table->_size; bucket_it++) {
+  for (size_t bucket_it = 0; bucket_it < table->_size; bucket_it++) {
     ScopedCS cs(thread, this);
-    if (!visit_nodes(_table->get_bucket(bucket_it), scan_f)) {
+    if (!visit_nodes(table->get_bucket(bucket_it), scan_f)) {
       break; /* ends critical section */
     }
   } /* ends critical section */
@@ -1094,17 +1084,11 @@
 inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
   try_scan(Thread* thread, SCAN_FUNC& scan_f)
 {
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
-  bool vm_and_safepoint = thread->is_VM_thread() &&
-                          SafepointSynchronize::is_at_safepoint();
-  if (!vm_and_safepoint && !try_resize_lock(thread)) {
+  if (!try_resize_lock(thread)) {
     return false;
   }
   do_scan_locked(thread, scan_f);
-  if (!vm_and_safepoint) {
-    unlock_resize_lock(thread);
-  }
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
+  unlock_resize_lock(thread);
   return true;
 }
 
@@ -1113,11 +1097,11 @@
 inline void ConcurrentHashTable<VALUE, CONFIG, F>::
   do_scan(Thread* thread, SCAN_FUNC& scan_f)
 {
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
+  assert(_resize_lock_owner != thread, "Re-size lock held");
   lock_resize_lock(thread);
   do_scan_locked(thread, scan_f);
   unlock_resize_lock(thread);
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
+  assert(_resize_lock_owner != thread, "Re-size lock held");
 }
 
 template <typename VALUE, typename CONFIG, MEMFLAGS F>
@@ -1126,12 +1110,11 @@
   try_bulk_delete(Thread* thread, EVALUATE_FUNC& eval_f, DELETE_FUNC& del_f)
 {
   if (!try_resize_lock(thread)) {
-    assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
     return false;
   }
   do_bulk_delete_locked(thread, eval_f, del_f);
   unlock_resize_lock(thread);
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
+  assert(_resize_lock_owner != thread, "Re-size lock held");
   return true;
 }
 
@@ -1140,11 +1123,9 @@
 inline void ConcurrentHashTable<VALUE, CONFIG, F>::
   bulk_delete(Thread* thread, EVALUATE_FUNC& eval_f, DELETE_FUNC& del_f)
 {
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
   lock_resize_lock(thread);
   do_bulk_delete_locked(thread, eval_f, del_f);
   unlock_resize_lock(thread);
-  assert(!_resize_lock->owned_by_self(), "Re-size lock not held");
 }
 
 template <typename VALUE, typename CONFIG, MEMFLAGS F>
@@ -1155,17 +1136,16 @@
 {
   NumberSeq summary;
   size_t literal_bytes = 0;
-  if ((thread->is_VM_thread() && !SafepointSynchronize::is_at_safepoint()) ||
-      (!thread->is_VM_thread() && !try_resize_lock(thread))) {
+  if (!try_resize_lock(thread)) {
     st->print_cr("statistics unavailable at this moment");
     return;
   }
 
   InternalTable* table = get_table();
-  for (size_t bucket_it = 0; bucket_it < _table->_size; bucket_it++) {
+  for (size_t bucket_it = 0; bucket_it < table->_size; bucket_it++) {
     ScopedCS cs(thread, this);
     size_t count = 0;
-    Bucket* bucket = _table->get_bucket(bucket_it);
+    Bucket* bucket = table->get_bucket(bucket_it);
     if (bucket->have_redirect() || bucket->is_locked()) {
         continue;
     }
@@ -1208,9 +1188,37 @@
   st->print_cr("Std. dev. of bucket size: %9.3f", summary.sd());
   st->print_cr("Maximum bucket size     : %9" PRIuPTR,
                (size_t)summary.maximum());
-  if (!thread->is_VM_thread()) {
-    unlock_resize_lock(thread);
+  unlock_resize_lock(thread);
+}
+
+template <typename VALUE, typename CONFIG, MEMFLAGS F>
+inline bool ConcurrentHashTable<VALUE, CONFIG, F>::
+  try_move_nodes_to(Thread* thread, ConcurrentHashTable<VALUE, CONFIG, F>* to_cht)
+{
+  if (!try_resize_lock(thread)) {
+    return false;
   }
+  assert(_new_table == NULL, "Must be NULL");
+  for (size_t bucket_it = 0; bucket_it < _table->_size; bucket_it++) {
+    Bucket* bucket = _table->get_bucket(bucket_it);
+    assert(!bucket->have_redirect() && !bucket->is_locked(), "Table must be uncontended");
+    while (bucket->first() != NULL) {
+      Node* move_node = bucket->first();
+      bool ok = bucket->cas_first(move_node->next(), move_node);
+      assert(ok, "Uncontended cas must work");
+      bool dead_hash = false;
+      size_t insert_hash = CONFIG::get_hash(*move_node->value(), &dead_hash);
+      if (!dead_hash) {
+        Bucket* insert_bucket = to_cht->get_bucket(insert_hash);
+        assert(!bucket->have_redirect() && !bucket->is_locked(), "Not bit should be present");
+        move_node->set_next(insert_bucket->first());
+        ok = insert_bucket->cas_first(move_node, insert_bucket->first());
+        assert(ok, "Uncontended cas must work");
+      }
+    }
+  }
+  unlock_resize_lock(thread);
+  return true;
 }
 
 #endif // include guard
--- a/src/hotspot/share/utilities/concurrentHashTableTasks.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/utilities/concurrentHashTableTasks.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,6 +25,7 @@
 #ifndef SHARE_UTILITIES_CONCURRENT_HASH_TABLE_TASKS_INLINE_HPP
 #define SHARE_UTILITIES_CONCURRENT_HASH_TABLE_TASKS_INLINE_HPP
 
+#include "utilities/globalDefinitions.hpp"
 #include "utilities/concurrentHashTable.inline.hpp"
 
 // This inline file contains BulkDeleteTask and GrowTasks which are both bucket
@@ -63,6 +64,7 @@
   // Calculate starting values.
   void setup() {
     _size_log2 = _cht->_table->_log2_size;
+    _task_size_log2 = MIN2(_task_size_log2, _size_log2);
     size_t tmp = _size_log2 > _task_size_log2 ?
                  _size_log2 - _task_size_log2 : 0;
     _stop_task = (((size_t)1) << tmp);
--- a/src/hotspot/share/utilities/globalCounter.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/utilities/globalCounter.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 #include "precompiled.hpp"
 #include "utilities/globalCounter.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/threadSMR.inline.hpp"
 #include "runtime/vmThread.hpp"
--- a/src/hotspot/share/utilities/globalCounter.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/utilities/globalCounter.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -25,7 +25,7 @@
 #ifndef SHARE_UTILITIES_GLOBAL_COUNTER_INLINE_HPP
 #define SHARE_UTILITIES_GLOBAL_COUNTER_INLINE_HPP
 
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/globalCounter.hpp"
 
--- a/src/hotspot/share/utilities/globalDefinitions.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/utilities/globalDefinitions.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -424,8 +424,8 @@
 //----------------------------------------------------------------------------------------------------
 // Default and minimum StringTableSize values
 
-const int defaultStringTableSize = NOT_LP64(1009) LP64_ONLY(60013);
-const int minimumStringTableSize = 1009;
+const int defaultStringTableSize = NOT_LP64(1024) LP64_ONLY(65536);
+const int minimumStringTableSize = 128;
 
 const int defaultSymbolTableSize = 20011;
 const int minimumSymbolTableSize = 1009;
--- a/src/hotspot/share/utilities/hashtable.inline.hpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/hotspot/share/utilities/hashtable.inline.hpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 #define SHARE_VM_UTILITIES_HASHTABLE_INLINE_HPP
 
 #include "memory/allocation.inline.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "utilities/hashtable.hpp"
 #include "utilities/dtrace.hpp"
 
--- a/src/java.base/aix/native/libjsig/jsig.c	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,238 +0,0 @@
-/*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
- * Copyright (c) 2012, 2015 SAP SE. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-/* CopyrightVersion 1.2 */
-
-/* This is a special library that should be loaded before libc &
- * libthread to interpose the signal handler installation functions:
- * sigaction(), signal(), sigset().
- * Used for signal-chaining. See RFE 4381843.
- */
-
-#include <signal.h>
-#include <dlfcn.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include "jni.h"
-
-#define bool int
-#define true 1
-#define false 0
-
-static struct sigaction sact[NSIG]; /* saved signal handlers */
-static sigset_t jvmsigs; /* Signals used by jvm. */
-
-/* Used to synchronize the installation of signal handlers. */
-static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
-static pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
-static pthread_t tid = 0;
-
-typedef void (*sa_handler_t)(int);
-typedef void (*sa_sigaction_t)(int, siginfo_t *, void *);
-// signal_t is already defined on AIX.
-typedef sa_handler_t (*signal_like_function_t)(int, sa_handler_t);
-typedef int (*sigaction_t)(int, const struct sigaction *, struct sigaction *);
-
-static signal_like_function_t os_signal = 0; /* os's version of signal()/sigset() */
-static sigaction_t os_sigaction = 0; /* os's version of sigaction() */
-
-static bool jvm_signal_installing = false;
-static bool jvm_signal_installed = false;
-
-static void signal_lock() {
-  pthread_mutex_lock(&mutex);
-  /* When the jvm is installing its set of signal handlers, threads
-   * other than the jvm thread should wait. */
-  if (jvm_signal_installing) {
-    if (tid != pthread_self()) {
-      pthread_cond_wait(&cond, &mutex);
-    }
-  }
-}
-
-static void signal_unlock() {
-  pthread_mutex_unlock(&mutex);
-}
-
-static sa_handler_t call_os_signal(int sig, sa_handler_t disp,
-                                   bool is_sigset) {
-  if (os_signal == NULL) {
-    if (!is_sigset) {
-      // Aix: call functions directly instead of dlsym'ing them.
-      os_signal = signal;
-    } else {
-      // Aix: call functions directly instead of dlsym'ing them.
-      os_signal = sigset;
-    }
-    if (os_signal == NULL) {
-      printf("%s\n", dlerror());
-      exit(0);
-    }
-  }
-  return (*os_signal)(sig, disp);
-}
-
-static void save_signal_handler(int sig, sa_handler_t disp) {
-  sigset_t set;
-  sact[sig].sa_handler = disp;
-  sigemptyset(&set);
-  sact[sig].sa_mask = set;
-  sact[sig].sa_flags = 0;
-}
-
-static sa_handler_t set_signal(int sig, sa_handler_t disp, bool is_sigset) {
-  sa_handler_t oldhandler;
-  bool sigused;
-
-  signal_lock();
-
-  sigused = sigismember(&jvmsigs, sig);
-  if (jvm_signal_installed && sigused) {
-    /* jvm has installed its signal handler for this signal. */
-    /* Save the handler. Don't really install it. */
-    oldhandler = sact[sig].sa_handler;
-    save_signal_handler(sig, disp);
-
-    signal_unlock();
-    return oldhandler;
-  } else if (jvm_signal_installing) {
-    /* jvm is installing its signal handlers. Install the new
-     * handlers and save the old ones. jvm uses sigaction().
-     * Leave the piece here just in case. */
-    oldhandler = call_os_signal(sig, disp, is_sigset);
-    save_signal_handler(sig, oldhandler);
-
-    /* Record the signals used by jvm */
-    sigaddset(&jvmsigs, sig);
-
-    signal_unlock();
-    return oldhandler;
-  } else {
-    /* jvm has no relation with this signal (yet). Install the
-     * the handler. */
-    oldhandler = call_os_signal(sig, disp, is_sigset);
-
-    signal_unlock();
-    return oldhandler;
-  }
-}
-
-JNIEXPORT sa_handler_t JNICALL
-signal(int sig, sa_handler_t disp) {
-  return set_signal(sig, disp, false);
-}
-
-JNIEXPORT sa_handler_t JNICALL
-sigset(int sig, sa_handler_t disp) {
-  return set_signal(sig, disp, true);
-}
-
-static int call_os_sigaction(int sig, const struct sigaction  *act,
-                             struct sigaction *oact) {
-  if (os_sigaction == NULL) {
-    // Aix: call functions directly instead of dlsym'ing them.
-    os_sigaction = sigaction;
-    if (os_sigaction == NULL) {
-      printf("%s\n", dlerror());
-      exit(0);
-    }
-  }
-  return (*os_sigaction)(sig, act, oact);
-}
-
-JNIEXPORT int JNICALL
-sigaction(int sig, const struct sigaction *act, struct sigaction *oact) {
-  int res;
-  bool sigused;
-  struct sigaction oldAct;
-
-  signal_lock();
-
-  sigused = sigismember(&jvmsigs, sig);
-  if (jvm_signal_installed && sigused) {
-    /* jvm has installed its signal handler for this signal. */
-    /* Save the handler. Don't really install it. */
-    if (oact != NULL) {
-      *oact = sact[sig];
-    }
-    if (act != NULL) {
-      sact[sig] = *act;
-    }
-
-    signal_unlock();
-    return 0;
-  } else if (jvm_signal_installing) {
-    /* jvm is installing its signal handlers. Install the new
-     * handlers and save the old ones. */
-    res = call_os_sigaction(sig, act, &oldAct);
-    sact[sig] = oldAct;
-    if (oact != NULL) {
-      *oact = oldAct;
-    }
-
-    /* Record the signals used by jvm. */
-    sigaddset(&jvmsigs, sig);
-
-    signal_unlock();
-    return res;
-  } else {
-    /* jvm has no relation with this signal (yet). Install the
-     * the handler. */
-    res = call_os_sigaction(sig, act, oact);
-
-    signal_unlock();
-    return res;
-  }
-}
-
-/* The three functions for the jvm to call into. */
-JNIEXPORT void JNICALL
-JVM_begin_signal_setting() {
-  signal_lock();
-  sigemptyset(&jvmsigs);
-  jvm_signal_installing = true;
-  tid = pthread_self();
-  signal_unlock();
-}
-
-JNIEXPORT void JNICALL
-JVM_end_signal_setting() {
-  signal_lock();
-  jvm_signal_installed = true;
-  jvm_signal_installing = false;
-  pthread_cond_broadcast(&cond);
-  signal_unlock();
-}
-
-JNIEXPORT struct sigaction * JNICALL
-JVM_get_signal_action(int sig) {
-  /* Does race condition make sense here? */
-  if (sigismember(&jvmsigs, sig)) {
-    return &sact[sig];
-  }
-  return NULL;
-}
--- a/src/java.base/share/classes/java/net/SocketOutputStream.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/java/net/SocketOutputStream.java	Fri Jun 08 09:40:28 2018 -0700
@@ -109,10 +109,6 @@
         try {
             socketWrite0(fd, b, off, len);
         } catch (SocketException se) {
-            if (se instanceof sun.net.ConnectionResetException) {
-                impl.setConnectionReset();
-                se = new SocketException("Connection reset");
-            }
             if (impl.isClosedOrPending()) {
                 throw new SocketException("Socket closed");
             } else {
--- a/src/java.base/share/classes/java/nio/channels/SelectionKey.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/java/nio/channels/SelectionKey.java	Fri Jun 08 09:40:28 2018 -0700
@@ -190,6 +190,83 @@
     public abstract SelectionKey interestOps(int ops);
 
     /**
+     * Atomically sets this key's interest set to the bitwise union ("or") of
+     * the existing interest set and the given value. This method is guaranteed
+     * to be atomic with respect to other concurrent calls to this method or to
+     * {@link #interestOpsAnd(int)}.
+     *
+     * <p> This method may be invoked at any time.  If this method is invoked
+     * while a selection operation is in progress then it has no effect upon
+     * that operation; the change to the key's interest set will be seen by the
+     * next selection operation.
+     *
+     * @implSpec The default implementation synchronizes on this key and invokes
+     * {@code interestOps()} and {@code interestOps(int)} to retrieve and set
+     * this key's interest set.
+     *
+     * @param  ops  The interest set to apply
+     *
+     * @return  The previous interest set
+     *
+     * @throws  IllegalArgumentException
+     *          If a bit in the set does not correspond to an operation that
+     *          is supported by this key's channel, that is, if
+     *          {@code (ops & ~channel().validOps()) != 0}
+     *
+     * @throws  CancelledKeyException
+     *          If this key has been cancelled
+     *
+     * @since 11
+     */
+    public int interestOpsOr(int ops) {
+        synchronized (this) {
+            int oldVal = interestOps();
+            interestOps(oldVal | ops);
+            return oldVal;
+        }
+    }
+
+    /**
+     * Atomically sets this key's interest set to the bitwise intersection ("and")
+     * of the existing interest set and the given value. This method is guaranteed
+     * to be atomic with respect to other concurrent calls to this method or to
+     * {@link #interestOpsOr(int)}.
+     *
+     * <p> This method may be invoked at any time.  If this method is invoked
+     * while a selection operation is in progress then it has no effect upon
+     * that operation; the change to the key's interest set will be seen by the
+     * next selection operation.
+     *
+     * @apiNote Unlike the {@code interestOps(int)} and {@code interestOpsOr(int)}
+     * methods, this method does not throw {@code IllegalArgumentException} when
+     * invoked with bits in the interest set that do not correspond to an
+     * operation that is supported by this key's channel. This is to allow
+     * operation bits in the interest set to be cleared using bitwise complement
+     * values, e.g., {@code interestOpsAnd(~SelectionKey.OP_READ)} will remove
+     * the {@code OP_READ} from the interest set without affecting other bits.
+     *
+     * @implSpec The default implementation synchronizes on this key and invokes
+     * {@code interestOps()} and {@code interestOps(int)} to retrieve and set
+     * this key's interest set.
+     *
+     * @param  ops  The interest set to apply
+     *
+     * @return  The previous interest set
+     *
+     * @throws  CancelledKeyException
+     *          If this key has been cancelled
+     *
+     * @since 11
+     */
+    public int interestOpsAnd(int ops) {
+        synchronized (this) {
+            int oldVal = interestOps();
+            interestOps(oldVal & ops);
+            return oldVal;
+        }
+    }
+
+    /**
      * Retrieves this key's ready-operation set.
      *
      * <p> It is guaranteed that the returned set will only contain operation
--- a/src/java.base/share/classes/java/nio/file/Files.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/java/nio/file/Files.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -1391,8 +1391,9 @@
      *          specific exception)</i>
      * @throws  DirectoryNotEmptyException
      *          the {@code REPLACE_EXISTING} option is specified but the file
-     *          cannot be replaced because it is a non-empty directory
-     *          <i>(optional specific exception)</i>
+     *          cannot be replaced because it is a non-empty directory, or the
+     *          source is a non-empty directory containing entries that would
+     *          be required to be moved <i>(optional specific exceptions)</i>
      * @throws  AtomicMoveNotSupportedException
      *          if the options array contains the {@code ATOMIC_MOVE} option but
      *          the file cannot be moved as an atomic file system operation.
--- a/src/java.base/share/classes/java/util/jar/JarFile.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -93,10 +93,14 @@
  * argument.  This assures that classes compatible with the major
  * version of the running JVM are loaded from multi-release jar files.
  *
- * <p>If the verify flag is on when opening a signed jar file, the content of
- * the file is verified against its signature embedded inside the file. Please
- * note that the verification process does not include validating the signer's
- * certificate. A caller should inspect the return value of
+ * <p> If the {@code verify} flag is on when opening a signed jar file, the content
+ * of the jar entry is verified against the signature embedded inside the manifest
+ * that is associated with its {@link JarEntry#getRealName() path name}. For a
+ * multi-release jar file, the content of a versioned entry is verfieid against
+ * its own signature and {@link JarEntry#getCodeSigners()} returns its own signers.
+ *
+ * Please note that the verification process does not include validating the
+ * signer's certificate. A caller should inspect the return value of
  * {@link JarEntry#getCodeSigners()} to further determine if the signature
  * can be trusted.
  *
--- a/src/java.base/share/classes/java/util/jar/Manifest.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -393,7 +393,27 @@
                 off += n;
                 total += n;
                 pos = tpos;
-                if (c == '\n' || c == '\r') {
+                c = tbuf[tpos-1];
+                if (c == '\n') {
+                    break;
+                }
+                if (c == '\r') {
+                    if (count == pos) {
+                        // try to see if there is a trailing LF
+                        fill();
+                        if (pos < count && tbuf[pos] == '\n') {
+                            if (total < len) {
+                                b[off++] = '\n';
+                                total++;
+                            } else {
+                                // we should always have big enough lbuf but
+                                // just in case we don't, replace the last CR
+                                // with LF.
+                                b[off - 1] = '\n';
+                            }
+                            pos++;
+                        }
+                    }
                     break;
                 }
             }
--- a/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/sun/launcher/LauncherHelper.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -502,12 +502,13 @@
     }
 
     // From src/share/bin/java.c:
-    //   enum LaunchMode { LM_UNKNOWN = 0, LM_CLASS, LM_JAR, LM_MODULE }
+    //   enum LaunchMode { LM_UNKNOWN = 0, LM_CLASS, LM_JAR, LM_MODULE, LM_SOURCE }
 
     private static final int LM_UNKNOWN = 0;
     private static final int LM_CLASS   = 1;
     private static final int LM_JAR     = 2;
     private static final int LM_MODULE  = 3;
+    private static final int LM_SOURCE  = 4;
 
     static void abort(Throwable t, String msgKey, Object... args) {
         if (msgKey != null) {
@@ -538,13 +539,21 @@
      *
      * @return the application's main class
      */
+    @SuppressWarnings("fallthrough")
     public static Class<?> checkAndLoadMain(boolean printToStderr,
                                             int mode,
                                             String what) {
         initOutput(printToStderr);
 
-        Class<?> mainClass = (mode == LM_MODULE) ? loadModuleMainClass(what)
-                                                 : loadMainClass(mode, what);
+        Class<?> mainClass = null;
+        switch (mode) {
+            case LM_MODULE: case LM_SOURCE:
+                mainClass = loadModuleMainClass(what);
+                break;
+            default:
+                mainClass = loadMainClass(mode, what);
+                break;
+        }
 
         // record the real main class for UI purposes
         // neither method above can return null, they will abort()
--- a/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2007, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,13 +25,17 @@
 
 # Translators please note do not translate the options themselves
 java.launcher.opt.header  =   Usage: {0} [options] <mainclass> [args...]\n\
-\           (to execute a class)\n   or  {0} [options] -jar <jarfile> [args...]\n\
+\           (to execute a class)\n\
+\   or  {0} [options] -jar <jarfile> [args...]\n\
 \           (to execute a jar file)\n\
 \   or  {0} [options] -m <module>[/<mainclass>] [args...]\n\
 \       {0} [options] --module <module>[/<mainclass>] [args...]\n\
-\           (to execute the main class in a module)\n\n\
-\ Arguments following the main class, -jar <jarfile>, -m or --module\n\
-\ <module>/<mainclass> are passed as the arguments to main class.\n\n\
+\           (to execute the main class in a module)\n\
+\   or  {0} [options] <sourcefile> [args]\n\
+\           (to execute a single source-file program)\n\n\
+\ Arguments following the main class, source file, -jar <jarfile>,\n\
+\ -m or --module <module>/<mainclass> are passed as the arguments to\n\
+\ main class.\n\n\
 \ where options include:\n\n
 
 java.launcher.opt.vmselect   =\    {0}\t  to select the "{1}" VM\n
@@ -114,7 +118,7 @@
 \    -disable-@files\n\
 \                  prevent further argument file expansion\n\
 \    --enable-preview\n\
-\                  allow classes to depend on preview features of this release
+\                  allow classes to depend on preview features of this release\n\
 \To specify an argument for a long option, you can use --<name>=<value> or\n\
 \--<name> <value>.\n
 
@@ -176,7 +180,9 @@
 \    --patch-module <module>=<file>({0}<file>)*\n\
 \                      override or augment a module with classes and resources\n\
 \                      in JAR files or directories.\n\
-\    --disable-@files  disable further argument file expansion\n\n\
+\    --disable-@files  disable further argument file expansion\n\
+\    --source <version>\n\
+\                      set the version of the source in source-file mode.\n\n\
 These extra options are subject to change without notice.\n
 
 # Translators please note do not translate the options themselves
--- a/src/java.base/share/classes/sun/nio/ch/SelectionKeyImpl.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/sun/nio/ch/SelectionKeyImpl.java	Fri Jun 08 09:40:28 2018 -0700
@@ -25,6 +25,9 @@
 
 package sun.nio.ch;
 
+import java.lang.invoke.ConstantBootstraps;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.VarHandle;
 import java.nio.channels.CancelledKeyException;
 import java.nio.channels.SelectableChannel;
 import java.nio.channels.SelectionKey;
@@ -39,6 +42,13 @@
 public final class SelectionKeyImpl
     extends AbstractSelectionKey
 {
+    private static final VarHandle INTERESTOPS =
+            ConstantBootstraps.fieldVarHandle(
+                    MethodHandles.lookup(),
+                    "interestOps",
+                    VarHandle.class,
+                    SelectionKeyImpl.class, int.class);
+
     private final SelChImpl channel;
     private final SelectorImpl selector;
 
@@ -84,7 +94,35 @@
     @Override
     public SelectionKey interestOps(int ops) {
         ensureValid();
-        return nioInterestOps(ops);
+        if ((ops & ~channel().validOps()) != 0)
+            throw new IllegalArgumentException();
+        int oldOps = (int) INTERESTOPS.getAndSet(this, ops);
+        if (ops != oldOps) {
+            selector.setEventOps(this);
+        }
+        return this;
+    }
+
+    @Override
+    public int interestOpsOr(int ops) {
+        ensureValid();
+        if ((ops & ~channel().validOps()) != 0)
+            throw new IllegalArgumentException();
+        int oldVal = (int) INTERESTOPS.getAndBitwiseOr(this, ops);
+        if (oldVal != (oldVal | ops)) {
+            selector.setEventOps(this);
+        }
+        return oldVal;
+    }
+
+    @Override
+    public int interestOpsAnd(int ops) {
+        ensureValid();
+        int oldVal = (int) INTERESTOPS.getAndBitwiseAnd(this, ops);
+        if (oldVal != (oldVal & ops)) {
+            selector.setEventOps(this);
+        }
+        return oldVal;
     }
 
     @Override
--- a/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -178,6 +178,7 @@
 MNT=MNT
 MOP=MOP
 MRO=MRO
+MRU=MRU
 MTL=MTL
 MUR=MUR
 MVR=MVR
@@ -399,6 +400,7 @@
 mnt=Mongolian Tugrik
 mop=Macanese Pataca
 mro=Mauritanian Ouguiya
+mru=Mauritanian Ouguiya
 mtl=Maltese Lira
 mur=Mauritian Rupee
 mvr=Maldivian Rufiyaa
--- a/src/java.base/share/native/launcher/main.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/native/launcher/main.c	Fri Jun 08 09:40:28 2018 -0700
@@ -183,7 +183,7 @@
         }
         // Iterate the rest of command line
         for (i = 1; i < argc; i++) {
-            JLI_List argsInFile = JLI_PreprocessArg(argv[i]);
+            JLI_List argsInFile = JLI_PreprocessArg(argv[i], JNI_TRUE);
             if (NULL == argsInFile) {
                 JLI_List_add(args, JLI_StringDup(argv[i]));
             } else {
--- a/src/java.base/share/native/libjli/args.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/native/libjli/args.c	Fri Jun 08 09:40:28 2018 -0700
@@ -79,6 +79,11 @@
 static jboolean stopExpansion = JNI_FALSE;
 static jboolean relaunch = JNI_FALSE;
 
+/*
+ * Prototypes for internal functions.
+ */
+static jboolean expand(JLI_List args, const char *str, const char *var_name);
+
 JNIEXPORT void JNICALL
 JLI_InitArgProcessing(jboolean hasJavaArgs, jboolean disableArgFile) {
     // No expansion for relaunch
@@ -300,6 +305,8 @@
 
     ctx.state = FIND_NEXT;
     ctx.parts = JLI_List_new(4);
+    // initialize to avoid -Werror=maybe-uninitialized issues from gcc 7.3 onwards.
+    ctx.quote_char = '"';
 
     /* arbitrarily pick 8, seems to be a reasonable number of arguments */
     rv = JLI_List_new(8);
@@ -376,9 +383,22 @@
     return rv;
 }
 
+/*
+ * expand a string into a list of words separated by whitespace.
+ */
+static JLI_List expandArg(const char *arg) {
+    JLI_List rv;
+
+    /* arbitrarily pick 8, seems to be a reasonable number of arguments */
+    rv = JLI_List_new(8);
+
+    expand(rv, arg, NULL);
+
+    return rv;
+}
+
 JNIEXPORT JLI_List JNICALL
-JLI_PreprocessArg(const char *arg)
-{
+JLI_PreprocessArg(const char *arg, jboolean expandSourceOpt) {
     JLI_List rv;
 
     if (firstAppArgIndex > 0) {
@@ -392,6 +412,12 @@
         return NULL;
     }
 
+    if (expandSourceOpt
+            && JLI_StrCCmp(arg, "--source") == 0
+            && JLI_StrChr(arg, ' ') != NULL) {
+        return expandArg(arg);
+    }
+
     if (arg[0] != '@') {
         checkArg(arg);
         return NULL;
@@ -435,9 +461,6 @@
 JNIEXPORT jboolean JNICALL
 JLI_AddArgsFromEnvVar(JLI_List args, const char *var_name) {
     char *env = getenv(var_name);
-    char *p, *arg;
-    char quote;
-    JLI_List argsInFile;
 
     if (firstAppArgIndex == 0) {
         // Not 'java', return
@@ -453,44 +476,64 @@
     }
 
     JLI_ReportMessage(ARG_INFO_ENVVAR, var_name, env);
+    return expand(args, env, var_name);
+}
+
+/*
+ * Expand a string into a list of args.
+ * If the string is the result of looking up an environment variable,
+ * var_name should be set to the name of that environment variable,
+ * for use if needed in error messages.
+ */
+
+static jboolean expand(JLI_List args, const char *str, const char *var_name) {
+    jboolean inEnvVar = (var_name != NULL);
+
+    char *p, *arg;
+    char quote;
+    JLI_List argsInFile;
 
     // This is retained until the process terminates as it is saved as the args
-    p = JLI_MemAlloc(JLI_StrLen(env) + 1);
-    while (*env != '\0') {
-        while (*env != '\0' && isspace(*env)) {
-            env++;
+    p = JLI_MemAlloc(JLI_StrLen(str) + 1);
+    while (*str != '\0') {
+        while (*str != '\0' && isspace(*str)) {
+            str++;
         }
 
         // Trailing space
-        if (*env == '\0') {
+        if (*str == '\0') {
             break;
         }
 
         arg = p;
-        while (*env != '\0' && !isspace(*env)) {
-            if (*env == '"' || *env == '\'') {
-                quote = *env++;
-                while (*env != quote && *env != '\0') {
-                    *p++ = *env++;
+        while (*str != '\0' && !isspace(*str)) {
+            if (inEnvVar && (*str == '"' || *str == '\'')) {
+                quote = *str++;
+                while (*str != quote && *str != '\0') {
+                    *p++ = *str++;
                 }
 
-                if (*env == '\0') {
+                if (*str == '\0') {
                     JLI_ReportMessage(ARG_ERROR8, var_name);
                     exit(1);
                 }
-                env++;
+                str++;
             } else {
-                *p++ = *env++;
+                *p++ = *str++;
             }
         }
 
         *p++ = '\0';
 
-        argsInFile = JLI_PreprocessArg(arg);
+        argsInFile = JLI_PreprocessArg(arg, JNI_FALSE);
 
         if (NULL == argsInFile) {
             if (isTerminalOpt(arg)) {
-                JLI_ReportMessage(ARG_ERROR9, arg, var_name);
+                if (inEnvVar) {
+                    JLI_ReportMessage(ARG_ERROR9, arg, var_name);
+                } else {
+                    JLI_ReportMessage(ARG_ERROR15, arg);
+                }
                 exit(1);
             }
             JLI_List_add(args, arg);
@@ -501,7 +544,11 @@
             for (idx = 0; idx < cnt; idx++) {
                 arg = argsInFile->elements[idx];
                 if (isTerminalOpt(arg)) {
-                    JLI_ReportMessage(ARG_ERROR10, arg, argFile, var_name);
+                    if (inEnvVar) {
+                        JLI_ReportMessage(ARG_ERROR10, arg, argFile, var_name);
+                    } else {
+                        JLI_ReportMessage(ARG_ERROR16, arg, argFile);
+                    }
                     exit(1);
                 }
                 JLI_List_add(args, arg);
@@ -517,11 +564,15 @@
          * caught now.
          */
         if (firstAppArgIndex != NOT_FOUND) {
-            JLI_ReportMessage(ARG_ERROR11, var_name);
+            if (inEnvVar) {
+                JLI_ReportMessage(ARG_ERROR11, var_name);
+            } else {
+                JLI_ReportMessage(ARG_ERROR17);
+            }
             exit(1);
         }
 
-        assert (*env == '\0' || isspace(*env));
+        assert (*str == '\0' || isspace(*str));
     }
 
     return JNI_TRUE;
@@ -642,7 +693,7 @@
 
     if (argc > 1) {
         for (i = 0; i < argc; i++) {
-            JLI_List tokens = JLI_PreprocessArg(argv[i]);
+            JLI_List tokens = JLI_PreprocessArg(argv[i], JNI_FALSE);
             if (NULL != tokens) {
                 for (j = 0; j < tokens->size; j++) {
                     printf("Token[%lu]: <%s>\n", (unsigned long) j, tokens->elements[j]);
--- a/src/java.base/share/native/libjli/emessages.h	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/native/libjli/emessages.h	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,11 @@
 #define ARG_ERROR10     "Error: Option %s in %s is not allowed in environment variable %s"
 #define ARG_ERROR11     "Error: Cannot specify main class in environment variable %s"
 #define ARG_ERROR12     "Error: %s requires module name"
+#define ARG_ERROR13     "Error: %s requires source version"
+#define ARG_ERROR14     "Error: Option %s is not allowed with --source"
+#define ARG_ERROR15     "Error: Option %s is not allowed in this context"
+#define ARG_ERROR16     "Error: Option %s in %s is not allowed in this context"
+#define ARG_ERROR17     "Error: Cannot specify main class in this context"
 
 #define JVM_ERROR1      "Error: Could not create the Java Virtual Machine.\n" GEN_ERROR
 #define JVM_ERROR2      "Error: Could not detach main thread.\n" JNI_ERROR
--- a/src/java.base/share/native/libjli/java.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/native/libjli/java.c	Fri Jun 08 09:40:28 2018 -0700
@@ -172,6 +172,9 @@
 static void FreeKnownVMs();
 static jboolean IsWildCardEnabled();
 
+
+#define SOURCE_LAUNCHER_MAIN_ENTRY "jdk.compiler/com.sun.tools.javac.launcher.Main"
+
 /*
  * This reports error.  VM will not be created and no usage is printed.
  */
@@ -214,7 +217,7 @@
  * Entry point.
  */
 JNIEXPORT int JNICALL
-JLI_Launch(int argc, char ** argv,              /* main argc, argc */
+JLI_Launch(int argc, char ** argv,              /* main argc, argv */
         int jargc, const char** jargv,          /* java args */
         int appclassc, const char** appclassv,  /* app classpath */
         const char* fullversion,                /* full version defined */
@@ -317,8 +320,7 @@
     /* Parse command line options; if the return value of
      * ParseArguments is false, the program should exit.
      */
-    if (!ParseArguments(&argc, &argv, &mode, &what, &ret, jrepath))
-    {
+    if (!ParseArguments(&argc, &argv, &mode, &what, &ret, jrepath)) {
         return(ret);
     }
 
@@ -585,7 +587,8 @@
     return IsClassPathOption(name) ||
            IsLauncherMainOption(name) ||
            JLI_StrCmp(name, "--describe-module") == 0 ||
-           JLI_StrCmp(name, "-d") == 0;
+           JLI_StrCmp(name, "-d") == 0 ||
+           JLI_StrCmp(name, "--source") == 0;
 }
 
 /*
@@ -627,6 +630,29 @@
 }
 
 /*
+ * Check if it is OK to set the mode.
+ * If the mode was previously set, and should not be changed,
+ * a fatal error is reported.
+ */
+static int
+checkMode(int mode, int newMode, const char *arg) {
+    if (mode == LM_SOURCE) {
+        JLI_ReportErrorMessage(ARG_ERROR14, arg);
+        exit(1);
+    }
+    return newMode;
+}
+
+/*
+ * Test if an arg identifies a source file.
+ */
+jboolean
+IsSourceFile(const char *arg) {
+    struct stat st;
+    return (JLI_HasSuffix(arg, ".java") && stat(arg, &st) == 0);
+}
+
+/*
  * Checks the command line options to find which JVM type was
  * specified.  If no command line option was given for the JVM type,
  * the default type is used.  The environment variable
@@ -1230,7 +1256,8 @@
         value = equals+1;
         if (JLI_StrCCmp(arg, "--describe-module=") == 0 ||
             JLI_StrCCmp(arg, "--module=") == 0 ||
-            JLI_StrCCmp(arg, "--class-path=") == 0) {
+            JLI_StrCCmp(arg, "--class-path=") == 0||
+            JLI_StrCCmp(arg, "--source=") == 0) {
             kind = LAUNCHER_OPTION_WITH_ARGUMENT;
         } else {
             kind = VM_LONG_OPTION;
@@ -1274,17 +1301,28 @@
  */
         if (JLI_StrCmp(arg, "-jar") == 0) {
             ARG_CHECK(argc, ARG_ERROR2, arg);
-            mode = LM_JAR;
+            mode = checkMode(mode, LM_JAR, arg);
         } else if (JLI_StrCmp(arg, "--module") == 0 ||
                    JLI_StrCCmp(arg, "--module=") == 0 ||
                    JLI_StrCmp(arg, "-m") == 0) {
             REPORT_ERROR (has_arg, ARG_ERROR5, arg);
             SetMainModule(value);
-            mode = LM_MODULE;
+            mode = checkMode(mode, LM_MODULE, arg);
             if (has_arg) {
                *pwhat = value;
                 break;
             }
+        } else if (JLI_StrCmp(arg, "--source") == 0 ||
+                   JLI_StrCCmp(arg, "--source=") == 0) {
+            REPORT_ERROR (has_arg, ARG_ERROR13, arg);
+            mode = LM_SOURCE;
+            if (has_arg) {
+                const char *prop = "-Djdk.internal.javac.source=";
+                size_t size = JLI_StrLen(prop) + JLI_StrLen(value) + 1;
+                char *propValue = (char *)JLI_MemAlloc(size);
+                JLI_Snprintf(propValue, size, "%s%s", prop, value);
+                AddOption(propValue, NULL);
+            }
         } else if (JLI_StrCmp(arg, "--class-path") == 0 ||
                    JLI_StrCCmp(arg, "--class-path=") == 0 ||
                    JLI_StrCmp(arg, "-classpath") == 0 ||
@@ -1435,12 +1473,25 @@
         if (!_have_classpath) {
             SetClassPath(".");
         }
-        mode = LM_CLASS;
+        mode = IsSourceFile(arg) ? LM_SOURCE : LM_CLASS;
+    } else if (mode == LM_CLASS && IsSourceFile(arg)) {
+        /* override LM_CLASS mode if given a source file */
+        mode = LM_SOURCE;
     }
 
-    if (argc >= 0) {
-        *pargc = argc;
-        *pargv = argv;
+    if (mode == LM_SOURCE) {
+        AddOption("--add-modules=ALL-DEFAULT", NULL);
+        *pwhat = SOURCE_LAUNCHER_MAIN_ENTRY;
+        // adjust (argc, argv) so that the name of the source file
+        // is included in the args passed to the source launcher
+        // main entry class
+        *pargc = argc + 1;
+        *pargv = argv - 1;
+    } else {
+        if (argc >= 0) {
+            *pargc = argc;
+            *pargv = argv;
+        }
     }
 
     *pmode = mode;
--- a/src/java.base/share/native/libjli/java.h	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/native/libjli/java.h	Fri Jun 08 09:40:28 2018 -0700
@@ -230,11 +230,12 @@
     LM_UNKNOWN = 0,
     LM_CLASS,
     LM_JAR,
-    LM_MODULE
+    LM_MODULE,
+    LM_SOURCE
 };
 
 static const char *launchModeNames[]
-    = { "Unknown", "Main class", "JAR file", "Module" };
+    = { "Unknown", "Main class", "JAR file", "Module", "Source" };
 
 typedef struct {
     int    argc;
--- a/src/java.base/share/native/libjli/jli_util.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/native/libjli/jli_util.c	Fri Jun 08 09:40:28 2018 -0700
@@ -84,6 +84,16 @@
     free(ptr);
 }
 
+jboolean
+JLI_HasSuffix(const char *s1, const char *s2)
+{
+    char *p = JLI_StrRChr(s1, '.');
+    if (p == NULL || *p == '\0') {
+        return JNI_FALSE;
+    }
+    return (JLI_StrCaseCmp(p, s2) == 0);
+}
+
 /*
  * debug helpers we use
  */
--- a/src/java.base/share/native/libjli/jli_util.h	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/share/native/libjli/jli_util.h	Fri Jun 08 09:40:28 2018 -0700
@@ -51,7 +51,8 @@
 JNIEXPORT void JNICALL
 JLI_MemFree(void *ptr);
 
-int   JLI_StrCCmp(const char *s1, const char* s2);
+int   JLI_StrCCmp(const char *s1, const char *s2);
+jboolean   JLI_HasSuffix(const char *s1, const char *s2);
 
 typedef struct {
     char *arg;
@@ -158,7 +159,7 @@
 JLI_InitArgProcessing(jboolean hasJavaArgs, jboolean disableArgFile);
 
 JNIEXPORT JLI_List JNICALL
-JLI_PreprocessArg(const char *arg);
+JLI_PreprocessArg(const char *arg, jboolean expandSourceOpt);
 
 JNIEXPORT jboolean JNICALL
 JLI_AddArgsFromEnvVar(JLI_List args, const char *var_name);
--- a/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -373,6 +373,22 @@
         }
     }
 
+    // throw a DirectoryNotEmpty exception if appropriate
+    static void ensureEmptyDir(UnixPath dir) throws IOException {
+        try {
+            long ptr = opendir(dir);
+            try (UnixDirectoryStream stream =
+                new UnixDirectoryStream(dir, ptr, e -> true)) {
+                if (stream.iterator().hasNext()) {
+                    throw new DirectoryNotEmptyException(
+                        dir.getPathForExceptionMessage());
+                }
+            }
+        } catch (UnixException e) {
+            e.rethrowAsIOException(dir);
+        }
+    }
+
     // move file from source to target
     static void move(UnixPath source, UnixPath target, CopyOption... options)
         throws IOException
@@ -465,6 +481,7 @@
 
         // copy source to target
         if (sourceAttrs.isDirectory()) {
+            ensureEmptyDir(source);
             copyDirectory(source, sourceAttrs, target, flags);
         } else {
             if (sourceAttrs.isSymbolicLink()) {
--- a/src/java.base/unix/native/libnet/SocketOutputStream.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/unix/native/libnet/SocketOutputStream.c	Fri Jun 08 09:40:28 2018 -0700
@@ -108,13 +108,8 @@
                     loff += n;
                     continue;
                 }
-                if (errno == ECONNRESET) {
-                    JNU_ThrowByName(env, "sun/net/ConnectionResetException",
-                        "Connection reset");
-                } else {
-                    JNU_ThrowByNameWithMessageAndLastError
-                        (env, "java/net/SocketException", "Write failed");
-                }
+                JNU_ThrowByNameWithMessageAndLastError
+                    (env, "java/net/SocketException", "Write failed");
                 if (bufP != BUF) {
                     free(bufP);
                 }
--- a/src/java.base/windows/classes/sun/nio/fs/WindowsFileCopy.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/windows/classes/sun/nio/fs/WindowsFileCopy.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -249,6 +249,17 @@
         }
     }
 
+    // throw a DirectoryNotEmpty exception if not empty
+    static void ensureEmptyDir(WindowsPath dir) throws IOException {
+        try (WindowsDirectoryStream dirStream =
+            new WindowsDirectoryStream(dir, (e) -> true)) {
+            if (dirStream.iterator().hasNext()) {
+                throw new DirectoryNotEmptyException(
+                    dir.getPathForExceptionMessage());
+            }
+        }
+    }
+
     /**
      * Move file from source to target
      */
@@ -407,6 +418,7 @@
         // create new directory or directory junction
         try {
             if (sourceAttrs.isDirectory()) {
+                ensureEmptyDir(source);
                 CreateDirectory(targetPath, 0L);
             } else {
                 String linkTarget = WindowsLinkSupport.readLink(source);
--- a/src/java.base/windows/native/libjava/TimeZone_md.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/windows/native/libjava/TimeZone_md.c	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -437,6 +437,8 @@
     char *mapFileName;
     char lineBuffer[MAX_ZONE_CHAR * 4];
     int noMapID = *mapID == '\0';       /* no mapID on Vista and later */
+    int offset = 0;
+    const char* errorMessage = "unknown error";
 
     mapFileName = malloc(strlen(java_home_dir) + strlen(MAPPINGS_FILE) + 1);
     if (mapFileName == NULL) {
@@ -472,10 +474,14 @@
             items[itemIndex] = start;
             while (*idx && *idx != ':') {
                 if (++idx >= endp) {
+                    errorMessage = "premature end of line";
+                    offset = (int)(idx - lineBuffer);
                     goto illegal_format;
                 }
             }
             if (*idx == '\0') {
+                errorMessage = "illegal null character found";
+                offset = (int)(idx - lineBuffer);
                 goto illegal_format;
             }
             *idx++ = '\0';
@@ -483,6 +489,8 @@
         }
 
         if (*idx != '\n') {
+            errorMessage = "illegal non-newline character found";
+            offset = (int)(idx - lineBuffer);
             goto illegal_format;
         }
 
@@ -516,7 +524,8 @@
 
  illegal_format:
     (void) fclose(fp);
-    jio_fprintf(stderr, "tzmappings: Illegal format at line %d.\n", line);
+    jio_fprintf(stderr, "Illegal format in tzmappings file: %s at line %d, offset %d.\n",
+                errorMessage, line, offset);
     return NULL;
 }
 
--- a/src/java.base/windows/native/libjli/cmdtoargs.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.base/windows/native/libjli/cmdtoargs.c	Fri Jun 08 09:40:28 2018 -0700
@@ -246,7 +246,7 @@
     // iterate through rest of command line
     while (src != NULL) {
         src = next_arg(src, arg, &wildcard);
-        argsInFile = JLI_PreprocessArg(arg);
+        argsInFile = JLI_PreprocessArg(arg, JNI_TRUE);
         if (argsInFile != NULL) {
             // resize to accommodate another Arg
             cnt = argsInFile->size;
--- a/src/java.desktop/macosx/native/libsplashscreen/libpng/zlib.h	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-/*
- * This header file is used to hijack the include of "zlib.h" from libpng on
- * Macos. We do that to be able to build on macos 10.13 or later, but still
- * keep binary compatibility with older versions (as specified to configure).
- *
- * The problem is that in 10.13, Macos shipped with a newer version of zlib,
- * which exports the function inflateValidate. There is a call to this
- * function in pngrutil.c, guarded by a preprocessor check of ZLIB_VERNUM being
- * high enough. If we compile this call in and link to the newer version of
- * zlib, we will get link errors if the code is executed on an older Mac with
- * an older version of zlib.
- *
- * The zlib.h header in Macos has been annotated with Macos specific macros that
- * guard these kinds of version specific APIs, but libpng is not using those
- * checks in its conditionals, just ZLIB_VERNUM. To fix this, we check for the
- * MAC_OS_X_VERSION_MIN_REQUIRED macro here and adjust the ZLIB_VERNUM to the
- # known version bundled with that release. This solution is certainly a hack,
- * but it seems the affected versions of zlib.h are compatible enough for this
- * to work.
- */
-
-#include <zlib.h>
-#include <AvailabilityMacros.h>
-
-#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
-#  undef ZLIB_VERNUM
-#  define ZLIB_VERNUM 0x1250
-#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_13
-#  undef ZLIB_VERNUM
-#  define ZLIB_VERNUM 0x1280
-#endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.desktop/macosx/native/libsplashscreen/libpng/zlibwrapper/zlib.h	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This header file is used to hijack the include of "zlib.h" from libpng on
+ * Macos. We do that to be able to build on macos 10.13 or later, but still
+ * keep binary compatibility with older versions (as specified to configure).
+ *
+ * The problem is that in 10.13, Macos shipped with a newer version of zlib,
+ * which exports the function inflateValidate. There is a call to this
+ * function in pngrutil.c, guarded by a preprocessor check of ZLIB_VERNUM being
+ * high enough. If we compile this call in and link to the newer version of
+ * zlib, we will get link errors if the code is executed on an older Mac with
+ * an older version of zlib.
+ *
+ * The zlib.h header in Macos has been annotated with Macos specific macros that
+ * guard these kinds of version specific APIs, but libpng is not using those
+ * checks in its conditionals, just ZLIB_VERNUM. To fix this, we check for the
+ * MAC_OS_X_VERSION_MIN_REQUIRED macro here and adjust the ZLIB_VERNUM to the
+ # known version bundled with that release. This solution is certainly a hack,
+ * but it seems the affected versions of zlib.h are compatible enough for this
+ * to work.
+ */
+
+#include <zlib.h>
+#include <AvailabilityMacros.h>
+
+#if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12
+#  undef ZLIB_VERNUM
+#  define ZLIB_VERNUM 0x1250
+#elif MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_13
+#  undef ZLIB_VERNUM
+#  define ZLIB_VERNUM 0x1280
+#endif
--- a/src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.desktop/share/native/libsplashscreen/java_awt_SplashScreen.c	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 #include <jni.h>
 #include <jni_util.h>
 #include <sizecalc.h>
+#include "java_awt_SplashScreen.h"
 
 JNIEXPORT jint JNICALL
 DEF_JNI_OnLoad(JavaVM * vm, void *reserved)
--- a/src/java.prefs/macosx/native/libprefs/MacOSXPreferencesFile.m	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.prefs/macosx/native/libprefs/MacOSXPreferencesFile.m	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,6 +63,7 @@
 #include "jni_util.h"
 #include "jlong.h"
 #include "jvm.h"
+#include "java_util_prefs_MacOSXPreferencesFile.h"
 
 /*
  * Declare library specific JNI_Onload entry if static build
--- a/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.prefs/unix/native/libprefs/FileSystemPreferences.c	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,6 +34,7 @@
 #include <errno.h>
 #include <utime.h>
 #include "jni_util.h"
+#include "java_util_prefs_FileSystemPreferences.h"
 
 /*
  * Declare library specific JNI_Onload entry if static build
--- a/src/java.prefs/windows/native/libprefs/WindowsPreferences.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.prefs/windows/native/libprefs/WindowsPreferences.c	Fri Jun 08 09:40:28 2018 -0700
@@ -28,6 +28,8 @@
 #include "jni.h"
 #include "jni_util.h"
 #include "jvm.h"
+#include "java_util_prefs_WindowsPreferences.h"
+
 #ifdef __cplusplus
 extern "C" {
 #endif
--- a/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.security.jgss/windows/native/libw2k_lsa_auth/NativeCreds.c	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,7 @@
 #include <jni.h>
 #include "jni_util.h"
 #include <winsock.h>
+#include "sun_security_krb5_Credentials.h"
 
 #undef LSA_SUCCESS
 #define LSA_SUCCESS(Status) ((Status) >= 0)
--- a/src/java.security.jgss/windows/native/libw2k_lsa_auth/WindowsDirectory.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/java.security.jgss/windows/native/libw2k_lsa_auth/WindowsDirectory.c	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
 #include <jni.h>
 #include <windows.h>
 #include <stdlib.h>
+#include "sun_security_krb5_Config.h"
 
 /*
  * Class:     sun_security_krb5_Config
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/package-info.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c)  2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ * Standard interfaces and base classes for JDBC <code>RowSet</code>
+ * implementations. This package contains interfaces and classes
+ * that a standard <code>RowSet</code> implementation either implements or extends.
+ *
+ * <h2>Table of Contents</h2>
+ * <ul>
+ * <li><a href="#pkgspec">1.0 Package Specification</a>
+ * <li><a href="#stdrowset">2.0 Standard RowSet Definitions</a>
+ * <li><a href="#impl">3.0 Implementer's Guide</a>
+ * <li><a href="#relspec">4.0 Related Specifications</a>
+ * <li><a href="#reldocs">5.0 Related Documentation</a>
+ * </ul>
+ *
+ * <h3><a id="pkgspec">1.0 Package Specification</a></h3>
+ * This package specifies five standard JDBC <code>RowSet</code> interfaces.
+ * All five extend the
+ * <a href="{@docRoot}/java.sql/javax/sql/RowSet.html">RowSet</a> interface described in the JDBC 3.0
+ * specification.  It is anticipated that additional definitions
+ * of more specialized JDBC <code>RowSet</code> types will emerge as this technology
+ * matures. Future definitions <i>should</i> be specified as subinterfaces using
+ * inheritance similar to the way it is used in this specification.
+ * <p>
+ * <i>Note:</i> The interface definitions provided in this package form the basis for
+ * all compliant JDBC <code>RowSet</code> implementations. Vendors and more advanced
+ * developers who intend to provide their own compliant <code>RowSet</code> implementations
+ * should pay particular attention to the assertions detailed in specification
+ * interfaces.
+ *
+ * <h3><a id="stdrowset">2.0 Standard RowSet Definitions</a></h3>
+ * <ul>
+ * <li><a href="JdbcRowSet.html"><b><code>JdbcRowSet</code></b></a> - A wrapper around
+ * a <code>ResultSet</code> object that makes it possible to use the result set as a
+ * JavaBeans&trade; component. Thus,
+ * a <code>JdbcRowSet</code> object can be a Bean that any tool
+ * makes available for assembling an application as part of a component based
+ * architecture. A <code>JdbcRowSet</code> object is a connected <code>RowSet</code>
+ * object, that is, it
+ * <b>must</b> continually maintain its connection to its data source using a JDBC
+ * technology-enabled driver ("JDBC driver"). In addition, a <code>JdbcRowSet</code>
+ * object provides a fully updatable and scrollable tabular
+ * data structure as defined in the JDBC 3.0 specification.
+ *
+ * <li><a href="CachedRowSet.html">
+ * <b><code>CachedRowSet</code>&trade;</b></a>
+ *  - A <code>CachedRowSet</code> object is a JavaBeans&trade;
+ * component that is scrollable, updatable, serializable, and generally disconnected from
+ * the source of its data. A <code>CachedRowSet</code> object
+ * typically contains rows from a result set, but it can also contain rows from any
+ * file with a tabular format, such as a spreadsheet. <code>CachedRowSet</code> implementations
+ * <b>must</b> use the <code>SyncFactory</code> to manage and obtain pluggable
+ * <code>SyncProvider</code> objects to provide synchronization between the
+ * disconnected <code>RowSet</code> object and the originating data source.
+ * Typically a <code>SyncProvider</code> implementation relies upon a JDBC
+ * driver to obtain connectivity to a particular data source.
+ * Further details on this mechanism are discussed in the <a
+ * href="spi/package-summary.html"><code>javax.sql.rowset.spi</code></a> package
+ * specification.
+ *
+ * <li><a href="WebRowSet.html"><b><code>WebRowSet</code></b></a> - A
+ * <code>WebRowSet</code> object is an extension of <code>CachedRowSet</code>
+ * that can read and write a <code>RowSet</code> object in a well formed XML format.
+ * This class calls an <a href="spi/XmlReader.html"><code>XmlReader</code></a> object
+ * (an extension of the <a href="{@docRoot}/java.sql/javax/sql/RowSetReader.html"><code>RowSetReader</code></a>
+ * interface) to read a rowset in XML format. It calls an
+ * <a href="spi/XmlWriter.html"><code>XmlWriter</code></a> object (an extension of the
+ * <a href="{@docRoot}/java.sql/javax/sql/RowSetWriter.html"><code>RowSetWriter</code></a> interface)
+ * to write a rowset in XML format. The reader and writer required by
+ * <code>WebRowSet</code> objects are provided by the
+ * <code>SyncFactory</code> in the form of <code>SyncProvider</code>
+ * implementations. In order to ensure well formed XML usage, a standard generic XML
+ * Schema is defined and published at
+ * <a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
+ * <code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
+ *
+ * <li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
+ * <code>FilteredRowSet</code> object provides filtering functionality in a programmatic
+ * and extensible way. There are many instances when a <code>RowSet</code> <code>object</code>
+ * has a need to provide filtering in its contents without sacrificing the disconnected
+ * environment, thus saving the expense of having to create a connection to the data source.
+ * Solutions to this need vary from providing heavyweight full scale
+ * SQL query abilities, to portable components, to more lightweight
+ * approaches. A <code>FilteredRowSet</code> object consumes
+ * an implementation of the <a href="Predicate.html"><code>Predicate</code></a>
+ * interface, which <b>may</b> define a filter at run time. In turn, a
+ * <code>FilteredRowSet</code> object is tasked with enforcing the set filter for both
+ * inbound and outbound read and write operations. That is, all filters can be
+ * considered as bi-directional. No standard filters are defined;
+ * however, sufficient mechanics are specified to permit any required filter to be
+ * implemented.
+ *
+ * <li><a href="JoinRowSet.html"><b><code>JoinRowSet</code></b></a> - The <code>JoinRowSet</code>
+ * interface  describes a mechanism by which relationships can be established between
+ * two or more standard <code>RowSet</code> implementations. Any number of <code>RowSet</code>
+ * objects can be added to a <code>JoinRowSet</code> object provided  the <code>RowSet</code>objects
+ * can be related  in a SQL <code>JOIN</code> like fashion. By definition, the SQL <code>JOIN</code>
+ * statement  is used to combine the data contained in two (<i>or more</i>) relational
+ * database tables based upon a common attribute. By establishing and then enforcing
+ * column matches, a <code>JoinRowSet</code> object establishes relationships between
+ * <code>RowSet</code> instances without the need to touch the originating data source.
+ * </ul>
+ *
+ * <h3><a id="impl">3.0 Implementer's Guide</a></h3>
+ * Compliant implementations of JDBC <code>RowSet</code> Implementations
+ * <b>must</b> follow the assertions described in this specification. In accordance
+ * with the terms of the <a href="http://www.jcp.org">Java Community Process</a>, a
+ * Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the
+ * specification. The following paragraphs outline a number of starting points for
+ * implementers of the standard JDBC <code>RowSet</code> definitions. Implementers
+ * should also consult the <i>Implementer's Guide</i> in the <a
+ * href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
+ * on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
+ *
+ * <ul>
+ * <li><b>3.1 Constructor</b>
+ * <p>
+ *   All <code>RowSet</code> implementations <strong>must</strong> provide a
+ * no-argument constructor.
+ * </li>
+ * <li><b>3.2 Role of the <code>BaseRowSet</code> Class</b>
+ * <p>
+ * A compliant JDBC <code>RowSet</code> implementation <b>must</b> implement one or more
+ * standard interfaces specified in this package and <b>may</b> extend the
+ * <a href="BaseRowSet.html"><code>BaseRowSet</code></a> abstract class. For example, a
+ * <code>CachedRowSet</code> implementation must implement the <code>CachedRowSet</code>
+ * interface and extend the <code>BaseRowSet</code> abstract class. The
+ * <code>BaseRowSet</code> class provides the standard architecture on which all
+ * <code>RowSet</code> implementations should be built, regardless of whether the
+ * <code>RowSet</code> objects exist in a connected or disconnected environment.
+ * The <code>BaseRowSet</code> abstract class provides any <code>RowSet</code> implementation
+ * with its base functionality, including property manipulation and event notification
+ * that is fully compliant with <a href="http://java.sun.com/products/javabeans">JavaBeans</a>
+ * component requirements. As an example, all implementations provided in the
+ * reference implementations (contained in the <code>com.sun.rowset</code> package) use
+ * the <code>BaseRowSet</code> class as a basis for their implementations.
+ * <P>
+ * The following table illustrates the features that the <code>BaseRowSet</code>
+ * abstract class provides.
+ * <blockquote>
+ *   <table class="striped" style="vertical-align:top; width:75%">
+ *     <caption>Features in <code>BaseRowSet</code></caption>
+ *         <thead>
+ *           <tr>
+ *             <th scope="col">Feature</th>
+ *             <th scope="col">Details</th>
+ *           </tr>
+ *         </thead>
+ *         <tbody>
+ *           <tr>
+ *             <th scope="row">Properties</th>
+ *             <td>Provides standard JavaBeans property manipulation
+ * mechanisms to allow applications to get and set <code>RowSet</code> command and
+ * property  values. Refer to the   documentation of the <code>javax.sql.RowSet</code>
+ * interface  (available in the JDBC 3.0 specification) for more details on
+ * the standard  <code>RowSet</code> properties.</td>
+ *           </tr>
+ *           <tr>
+ *             <th scope="row">Event notification</th>
+ *             <td>Provides standard JavaBeans event notifications
+ * to registered event listeners. Refer to the documentation of <code>javax.sql.RowSetEvent</code>
+ * interface (available in the JDBC 3.0 specification) for
+ * more details on how  to register and handle standard RowSet events generated
+ * by  compliant implementations.</td>
+ *           </tr>
+ *           <tr>
+ *             <th scope="row">Setters for a RowSet object's command</th>
+ *             <td>Provides a complete set of setter methods
+ *                for setting RowSet command parameters.</td>
+ *           </tr>
+ *           <tr>
+ *             <th scope="row">Streams</th>
+ *             <td>Provides fields for storing of stream instances
+ * in addition to providing a set of constants for stream type designation.</td>
+ *           </tr>
+ *     </tbody>
+ *   </table>
+ *   </blockquote>
+ *
+ * <li><b>3.3 Connected RowSet Requirements</b>
+ * <p>
+ * The <code>JdbcRowSet</code> describes a <code>RowSet</code> object that <b>must</b> always
+ * be connected to the originating data source. Implementations of the <code>JdbcRowSet</code>
+ * should ensure that this connection is provided solely by a JDBC driver.
+ * Furthermore, <code>RowSet</code> objects that are implementations of the
+ * <code>JdbcRowSet</code> interface and are therefore operating in a connected environment
+ * do not use the <code>SyncFactory</code> to obtain a <code>RowSetReader</code> object
+ * or a <code>RowSetWriter</code> object. They can safely rely on the JDBC driver to
+ * supply their needs by virtue of the presence of an underlying updatable and scrollable
+ * <code>ResultSet</code> implementation.
+ *
+ * <li>
+ * <b>3.4 Disconnected RowSet Requirements</b>
+ * <p>
+ * A disconnected <code>RowSet</code> object, such as a <code>CachedRowSet</code> object,
+ * <b>should</b> delegate
+ * connection management to a <code>SyncProvider</code> object provided by the
+ * <code>SyncFactory</code>. To ensure fully disconnected semantics, all
+ * disconnected <code>RowSet</code> objects <b>must</b> ensure
+ * that the original connection made to the data source to populate the <code>RowSet</code>
+ * object is closed to permit the garbage collector to recover and release resources. The
+ * <code>SyncProvider</code> object ensures that the critical JDBC properties are
+ * maintained in order to re-establish a connection to the data source when a
+ * synchronization is required. A disconnected <code>RowSet</code> object should
+ * therefore ensure that no
+ * extraneous references remain on the <code>Connection</code> object.
+ *
+ * <li><b>3.5 Role of RowSetMetaDataImpl</b>
+ * <p>
+ * The <code>RowsetMetaDataImpl</code> class is a utility class that provides an implementation of the
+ * <a href="{@docRoot}/java.sql/javax/sql/RowSetMetaData.html">RowSetMetaData</a> interface, supplying standard setter
+ * method implementations for metadata for both connected and disconnected
+ * <code>RowSet</code> objects. All implementations are free to use this standard
+ * implementation but are not required to do so.
+ *
+ * <li><b>3.6 RowSetWarning Class</b>
+ * <p>
+ * The <code>RowSetWarning</code> class provides warnings that can be set
+ * on <code>RowSet</code> implementations.
+ * Similar to <a href="{@docRoot}/java.sql/java/sql/SQLWarning.html">SQLWarning</a> objects,
+ * <code>RowSetWarning</code>  objects are silently chained to the object whose method
+ * caused the warning to be thrown. All <code>RowSet</code> implementations <b>should</b>
+ * ensure that this chaining occurs if a warning is generated and also ensure that the
+ * warnings are available via the <code>getRowSetWarnings</code> method defined in either
+ * the <code>JdbcRowSet</code> interface or the <code>CachedRowSet</code> interface.
+ * After a warning has been retrieved with one of the
+ * <code>getRowSetWarnings</code> methods, the <code>RowSetWarning</code> method
+ * <code>getNextWarning</code> can be called on it to retrieve any warnings that might
+ * be chained on it.  If a warning is returned, <code>getNextWarning</code> can be called
+ * on it, and so on until there are no more warnings.
+ *
+ * <li><b>3.7 The Joinable Interface</b>
+ * <P>
+ * The <code>Joinable</code> interface provides both connected and disconnected
+ * <code>RowSet</code> objects with the capability to be added to a
+ * <code>JoinRowSet</code> object in an SQL <code>JOIN</code> operation.
+ * A <code>RowSet</code> object that has  implemented the <code>Joinable</code>
+ * interface can set a match column, retrieve a match column, or unset a match column.
+ * A <code>JoinRowSet</code> object can then use the <code>RowSet</code> object's
+ * match column as a basis for adding the <code>RowSet</code> object.
+ * </li>
+ *
+ * <li><b>3.8 The RowSetFactory Interface</b>
+ *   <p>
+ *       A <code>RowSetFactory</code> implementation <strong>must</strong>
+ *       be provided.
+ * </li>
+ * </ul>
+ *
+ * <h3><a id="relspec">4.0 Related Specifications</a></h3>
+ * <ul>
+ * <li><a href="https://jcp.org/en/jsr/detail?id=221">JDBC 4.3 Specification</a>
+ * <li><a href="http://www.w3.org/XML/Schema">XML Schema</a>
+ * </ul>
+ *
+ * <h3><a id="reldocs">5.0 Related Documentation</a></h3>
+ * <ul>
+ * <li><a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/rowset.html">
+ * JDBC RowSet Tutorial</a>
+ *</ul>
+ */
+package javax.sql.rowset;
--- a/src/java.sql.rowset/share/classes/javax/sql/rowset/package.html	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,297 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
-
-  <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
-<!--
-Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--->
-  <title>javax.sql.rowset Package</title>
-</head>
-  <body>
-
-<!-- Description clause -->
-Standard interfaces and base classes for JDBC <code>RowSet</code>
-implementations. This package contains interfaces and classes 
-that a standard <code>RowSet</code> implementation either implements or extends.
-
-
-<h2>Table of Contents</h2>
-<ul>
-<li><a href="#pkgspec">1.0 Package Specification</a>
-<li><a href="#stdrowset">2.0 Standard RowSet Definitions</a>
-<li><a href="#impl">3.0 Implementer's Guide</a>
-<li><a href="#relspec">4.0 Related Specifications</a>
-<li><a href="#reldocs">5.0 Related Documentation</a>
-</ul>
-
-<h3><a id="pkgspec">1.0 Package Specification</a></h3>
-This package specifies five standard JDBC <code>RowSet</code> interfaces.
- All five extend the 
-<a href="../RowSet.html">RowSet</a> interface described in the JDBC 3.0
-specification.  It is anticipated that additional definitions
-of more specialized JDBC <code>RowSet</code> types will emerge as this technology
-matures. Future definitions <i>should</i> be specified as subinterfaces using
-inheritance similar to the way it is used in this specification.
-<p>
-<i>Note:</i> The interface definitions provided in this package form the basis for
-all compliant JDBC <code>RowSet</code> implementations. Vendors and more advanced
-developers who intend to provide their own compliant <code>RowSet</code> implementations
-should pay particular attention to the assertions detailed in specification
-interfaces. 
-
-<h3><a id="stdrowset">2.0 Standard RowSet Definitions</a></h3>
-<ul>
-<li><a href="JdbcRowSet.html"><b><code>JdbcRowSet</code></b></a> - A wrapper around
-a <code>ResultSet</code> object that makes it possible to use the result set as a
-JavaBeans&trade; component. Thus,
-a <code>JdbcRowSet</code> object can be a Bean that any tool
-makes available for assembling an application as part of a component based
-architecture. A <code>JdbcRowSet</code> object is a connected <code>RowSet</code>
-object, that is, it 
-<b>must</b> continually maintain its connection to its data source using a JDBC
-technology-enabled driver ("JDBC driver"). In addition, a <code>JdbcRowSet</code>
-object provides a fully updatable and scrollable tabular
-data structure as defined in the JDBC 3.0 specification.
-
-<li><a href="CachedRowSet.html">
-<b><code>CachedRowSet</code>&trade;</b></a>
- - A <code>CachedRowSet</code> object is a JavaBeans&trade;
- component that is scrollable, updatable, serializable, and generally disconnected from
- the source of its data. A <code>CachedRowSet</code> object
-typically contains rows from a result set, but it can also contain rows from any
-file with a tabular format, such as a spreadsheet. <code>CachedRowSet</code> implementations
-<b>must</b> use the <code>SyncFactory</code> to manage and obtain pluggable
-<code>SyncProvider</code> objects to provide synchronization between the
-disconnected <code>RowSet</code> object and the originating data source.
-Typically a <code>SyncProvider</code> implementation relies upon a JDBC
-driver to obtain connectivity to a particular data source.
-Further details on this mechanism are discussed in the <a
-href="spi/package-summary.html"><code>javax.sql.rowset.spi</code></a> package
-specification.
-
-<li><a href="WebRowSet.html"><b><code>WebRowSet</code></b></a> - A 
-<code>WebRowSet</code> object is an extension of <code>CachedRowSet</code>
-that can read and write a <code>RowSet</code> object in a well formed XML format.
-This class calls an <a href="spi/XmlReader.html"><code>XmlReader</code></a> object
-(an extension of the <a href="../RowSetReader.html"><code>RowSetReader</code></a>
-interface) to read a rowset in XML format. It calls an 
-<a href="spi/XmlWriter.html"><code>XmlWriter</code></a> object (an extension of the
-<a href="../RowSetWriter.html"><code>RowSetWriter</code></a> interface)
-to write a rowset in XML format. The reader and writer required by
-<code>WebRowSet</code> objects are provided by the
-<code>SyncFactory</code> in the form of <code>SyncProvider</code>
-implementations. In order to ensure well formed XML usage, a standard generic XML
-Schema is defined and published at
-<a href="http://java.sun.com/xml/ns/jdbc/webrowset.xsd">
-<code>http://java.sun.com/xml/ns/jdbc/webrowset.xsd</code></a>.
-
-<li><a href="FilteredRowSet.html"><b><code>FilteredRowSet</code></b></a> - A
-<code>FilteredRowSet</code> object provides filtering functionality in a programmatic
-and extensible way. There are many instances when a <code>RowSet</code> <code>object</code>
-has a need to provide filtering in its contents without sacrificing the disconnected
-environment, thus saving the expense of having to create a connection to the data source.
-Solutions to this need vary from providing heavyweight full scale 
-SQL query abilities, to portable components, to more lightweight 
-approaches. A <code>FilteredRowSet</code> object consumes
-an implementation of the <a href="Predicate.html"><code>Predicate</code></a>
-interface, which <b>may</b> define a filter at run time. In turn, a
-<code>FilteredRowSet</code> object is tasked with enforcing the set filter for both
-inbound and outbound read and write operations. That is, all filters can be
-considered as bi-directional. No standard filters are defined;
-however, sufficient mechanics are specified to permit any required filter to be
-implemented.
-
-<li><a href="JoinRowSet.html"><b><code>JoinRowSet</code></b></a> - The <code>JoinRowSet</code>
-interface  describes a mechanism by which relationships can be established between
-two or more standard <code>RowSet</code> implementations. Any number of <code>RowSet</code>
- objects can be added to a <code>JoinRowSet</code> object provided  the <code>RowSet</code>objects
-can be related  in a SQL <code>JOIN</code> like fashion. By definition, the SQL <code>JOIN</code>
-statement  is used to combine the data contained in two (<i>or more</i>) relational
-database tables based upon a common attribute. By establishing and then enforcing
-column matches, a <code>JoinRowSet</code> object establishes relationships between
-<code>RowSet</code> instances without the need to touch the originating data source.
-</ul>
-
-<h3><a id="impl">3.0 Implementer's Guide</a></h3>
-Compliant implementations of JDBC <code>RowSet</code> Implementations
-<b>must</b> follow the assertions described in this specification. In accordance
-with the terms of the <a href="http://www.jcp.org">Java Community Process</a>, a
-Test Compatibility Kit (TCK) can be licensed to ensure compatibility with the
-specification. The following paragraphs outline a number of starting points for
-implementers of the standard JDBC <code>RowSet</code> definitions. Implementers
-should also consult the <i>Implementer's Guide</i> in the <a
-href="spi/package-summary.html">javax.sql.rowset.spi</a> package for guidelines
-on <a href="spi/SyncProvider.html"><code>SyncProvider</code></a> implementations.
-
-<ul>
-<li><b>3.1 Constructor</b>
-<p>
-    All <code>RowSet</code> implementations <strong>must</strong> provide a
-no-argument constructor.
-</li>
-<li><b>3.2 Role of the <code>BaseRowSet</code> Class</b>
-<p>
-A compliant JDBC <code>RowSet</code> implementation <b>must</b> implement one or more
-standard interfaces specified in this package and <b>may</b> extend the
-<a href="BaseRowSet.html"><code>BaseRowSet</code></a> abstract class. For example, a
-<code>CachedRowSet</code> implementation must implement the <code>CachedRowSet</code>
-interface and extend the <code>BaseRowSet</code> abstract class. The
-<code>BaseRowSet</code> class provides the standard architecture on which all
-<code>RowSet</code> implementations should be built, regardless of whether the
-<code>RowSet</code> objects exist in a connected or disconnected environment.
-The <code>BaseRowSet</code> abstract class provides any <code>RowSet</code> implementation
-with its base functionality, including property manipulation and event notification
-that is fully compliant with <a href="http://java.sun.com/products/javabeans">JavaBeans</a>
-component requirements. As an example, all implementations provided in the
-reference implementations (contained in the <code>com.sun.rowset</code> package) use
-the <code>BaseRowSet</code> class as a basis for their implementations.
-<P>
-The following table illustrates the features that the <code>BaseRowSet</code>
-abstract class provides.
-  <blockquote>
-    <table class="striped" style="vertical-align:top; width:75%">
-	<caption>Features in <code>BaseRowSet</code></caption>
-          <thead>
-            <tr>
-              <th scope="col">Feature</th>
-              <th scope="col">Details</th>
-            </tr>
-          </thead>
-          <tbody>
-            <tr>
-              <th scope="row">Properties</th>
-              <td>Provides standard JavaBeans property manipulation
-mechanisms to allow applications to get and set <code>RowSet</code> command and
-property  values. Refer to the   documentation of the <code>javax.sql.RowSet</code>
-interface  (available in the JDBC 3.0 specification) for more details on
-the standard  <code>RowSet</code> properties.</td>
-            </tr>
-            <tr>
-              <th scope="row">Event notification</th>
-              <td>Provides standard JavaBeans event notifications
-to registered event listeners. Refer to the documentation of <code>javax.sql.RowSetEvent</code>
-interface (available in the JDBC 3.0 specification) for
-more details on how  to register and handle standard RowSet events generated
-by  compliant implementations.</td>
-            </tr>
-            <tr>
-              <th scope="row">Setters for a RowSet object's command</th>
-              <td>Provides a complete set of setter methods
-                 for setting RowSet command parameters.</td>
-            </tr>
-            <tr>
-              <th scope="row">Streams</th>
-              <td>Provides fields for storing of stream instances
-  in addition to providing a set of constants for stream type designation.</td>
-            </tr>
-      </tbody>
-    </table>
-    </blockquote>
-
-<li><b>3.3 Connected RowSet Requirements</b>
-<p>
-The <code>JdbcRowSet</code> describes a <code>RowSet</code> object that <b>must</b> always
-be connected to the originating data source. Implementations of the <code>JdbcRowSet</code>
-should ensure that this connection is provided solely by a JDBC driver.
-Furthermore, <code>RowSet</code> objects that are implementations of the
-<code>JdbcRowSet</code> interface and are therefore operating in a connected environment
-do not use the <code>SyncFactory</code> to obtain a <code>RowSetReader</code> object
-or a <code>RowSetWriter</code> object. They can safely rely on the JDBC driver to
-supply their needs by virtue of the presence of an underlying updatable and scrollable
-<code>ResultSet</code> implementation.
-
-<li>
-<b>3.4 Disconnected RowSet Requirements</b>
-<p> 
-A disconnected <code>RowSet</code> object, such as a <code>CachedRowSet</code> object,
-<b>should</b> delegate  
-connection management to a <code>SyncProvider</code> object provided by the
-<code>SyncFactory</code>. To ensure fully disconnected semantics, all
-disconnected <code>RowSet</code> objects <b>must</b> ensure
-that the original connection made to the data source to populate the <code>RowSet</code>
-object is closed to permit the garbage collector to recover and release resources. The
-<code>SyncProvider</code> object ensures that the critical JDBC properties are
-maintained in order to re-establish a connection to the data source when a
-synchronization is required. A disconnected <code>RowSet</code> object should
-therefore ensure that no
-extraneous references remain on the <code>Connection</code> object.
-
-<li><b>3.5 Role of RowSetMetaDataImpl</b>
-<p>
-The <code>RowsetMetaDataImpl</code> class is a utility class that provides an implementation of the
-<a href="../RowSetMetaData.html">RowSetMetaData</a> interface, supplying standard setter
-method implementations for metadata for both connected and disconnected
-<code>RowSet</code> objects. All implementations are free to use this standard
-implementation but are not required to do so.
-
-<li><b>3.6 RowSetWarning Class</b>
-<p>
-The <code>RowSetWarning</code> class provides warnings that can be set
-on <code>RowSet</code> implementations.
-Similar to <a href="../../../java/sql/SQLWarning.html">SQLWarning</a> objects,
-<code>RowSetWarning</code>  objects are silently chained to the object whose method
-caused the warning to be thrown. All <code>RowSet</code> implementations <b>should</b>
-ensure that this chaining occurs if a warning is generated and also ensure that the
-warnings are available via the <code>getRowSetWarnings</code> method defined in either
-the <code>JdbcRowSet</code> interface or the <code>CachedRowSet</code> interface.
-After a warning has been retrieved with one of the
-<code>getRowSetWarnings</code> methods, the <code>RowSetWarning</code> method
-<code>getNextWarning</code> can be called on it to retrieve any warnings that might
-be chained on it.  If a warning is returned, <code>getNextWarning</code> can be called
-on it, and so on until there are no more warnings.
-
-<li><b>3.7 The Joinable Interface</b>
-<P>
-The <code>Joinable</code> interface provides both connected and disconnected
-<code>RowSet</code> objects with the capability to be added to a
-<code>JoinRowSet</code> object in an SQL <code>JOIN</code> operation.
-A <code>RowSet</code> object that has  implemented the <code>Joinable</code>
-interface can set a match column, retrieve a match column, or unset a match column.
-A <code>JoinRowSet</code> object can then use the <code>RowSet</code> object's
-match column as a basis for adding the <code>RowSet</code> object.
-</li>
-
-<li><b>3.8 The RowSetFactory Interface</b>
-    <p>
-        A <code>RowSetFactory</code> implementation <strong>must</strong>
-        be provided.
-</li>
-</ul>
-
-<h3><a id="relspec">4.0 Related Specifications</a></h3>
-<ul>
-<li><a href="https://jcp.org/en/jsr/detail?id=221">JDBC 4.3 Specification</a>
-<li><a href="http://www.w3.org/XML/Schema">XML Schema</a>
-</ul>
-
-<h3><a id="reldocs">5.0 Related Documentation</a></h3>
-<ul>
-<li><a href="http://docs.oracle.com/javase/tutorial/jdbc/basics/rowset.html">
-JDBC RowSet Tutorial</a>
-</ul>
-</body>
-</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package-info.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,480 @@
+/*
+ * Copyright (c)  2003, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * 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.
+ */
+
+/**
+ * The standard classes and interfaces that a third party vendor has to
+ * use in its implementation of a synchronization provider. These classes and
+ * interfaces are referred to as the Service Provider Interface (SPI).  To make it possible
+ * for a <code>RowSet</code> object to use an implementation, the vendor must register
+ * it with the <code>SyncFactory</code> singleton. (See the class comment for
+ * <code>SyncProvider</code> for a full explanation of the registration process and
+ * the naming convention to be used.)
+ *
+ * <h2>Table of Contents</h2>
+ * <ul>
+ * <li><a href="#pkgspec">1.0 Package Specification</a>
+ * <li><a href="#arch">2.0 Service Provider Architecture</a>
+ * <li><a href="#impl">3.0 Implementer's Guide</a>
+ * <li><a href="#resolving">4.0 Resolving Synchronization Conflicts</a>
+ * <li><a href="#relspec">5.0 Related Specifications</a>
+ * <li><a href="#reldocs">6.0 Related Documentation</a>
+ * </ul>
+ *
+ * <h3><a id="pkgspec">1.0 Package Specification</a></h3>
+ * <P>
+ * The following classes and interfaces make up the <code>javax.sql.rowset.spi</code>
+ * package:
+ * <UL>
+ *  <LI><code>SyncFactory</code>
+ *  <LI><code>SyncProvider</code>
+ *  <LI><code>SyncFactoryException</code>
+ *  <LI><code>SyncProviderException</code>
+ *  <LI><code>SyncResolver</code>
+ *  <LI><code>XmlReader</code>
+ *  <LI><code>XmlWriter</code>
+ *  <LI><code>TransactionalWriter</code>
+ * </UL>
+ * The following interfaces, in the <code>javax.sql</code> package, are also part of the SPI:
+ * <UL>
+ *  <LI><code>RowSetReader</code>
+ *  <LI><code>RowSetWriter</code>
+ * </UL>
+ * <P>
+ * A <code>SyncProvider</code> implementation provides a disconnected <code>RowSet</code>
+ * object with the mechanisms for reading data into it and for writing data that has been
+ * modified in it
+ * back to the underlying data source.  A <i>reader</i>, a <code>RowSetReader</code> or
+ * <code>XMLReader</code> object, reads data into a <code>RowSet</code> object when the
+ * <code>CachedRowSet</code> methods <code>execute</code> or <code>populate</code>
+ * are called.  A <i>writer</i>, a <code>RowSetWriter</code> or <code>XMLWriter</code>
+ * object, writes changes back to the underlying data source when the
+ * <code>CachedRowSet</code> method <code>acceptChanges</code> is called.
+ * <P>
+ * The process of writing changes in a <code>RowSet</code> object to its data source
+ * is known as <i>synchronization</i>.  The <code>SyncProvider</code> implementation that a
+ * <code>RowSet</code> object is using determines the level of synchronization that the
+ * <code>RowSet</code> object's writer uses. The various levels of synchronization are
+ * referred to as <i>grades</i>.
+ * <P>
+ * The lower grades of synchronization are
+ * known as <i>optimistic</i> concurrency levels because they optimistically
+ * assume that there will be no conflicts or very few conflicts.  A conflict exists when
+ * the same data modified in the <code>RowSet</code> object has also been modified
+ * in the data source. Using the optimistic concurrency model means that if there
+ * is a conflict, modifications to either the data source or the <code>RowSet</code>
+ * object will be lost.
+ * <P>
+ * Higher grades of synchronization are called <i>pessimistic</i> because they assume
+ * that others will be accessing the data source and making modifications.  These
+ * grades set varying levels of locks to increase the chances that no conflicts
+ * occur.
+ * <P>
+ * The lowest level of synchronization is simply writing any changes made to the
+ * <code>RowSet</code> object to its underlying data source.  The writer does
+ * nothing to check for conflicts.
+ * If there is a conflict and the data
+ * source values are overwritten, the changes other parties have made by to the data
+ * source are lost.
+ * <P>
+ * The <code>RIXMLProvider</code> implementation uses the lowest level
+ * of synchronization and just writes <code>RowSet</code> changes to the data source.
+ *
+ * <P>
+ * For the next level up, the
+ * writer checks to see if there are any conflicts, and if there are,
+ * it does not write anything to the data source.  The problem with this concurrency
+ * level is that if another party has modified the corresponding data in the data source
+ * since the <code>RowSet</code> object got its data,
+ * the changes made to the <code>RowSet</code> object are lost. The
+ * <code>RIOptimisticProvider</code> implementation uses this level of synchronization.
+ * <P>
+ * At higher levels of synchronization, referred to as pessimistic concurrency,
+ * the writer take steps to avoid conflicts by setting locks. Setting locks
+ * can vary from setting a lock on a single row to setting a lock on a table
+ * or the entire data source. The level of synchronization is therefore a tradeoff
+ * between the ability of users to access the data source concurrently and the  ability
+ * of the writer to keep the data in the <code>RowSet</code> object and its data source
+ * synchronized.
+ * <P>
+ * It is a requirement that all disconnected <code>RowSet</code> objects
+ * (<code>CachedRowSet</code>, <code>FilteredRowSet</code>, <code>JoinRowSet</code>,
+ * and <code>WebRowSet</code> objects) obtain their <code>SyncProvider</code> objects
+ * from the <code>SyncFactory</code> mechanism.
+ * <P>
+ * The reference implementation (RI) provides two synchronization providers.
+ *    <UL>
+ *       <LI><b><code>RIOptimisticProvider</code></b> <br>
+ *            The default provider that the <code>SyncFactory</code> instance will
+ *            supply to a disconnected <code>RowSet</code> object when no provider
+ *            implementation is specified.<BR>
+ *            This synchronization provider uses an optimistic concurrency model,
+ *            assuming that there will be few conflicts among users
+ *            who are accessing the same data in a database.  It avoids
+ *            using locks; rather, it checks to see if there is a conflict
+ *            before trying to synchronize the <code>RowSet</code> object and the
+ *            data source. If there is a conflict, it does nothing, meaning that
+ *            changes to the <code>RowSet</code> object are not persisted to the data
+ *            source.
+ *        <LI><B><code>RIXMLProvider</code></B> <BR>
+ *             A synchronization provider that can be used with a
+ *             <code>WebRowSet</code> object, which is a rowset that can be written
+ *             in XML format or read from XML format. The
+ *             <code>RIXMLProvider</code> implementation does no checking at all for
+ *             conflicts and simply writes any updated data in the
+ *             <code>WebRowSet</code> object to the underlying data source.
+ *             <code>WebRowSet</code> objects use this provider when they are
+ *             dealing with XML data.
+ *     </UL>
+ *
+ *  These <code>SyncProvider</code> implementations
+ *  are bundled with the reference implementation, which makes them always available to
+ *  <code>RowSet</code> implementations.
+ *  <code>SyncProvider</code> implementations make themselves available by being
+ *  registered with the <code>SyncFactory</code> singleton.  When a <code>RowSet</code>
+ *  object requests a provider, by specifying it in the constructor or as an argument to the
+ *  <code>CachedRowSet</code> method <code>setSyncProvider</code>,
+ *  the <code>SyncFactory</code> singleton
+ *  checks to see if the requested provider has been registered with it.
+ *  If it has, the <code>SyncFactory</code> creates an instance of it and passes it to the
+ *  requesting <code>RowSet</code> object.
+ *  If the <code>SyncProvider</code> implementation that is specified has not been registered,
+ *  the <code>SyncFactory</code> singleton causes a <code>SyncFactoryException</code> object
+ *  to be thrown.  If no provider is specified,
+ *  the <code>SyncFactory</code> singleton will create an instance of the default
+ *  provider implementation, <code>RIOptimisticProvider</code>,
+ *  and pass it to the requesting <code>RowSet</code> object.
+ *
+ * <P>
+ * If a <code>WebRowSet</code> object does not specify a provider in its constructor, the
+ * <code>SyncFactory</code> will give it an instance of <code>RIOptimisticProvider</code>.
+ * However, the constructor for <code>WebRowSet</code> is implemented to set the provider
+ * to the <code>RIXMLProvider</code>, which reads and writes a <code>RowSet</code> object
+ *  in XML format.
+ *  <P>
+ * See the <a href="SyncProvider.html">SyncProvider</a> class
+ *  specification for further details.
+ * <p>
+ * Vendors may develop a <code>SyncProvider</code> implementation with any one of the possible
+ * levels of synchronization, thus giving <code>RowSet</code> objects a choice of
+ * synchronization mechanisms.
+ *
+ * <h3><a id="arch">2.0 Service Provider Interface Architecture</a></h3>
+ * <b>2.1 Overview</b>
+ * <p>
+ * The Service Provider Interface provides a pluggable mechanism by which
+ * <code>SyncProvider</code> implementations can be registered and then generated when
+ * required. The lazy reference mechanism employed by the <code>SyncFactory</code> limits
+ * unnecessary resource consumption by not creating an instance until it is
+ * required by a disconnected
+ * <code>RowSet</code> object. The <code>SyncFactory</code> class also provides
+ * a standard API to configure logging options and streams that <b>may</b> be provided
+ * by a particular <code>SyncProvider</code> implementation.
+ * <p>
+ * <b>2.2 Registering with the <code>SyncFactory</code></b>
+ * <p>
+ * A third party <code>SyncProvider</code> implementation must be registered with the
+ * <code>SyncFactory</code> in order for a disconnected <code>RowSet</code> object
+ * to obtain it and thereby use its <code>javax.sql.RowSetReader</code> and
+ * <code>javax.sql.RowSetWriter</code>
+ * implementations. The following registration mechanisms are available to all
+ * <code>SyncProvider</code> implementations:
+ * <ul>
+ * <li><b>System properties</b> - Properties set at the command line. These
+ * properties are set at run time and apply system-wide per invocation of the Java
+ * application. See the section <a href="#reldocs">"Related Documentation"</a>
+ * further related information.
+ *
+ * <li><b>Property Files</b> - Properties specified in a standard property file.
+ * This can be specified using a System Property or by modifying a standard
+ * property file located in the platform run-time. The
+ * reference implementation of this technology includes a standard property
+ * file than can be edited to add additional <code>SyncProvider</code> objects.
+ *
+ * <li><b>JNDI Context</b> - Available providers can be registered on a JNDI
+ * context. The <code>SyncFactory</code> will attempt to load <code>SyncProvider</code>
+ * objects bound to the context and register them with the factory. This
+ * context must be supplied to the <code>SyncFactory</code> for the mechanism to
+ * function correctly.
+ * </ul>
+ * <p>
+ * Details on how to specify the system properties or properties in a property file
+ * and how to configure the JNDI Context are explained in detail in the
+ * <a href="SyncFactory.html"><code>SyncFactory</code></a> class description.
+ * <p>
+ * <b>2.3 SyncFactory Provider Instance Generation Policies</b>
+ * <p>
+ * The <code>SyncFactory</code> generates a requested <code>SyncProvider</code>
+ * object if the provider has been correctly registered.  The
+ * following policies are adhered to when either a disconnected <code>RowSet</code> object
+ * is instantiated with a specified <code>SyncProvider</code> implementation or is
+ * reconfigured at runtime with an alternative <code>SyncProvider</code> object.
+ * <ul>
+ * <li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
+ * contains <i>no</i> reference to the provider, a <code>SyncFactoryException</code> is
+ * thrown.
+ *
+ * <li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
+ * contains a reference to the provider, the requested provider is supplied.
+ *
+ * <li> If no <code>SyncProvider</code> object is specified, the reference
+ * implementation provider <code>RIOptimisticProvider</code> is supplied.
+ * </ul>
+ * <p>
+ * These policies are explored in more detail in the <a href="SyncFactory.html">
+ * <code>SyncFactory</code></a> class.
+ *
+ * <h3><a id="impl">3.0 SyncProvider Implementer's Guide</a></h3>
+ *
+ * <b>3.1 Requirements</b>
+ * <p>
+ * A compliant <code>SyncProvider</code> implementation that is fully pluggable
+ * into the <code>SyncFactory</code> <b>must</b> extend and implement all
+ * abstract methods in the <a href="SyncProvider.html"><code>SyncProvider</code></a>
+ * class. In addition, an implementation <b>must</b> determine the
+ * grade, locking and updatable view capabilities defined in the
+ * <code>SyncProvider</code> class definition. One or more of the
+ * <code>SyncProvider</code> description criteria <b>must</b> be supported. It
+ * is expected that vendor implementations will offer a range of grade, locking, and
+ * updatable view capabilities.
+ * <p>
+ * Furthermore, the <code>SyncProvider</code> naming convention <b>must</b> be followed as
+ * detailed in the <a href="SyncProvider.html"><code>SyncProvider</code></a> class
+ * description.
+ * <p>
+ * <b>3.2 Grades</b>
+ * <p>
+ * JSR 114 defines a set of grades to describe the quality of synchronization
+ * a <code>SyncProvider</code> object can offer a disconnected <code>RowSet</code>
+ * object. These grades are listed from the lowest quality of service to the highest.
+ * <ul>
+ * <li><b>GRADE_NONE</b> - No synchronization with the originating data source is
+ * provided. A <code>SyncProvider</code> implementation returning this grade will simply
+ * attempt to write any data that has changed in the <code>RowSet</code> object to the
+ *underlying data source, overwriting whatever is there. No attempt is made to compare
+ * original values with current values to see if there is a conflict. The
+ * <code>RIXMLProvider</code> is implemented with this grade.
+ *
+ * <li><b>GRADE_CHECK_MODIFIED_AT_COMMIT</b> - A low grade of optimistic synchronization.
+ * A <code>SyncProvider</code> implementation returning this grade
+ * will check for conflicts in rows that have changed between the last synchronization
+ * and the current synchronization under way. Any changes in the originating data source
+ * that have been modified will not be reflected in the disconnected <code>RowSet</code>
+ * object. If there are no conflicts, changes in the <code>RowSet</code> object will be
+ * written to the data source. If there are conflicts, no changes are written.
+ * The <code>RIOptimisticProvider</code> implementation uses this grade.
+ *
+ * <li><b>GRADE_CHECK_ALL_AT_COMMIT</b> - A high grade of optimistic synchronization.
+ * A <code>SyncProvider</code> implementation   returning this grade
+ * will check all rows, including rows that have not changed in the disconnected
+ * <code>RowSet</code> object. In this way, any changes to rows in the underlying
+ * data source will be reflected in the disconnected <code>RowSet</code> object
+ * when the synchronization finishes successfully.
+ *
+ * <li><b>GRADE_LOCK_WHEN_MODIFIED</b> - A pessimistic grade of synchronization.
+ * <code>SyncProvider</code> implementations returning this grade will lock
+ * the row in the originating  data source that corresponds to the row being changed
+ * in the <code>RowSet</code> object to reduce the possibility of other
+ * processes modifying the same data in the data source.
+ *
+ * <li><b>GRADE_LOCK_WHEN_LOADED</b> - A higher pessimistic synchronization grade.
+ * A <code>SyncProvider</code> implementation returning this grade will lock
+ * the entire view and/or  table affected by the original query used to
+ * populate a <code>RowSet</code> object.
+ * </ul>
+ * <p>
+ * <b>3.3 Locks</b>
+ * <p>
+ * JSR 114 defines a set of constants that specify whether any locks have been
+ * placed on a <code>RowSet</code> object's underlying data source and, if so,
+ * on which constructs the locks are placed.  These locks will remain on the data
+ * source while the <code>RowSet</code> object is disconnected from the data source.
+ * <P>
+ * These constants <b>should</b> be considered complementary to the
+ * grade constants. The default setting for the majority of grade settings requires
+ * that no data source locks remain when a <code>RowSet</code> object is disconnected
+ * from its data source.
+ * The grades <code>GRADE_LOCK_WHEN_MODIFIED</code> and
+ * <code>GRADE_LOCK_WHEN_LOADED</code> allow a disconnected <code>RowSet</code> object
+ * to have a fine-grained control over the degree of locking.
+ * <ul>
+ * <li><b>DATASOURCE_NO_LOCK</b> - No locks remain on the originating data source.
+ * This is the default lock setting for all <code>SyncProvider</code> implementations
+ * unless otherwise directed by a <code>RowSet</code> object.
+ *
+ * <li><b>DATASOURCE_ROW_LOCK</b> - A lock is placed on the rows that are touched by
+ * the original SQL query used to populate the <code>RowSet</code> object.
+ *
+ * <li><b>DATASOURCE_TABLE_LOCK</b> - A lock is placed on all tables that are touched
+ * by the query that was used to populate the <code>RowSet</code> object.
+ *
+ * <li><b>DATASOURCE_DB_LOCK</b>
+ * A lock is placed on the entire data source that is used by the <code>RowSet</code>
+ * object.
+ * </ul>
+ * <p>
+ * <b>3.4 Updatable Views</b>
+ * <p>
+ * A <code>RowSet</code> object may be populated with data from an SQL <code>VIEW</code>.
+ * The following constants indicate whether a <code>SyncProvider</code> object can
+ * update data in the table or tables from which the <code>VIEW</code> was derived.
+ * <ul>
+ * <li><b>UPDATABLE_VIEW_SYNC</b>
+ * Indicates that a <code>SyncProvider</code> implementation  supports synchronization
+ * to the table or tables from which the SQL <code>VIEW</code> used to populate
+ * a <code>RowSet</code> object is derived.
+ *
+ * <li><b>NONUPDATABLE_VIEW_SYNC</b>
+ * Indicates that a <code>SyncProvider</code> implementation  does <b>not</b> support
+ * synchronization to the table or tables from which the SQL <code>VIEW</code>
+ * used to populate  a <code>RowSet</code> object is derived.
+ * </ul>
+ * <p>
+ * <b>3.5 Usage of <code>SyncProvider</code> Grading and Locking</b>
+ * <p>
+ * In the example below, the reference <code>CachedRowSetImpl</code> implementation
+ * reconfigures its current <code>SyncProvider</code> object by calling the
+ * <code>setSyncProvider</code> method.<br>
+ *
+ * <PRE>
+ *   CachedRowSetImpl crs = new CachedRowSetImpl();
+ *   crs.setSyncProvider("com.foo.bar.HASyncProvider");
+ * </PRE>
+ *   An application can retrieve the <code>SyncProvider</code> object currently in use
+ * by a disconnected <code>RowSet</code> object. It can also retrieve the
+ * grade of synchronization with which the provider was implemented and the degree of
+ * locking currently in use.  In addition, an application has the flexibility to set
+ * the degree of locking to be used, which can increase the possibilities for successful
+ * synchronization.  These operation are shown in the following code fragment.
+ * <PRE>
+ *   SyncProvider sync = crs.getSyncProvider();
+ *
+ *   switch (sync.getProviderGrade()) {
+ *   case: SyncProvider.GRADE_CHECK_ALL_AT_COMMIT
+ *         //A high grade of optimistic synchronization
+ *    break;
+ *    case: SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT
+ *         //A low grade of optimistic synchronization
+ *    break;
+ *    case: SyncProvider.GRADE_LOCK_WHEN_LOADED
+ *         // A pessimistic synchronization grade
+ *    break;
+ *    case: SyncProvider.GRADE_LOCK_WHEN_MODIFIED
+ *         // A pessimistic synchronization grade
+ *    break;
+ *    case: SyncProvider.GRADE_NONE
+ *      // No synchronization with the originating data source provided
+ *    break;
+ *    }
+ *
+ *    switch (sync.getDataSourcLock() {
+ *      case: SyncProvider.DATASOURCE_DB_LOCK
+ *       // A lock is placed on the entire datasource that is used by the
+ *       // <code>RowSet</code> object
+ *       break;
+ *
+ *      case: SyncProvider.DATASOURCE_NO_LOCK
+ *       // No locks remain on the  originating data source.
+ *      break;
+ *
+ *      case: SyncProvider.DATASOURCE_ROW_LOCK
+ *       // A lock is placed on the rows that are  touched by the original
+ *       // SQL statement used to populate
+ *       // the RowSet object that is using the SyncProvider
+ *       break;
+ *
+ *      case: DATASOURCE_TABLE_LOCK
+ *       // A lock is placed on  all tables that are touched by the original
+ *       // SQL statement used to populated
+ *       // the RowSet object that is using the SyncProvider
+ *      break;
+ *
+ * </PRE>
+ *    It is also possible using the static utility method in the
+ * <code>SyncFactory</code> class to determine the list of <code>SyncProvider</code>
+ * implementations currently registered with the <code>SyncFactory</code>.
+ *
+ * <pre>
+ *       Enumeration e = SyncFactory.getRegisteredProviders();
+ * </pre>
+ *
+ *
+ * <h3><a id="resolving">4.0 Resolving Synchronization Conflicts</a></h3>
+ *
+ * The interface <code>SyncResolver</code> provides a way for an application to
+ * decide manually what to do when a conflict occurs. When the <code>CachedRowSet</code>
+ * method <code>acceptChanges</code> finishes and has detected one or more conflicts,
+ * it throws a <code>SyncProviderException</code> object.  An application can
+ * catch the exception and
+ * have it retrieve a <code>SyncResolver</code> object by calling the method
+ * <code>SyncProviderException.getSyncResolver()</code>.
+ * <P>
+ * A <code>SyncResolver</code> object, which is a special kind of
+ * <code>CachedRowSet</code> object or
+ * a <code>JdbcRowSet</code> object that has implemented the <code>SyncResolver</code>
+ * interface,  examines the conflicts row by row. It is a duplicate of the
+ * <code>RowSet</code> object being synchronized except that it contains only the data
+ * from the data source this is causing a conflict. All of the other column values are
+ * set to <code>null</code>. To navigate from one conflict value to another, a
+ * <code>SyncResolver</code> object provides the methods <code>nextConflict</code> and
+ * <code>previousConflict</code>.
+ * <P>
+ * The <code>SyncResolver</code> interface also
+ * provides methods for doing the following:
+ * <UL>
+ *  <LI>finding out whether the conflict involved an update, a delete, or an insert
+ *  <LI>getting the value in the data source that caused the conflict
+ *  <LI>setting the value that should be in the data source if it needs to be changed
+ *      or setting the value that should be in the <code>RowSet</code> object if it needs
+ *      to be changed
+ * </UL>
+ * <P>
+ * When the <code>CachedRowSet</code> method <code>acceptChanges</code> is called, it
+ * delegates to the <code>RowSet</code> object's  <code>SyncProvider</code> object.
+ * How the writer provided by that <code>SyncProvider</code> object is implemented
+ * determines what level (grade) of checking for conflicts will be done.  After all
+ * checking for conflicts is completed and one or more conflicts has been found, the method
+ * <code>acceptChanges</code> throws a <code>SyncProviderException</code> object. The
+ * application can catch the exception and use it to obtain a <code>SyncResolver</code> object.
+ * <P>
+ * The application can then use <code>SyncResolver</code> methods to get information
+ * about each conflict and decide what to do.  If the application logic or the user
+ * decides that a value in the <code>RowSet</code> object should be the one to
+ * persist, the application or user can overwrite the data source value with it.
+ * <P>
+ * The comment for the <code>SyncResolver</code> interface has more detail.
+ *
+ * <h3><a id="relspec">5.0 Related Specifications</a></h3>
+ * <ul>
+ * <li><a href="http://docs.oracle.com/javase/jndi/tutorial/index.html">JNDI</a>
+ * <li><a href="{@docRoot}/java.logging/java/util/logging/package-summary.html">Java Logging
+ * APIs</a>
+ * </ul>
+ * <h3><a id="reldocs">6.0 Related Documentation</a></h3>
+ * <ul>
+ * <li><a href="http://docs.oracle.com/javase/tutorial/jdbc/">DataSource for JDBC
+ * Connections</a>
+ * </ul>
+ */
+package javax.sql.rowset.spi;
--- a/src/java.sql.rowset/share/classes/javax/sql/rowset/spi/package.html	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,493 +0,0 @@
-<!doctype html>
-<html lang="en">
-<head>
-
-  <meta http-equiv="Content-Type"
- content="text/html; charset=iso-8859-1">
-
-  <meta name="GENERATOR"
- content="Mozilla/4.79 [en] (Windows NT 5.0; U) [Netscape]">
-<!--
-Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-  <title>javax.sql.rowset.spi</title>
-
-</head>
-  <body>
-
-The standard classes and interfaces that a third party vendor has to
-use in its implementation of a synchronization provider. These classes and
-interfaces are referred to as the Service Provider Interface (SPI).  To make it possible
-for a <code>RowSet</code> object to use an implementation, the vendor must register
-it with the <code>SyncFactory</code> singleton. (See the class comment for
-<code>SyncProvider</code> for a full explanation of the registration process and
-the naming convention to be used.)
-
-<h2>Table of Contents</h2>
-<ul>
-<li><a href="#pkgspec">1.0 Package Specification</a>
-<li><a href="#arch">2.0 Service Provider Architecture</a>
-<li><a href="#impl">3.0 Implementer's Guide</a>
-<li><a href="#resolving">4.0 Resolving Synchronization Conflicts</a>
-<li><a href="#relspec">5.0 Related Specifications</a>
-<li><a href="#reldocs">6.0 Related Documentation</a>
-</ul>
-
-<h3><a id="pkgspec">1.0 Package Specification</a></h3>
-<P>
-The following classes and interfaces make up the <code>javax.sql.rowset.spi</code>
-package:
-<UL>
-  <LI><code>SyncFactory</code>
-  <LI><code>SyncProvider</code>
-  <LI><code>SyncFactoryException</code>
-  <LI><code>SyncProviderException</code>
-  <LI><code>SyncResolver</code>
-  <LI><code>XmlReader</code>
-  <LI><code>XmlWriter</code>
-  <LI><code>TransactionalWriter</code>
-</UL>
-The following interfaces, in the <code>javax.sql</code> package, are also part of the SPI:
-<UL>
-  <LI><code>RowSetReader</code>
-  <LI><code>RowSetWriter</code>
-</UL>
-<P>
-A <code>SyncProvider</code> implementation provides a disconnected <code>RowSet</code>
-object with the mechanisms for reading data into it and for writing data that has been
-modified in it
-back to the underlying data source.  A <i>reader</i>, a <code>RowSetReader</code> or
-<code>XMLReader</code> object, reads data into a <code>RowSet</code> object when the
-<code>CachedRowSet</code> methods <code>execute</code> or <code>populate</code>
-are called.  A <i>writer</i>, a <code>RowSetWriter</code> or <code>XMLWriter</code>
-object, writes changes back to the underlying data source when the
-<code>CachedRowSet</code> method <code>acceptChanges</code> is called.
-<P>
-The process of writing changes in a <code>RowSet</code> object to its data source
-is known as <i>synchronization</i>.  The <code>SyncProvider</code> implementation that a
-<code>RowSet</code> object is using determines the level of synchronization that the
-<code>RowSet</code> object's writer uses. The various levels of synchronization are
-referred to as <i>grades</i>.
-<P>
-The lower grades of synchronization are
-known as <i>optimistic</i> concurrency levels because they optimistically
-assume that there will be no conflicts or very few conflicts.  A conflict exists when
-the same data modified in the <code>RowSet</code> object has also been modified
-in the data source. Using the optimistic concurrency model means that if there
-is a conflict, modifications to either the data source or the <code>RowSet</code>
-object will be lost.
-<P>
-Higher grades of synchronization are called <i>pessimistic</i> because they assume
-that others will be accessing the data source and making modifications.  These
-grades set varying levels of locks to increase the chances that no conflicts
-occur.
-<P>
-The lowest level of synchronization is simply writing any changes made to the
-<code>RowSet</code> object to its underlying data source.  The writer does
-nothing to check for conflicts.
-If there is a conflict and the data
-source values are overwritten, the changes other parties have made by to the data
-source are lost.
-<P>
-The <code>RIXMLProvider</code> implementation uses the lowest level
-of synchronization and just writes <code>RowSet</code> changes to the data source.
-
-<P>
-For the next level up, the
-writer checks to see if there are any conflicts, and if there are,
-it does not write anything to the data source.  The problem with this concurrency
-level is that if another party has modified the corresponding data in the data source
-since the <code>RowSet</code> object got its data,
-the changes made to the <code>RowSet</code> object are lost. The
-<code>RIOptimisticProvider</code> implementation uses this level of synchronization.
-<P>
-At higher levels of synchronization, referred to as pessimistic concurrency,
-the writer take steps to avoid conflicts by setting locks. Setting locks
-can vary from setting a lock on a single row to setting a lock on a table
-or the entire data source. The level of synchronization is therefore a tradeoff
-between the ability of users to access the data source concurrently and the  ability
-of the writer to keep the data in the <code>RowSet</code> object and its data source
-synchronized.
-<P>
-It is a requirement that all disconnected <code>RowSet</code> objects
-(<code>CachedRowSet</code>, <code>FilteredRowSet</code>, <code>JoinRowSet</code>,
-and <code>WebRowSet</code> objects) obtain their <code>SyncProvider</code> objects
-from the <code>SyncFactory</code> mechanism.
-<P>
-The reference implementation (RI) provides two synchronization providers.
-    <UL>
-       <LI><b><code>RIOptimisticProvider</code></b> <br>
-           The default provider that the <code>SyncFactory</code> instance will
-           supply to a disconnected <code>RowSet</code> object when no provider
-           implementation is specified.<BR>
-           This synchronization provider uses an optimistic concurrency model,
-           assuming that there will be few conflicts among users
-           who are accessing the same data in a database.  It avoids
-           using locks; rather, it checks to see if there is a conflict
-           before trying to synchronize the <code>RowSet</code> object and the
-           data source. If there is a conflict, it does nothing, meaning that
-           changes to the <code>RowSet</code> object are not persisted to the data
-           source.
-       <LI><B><code>RIXMLProvider</code></B> <BR>
-            A synchronization provider that can be used with a
-            <code>WebRowSet</code> object, which is a rowset that can be written
-            in XML format or read from XML format. The
-            <code>RIXMLProvider</code> implementation does no checking at all for
-            conflicts and simply writes any updated data in the
-            <code>WebRowSet</code> object to the underlying data source.
-            <code>WebRowSet</code> objects use this provider when they are
-            dealing with XML data.
-    </UL>
-
-These <code>SyncProvider</code> implementations
-are bundled with the reference implementation, which makes them always available to
-<code>RowSet</code> implementations.
-<code>SyncProvider</code> implementations make themselves available by being
-registered with the <code>SyncFactory</code> singleton.  When a <code>RowSet</code>
-object requests a provider, by specifying it in the constructor or as an argument to the
-<code>CachedRowSet</code> method <code>setSyncProvider</code>,
-the <code>SyncFactory</code> singleton
-checks to see if the requested provider has been registered with it.
-If it has, the <code>SyncFactory</code> creates an instance of it and passes it to the
-requesting <code>RowSet</code> object.
-If the <code>SyncProvider</code> implementation that is specified has not been registered,
-the <code>SyncFactory</code> singleton causes a <code>SyncFactoryException</code> object
-to be thrown.  If no provider is specified,
-the <code>SyncFactory</code> singleton will create an instance of the default
-provider implementation, <code>RIOptimisticProvider</code>,
-and pass it to the requesting <code>RowSet</code> object.
-
-<P>
-If a <code>WebRowSet</code> object does not specify a provider in its constructor, the
-<code>SyncFactory</code> will give it an instance of <code>RIOptimisticProvider</code>.
-However, the constructor for <code>WebRowSet</code> is implemented to set the provider
-to the <code>RIXMLProvider</code>, which reads and writes a <code>RowSet</code> object
-in XML format.
-<P>
-See the <a href="SyncProvider.html">SyncProvider</a> class
-specification for further details.
-<p>
-Vendors may develop a <code>SyncProvider</code> implementation with any one of the possible
-levels of synchronization, thus giving <code>RowSet</code> objects a choice of
-synchronization mechanisms.
-
-<h3><a id="arch">2.0 Service Provider Interface Architecture</a></h3>
-<b>2.1 Overview</b>
-<p>
-The Service Provider Interface provides a pluggable mechanism by which
-<code>SyncProvider</code> implementations can be registered and then generated when
-required. The lazy reference mechanism employed by the <code>SyncFactory</code> limits
-unnecessary resource consumption by not creating an instance until it is
-required by a disconnected
-<code>RowSet</code> object. The <code>SyncFactory</code> class also provides
-a standard API to configure logging options and streams that <b>may</b> be provided
-by a particular <code>SyncProvider</code> implementation.
-<p>
-<b>2.2 Registering with the <code>SyncFactory</code></b>
-<p>
-A third party <code>SyncProvider</code> implementation must be registered with the
-<code>SyncFactory</code> in order for a disconnected <code>RowSet</code> object
-to obtain it and thereby use its <code>javax.sql.RowSetReader</code> and
-<code>javax.sql.RowSetWriter</code>
-implementations. The following registration mechanisms are available to all
-<code>SyncProvider</code> implementations:
-<ul>
-<li><b>System properties</b> - Properties set at the command line. These
-properties are set at run time and apply system-wide per invocation of the Java
-application. See the section <a href="#reldocs">"Related Documentation"</a>
-further related information.
-
-<li><b>Property Files</b> - Properties specified in a standard property file.
-This can be specified using a System Property or by modifying a standard
-property file located in the platform run-time. The
-reference implementation of this technology includes a standard property
-file than can be edited to add additional <code>SyncProvider</code> objects.
-
-<li><b>JNDI Context</b> - Available providers can be registered on a JNDI
-context. The <code>SyncFactory</code> will attempt to load <code>SyncProvider</code>
-objects bound to the context and register them with the factory. This
-context must be supplied to the <code>SyncFactory</code> for the mechanism to
-function correctly.
-</ul>
-<p>
-Details on how to specify the system properties or properties in a property file
-and how to configure the JNDI Context are explained in detail in the
-<a href="SyncFactory.html"><code>SyncFactory</code></a> class description.
-<p>
-<b>2.3 SyncFactory Provider Instance Generation Policies</b>
-<p>
-The <code>SyncFactory</code> generates a requested <code>SyncProvider</code>
-object if the provider has been correctly registered.  The
-following policies are adhered to when either a disconnected <code>RowSet</code> object
-is instantiated with a specified <code>SyncProvider</code> implementation or is
-reconfigured at runtime with an alternative <code>SyncProvider</code> object.
-<ul>
-<li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
-contains <i>no</i> reference to the provider, a <code>SyncFactoryException</code> is
-thrown.
-
-<li> If a <code>SyncProvider</code> object is specified and the <code>SyncFactory</code>
-contains a reference to the provider, the requested provider is supplied.
-
-<li> If no <code>SyncProvider</code> object is specified, the reference
-implementation provider <code>RIOptimisticProvider</code> is supplied.
-</ul>
-<p>
-These policies are explored in more detail in the <a href="SyncFactory.html">
-<code>SyncFactory</code></a> class.
-
-<h3><a id="impl">3.0 SyncProvider Implementer's Guide</a></h3>
-
-<b>3.1 Requirements</b>
-<p>
-A compliant <code>SyncProvider</code> implementation that is fully pluggable
-into the <code>SyncFactory</code> <b>must</b> extend and implement all
-abstract methods in the <a href="SyncProvider.html"><code>SyncProvider</code></a>
-class. In addition, an implementation <b>must</b> determine the
-grade, locking and updatable view capabilities defined in the
-<code>SyncProvider</code> class definition. One or more of the
-<code>SyncProvider</code> description criteria <b>must</b> be supported. It
-is expected that vendor implementations will offer a range of grade, locking, and
-updatable view capabilities.
-<p>
-Furthermore, the <code>SyncProvider</code> naming convention <b>must</b> be followed as
-detailed in the <a href="SyncProvider.html"><code>SyncProvider</code></a> class
-description.
-<p>
-<b>3.2 Grades</b>
-<p>
-JSR 114 defines a set of grades to describe the quality of synchronization
-a <code>SyncProvider</code> object can offer a disconnected <code>RowSet</code>
-object. These grades are listed from the lowest quality of service to the highest.
-<ul>
-<li><b>GRADE_NONE</b> - No synchronization with the originating data source is
-provided. A <code>SyncProvider</code> implementation returning this grade will simply
-attempt to write any data that has changed in the <code>RowSet</code> object to the
-underlying data source, overwriting whatever is there. No attempt is made to compare
-original values with current values to see if there is a conflict. The
-<code>RIXMLProvider</code> is implemented with this grade.
-
-<li><b>GRADE_CHECK_MODIFIED_AT_COMMIT</b> - A low grade of optimistic synchronization.
-A <code>SyncProvider</code> implementation returning this grade
-will check for conflicts in rows that have changed between the last synchronization
-and the current synchronization under way. Any changes in the originating data source
-that have been modified will not be reflected in the disconnected <code>RowSet</code>
-object. If there are no conflicts, changes in the <code>RowSet</code> object will be
-written to the data source. If there are conflicts, no changes are written.
-The <code>RIOptimisticProvider</code> implementation uses this grade.
-
-<li><b>GRADE_CHECK_ALL_AT_COMMIT</b> - A high grade of optimistic synchronization.
-A <code>SyncProvider</code> implementation   returning this grade
-will check all rows, including rows that have not changed in the disconnected
-<code>RowSet</code> object. In this way, any changes to rows in the underlying
-data source will be reflected in the disconnected <code>RowSet</code> object
-when the synchronization finishes successfully.
-
-<li><b>GRADE_LOCK_WHEN_MODIFIED</b> - A pessimistic grade of synchronization.
-<code>SyncProvider</code> implementations returning this grade will lock
-the row in the originating  data source that corresponds to the row being changed
-in the <code>RowSet</code> object to reduce the possibility of other
-processes modifying the same data in the data source.
-
-<li><b>GRADE_LOCK_WHEN_LOADED</b> - A higher pessimistic synchronization grade.
-A <code>SyncProvider</code> implementation returning this grade will lock
-the entire view and/or  table affected by the original query used to
-populate a <code>RowSet</code> object.
-</ul>
-<p>
-<b>3.3 Locks</b>
-<p>
-JSR 114 defines a set of constants that specify whether any locks have been
-placed on a <code>RowSet</code> object's underlying data source and, if so,
-on which constructs the locks are placed.  These locks will remain on the data
-source while the <code>RowSet</code> object is disconnected from the data source.
-<P>
-These constants <b>should</b> be considered complementary to the
-grade constants. The default setting for the majority of grade settings requires
-that no data source locks remain when a <code>RowSet</code> object is disconnected
-from its data source.
-The grades <code>GRADE_LOCK_WHEN_MODIFIED</code> and
-<code>GRADE_LOCK_WHEN_LOADED</code> allow a disconnected <code>RowSet</code> object
-to have a fine-grained control over the degree of locking.
-<ul>
-<li><b>DATASOURCE_NO_LOCK</b> - No locks remain on the originating data source.
-This is the default lock setting for all <code>SyncProvider</code> implementations
-unless otherwise directed by a <code>RowSet</code> object.
-
-<li><b>DATASOURCE_ROW_LOCK</b> - A lock is placed on the rows that are touched by
-the original SQL query used to populate the <code>RowSet</code> object.
-
-<li><b>DATASOURCE_TABLE_LOCK</b> - A lock is placed on all tables that are touched
-by the query that was used to populate the <code>RowSet</code> object.
-
-<li><b>DATASOURCE_DB_LOCK</b>
-A lock is placed on the entire data source that is used by the <code>RowSet</code>
-object.
-</ul>
-<p>
-<b>3.4 Updatable Views</b>
-<p>
-A <code>RowSet</code> object may be populated with data from an SQL <code>VIEW</code>.
-The following constants indicate whether a <code>SyncProvider</code> object can
-update data in the table or tables from which the <code>VIEW</code> was derived.
-<ul>
-<li><b>UPDATABLE_VIEW_SYNC</b>
-Indicates that a <code>SyncProvider</code> implementation  supports synchronization
-to the table or tables from which the SQL <code>VIEW</code> used to populate
-a <code>RowSet</code> object is derived.
-
-<li><b>NONUPDATABLE_VIEW_SYNC</b>
-Indicates that a <code>SyncProvider</code> implementation  does <b>not</b> support
-synchronization to the table or tables from which the SQL <code>VIEW</code>
-used to populate  a <code>RowSet</code> object is derived.
-</ul>
-<p>
-<b>3.5 Usage of <code>SyncProvider</code> Grading and Locking</b>
-<p>
-In the example below, the reference <code>CachedRowSetImpl</code> implementation
-reconfigures its current <code>SyncProvider</code> object by calling the
-<code>setSyncProvider</code> method.<br>
-
-<PRE>
-    CachedRowSetImpl crs = new CachedRowSetImpl();
-    crs.setSyncProvider("com.foo.bar.HASyncProvider");
-</PRE>
-    An application can retrieve the <code>SyncProvider</code> object currently in use
-by a disconnected <code>RowSet</code> object. It can also retrieve the
-grade of synchronization with which the provider was implemented and the degree of
-locking currently in use.  In addition, an application has the flexibility to set
-the degree of locking to be used, which can increase the possibilities for successful
-synchronization.  These operation are shown in the following code fragment.
-<PRE>
-    SyncProvider sync = crs.getSyncProvider();
-
-    switch (sync.getProviderGrade()) {
-    case: SyncProvider.GRADE_CHECK_ALL_AT_COMMIT
-         //A high grade of optimistic synchronization
-    break;
-    case: SyncProvider.GRADE_CHECK_MODIFIED_AT_COMMIT
-         //A low grade of optimistic synchronization
-    break;
-    case: SyncProvider.GRADE_LOCK_WHEN_LOADED
-         // A pessimistic synchronization grade
-    break;
-    case: SyncProvider.GRADE_LOCK_WHEN_MODIFIED
-         // A pessimistic synchronization grade
-    break;
-    case: SyncProvider.GRADE_NONE
-      // No synchronization with the originating data source provided
-    break;
-    }
-
-    switch (sync.getDataSourcLock() {
-      case: SyncProvider.DATASOURCE_DB_LOCK
-       // A lock is placed on the entire datasource that is used by the
-       // <code>RowSet</code> object
-       break;
-
-      case: SyncProvider.DATASOURCE_NO_LOCK
-       // No locks remain on the  originating data source.
-      break;
-
-      case: SyncProvider.DATASOURCE_ROW_LOCK
-       // A lock is placed on the rows that are  touched by the original
-       // SQL statement used to populate
-       // the RowSet object that is using the SyncProvider
-       break;
-
-      case: DATASOURCE_TABLE_LOCK
-       // A lock is placed on  all tables that are touched by the original
-       // SQL statement used to populated
-       // the RowSet object that is using the SyncProvider
-       break;
-
-</PRE>
-    It is also possible using the static utility method in the
-<code>SyncFactory</code> class to determine the list of <code>SyncProvider</code>
-implementations currently registered with the <code>SyncFactory</code>.
-
-<pre>
-       Enumeration e = SyncFactory.getRegisteredProviders();
-</pre>
-
-
-<h3><a id="resolving">4.0 Resolving Synchronization Conflicts</a></h3>
-
-The interface <code>SyncResolver</code> provides a way for an application to
-decide manually what to do when a conflict occurs. When the <code>CachedRowSet</code>
-method <code>acceptChanges</code> finishes and has detected one or more conflicts,
-it throws a <code>SyncProviderException</code> object.  An application can
-catch the exception and
-have it retrieve a <code>SyncResolver</code> object by calling the method
-<code>SyncProviderException.getSyncResolver()</code>.
-<P>
-A <code>SyncResolver</code> object, which is a special kind of
-<code>CachedRowSet</code> object or
-a <code>JdbcRowSet</code> object that has implemented the <code>SyncResolver</code>
-interface,  examines the conflicts row by row. It is a duplicate of the
-<code>RowSet</code> object being synchronized except that it contains only the data
-from the data source this is causing a conflict. All of the other column values are
-set to <code>null</code>. To navigate from one conflict value to another, a
-<code>SyncResolver</code> object provides the methods <code>nextConflict</code> and
-<code>previousConflict</code>.
-<P>
-The <code>SyncResolver</code> interface also
-provides methods for doing the following:
-<UL>
- <LI>finding out whether the conflict involved an update, a delete, or an insert
- <LI>getting the value in the data source that caused the conflict
- <LI>setting the value that should be in the data source if it needs to be changed
-     or setting the value that should be in the <code>RowSet</code> object if it needs
-     to be changed
-</UL>
-<P>
-When the <code>CachedRowSet</code> method <code>acceptChanges</code> is called, it
-delegates to the <code>RowSet</code> object's  <code>SyncProvider</code> object.
-How the writer provided by that <code>SyncProvider</code> object is implemented
-determines what level (grade) of checking for conflicts will be done.  After all
-checking for conflicts is completed and one or more conflicts has been found, the method
-<code>acceptChanges</code> throws a <code>SyncProviderException</code> object. The
-application can catch the exception and use it to obtain a <code>SyncResolver</code> object.
-<P>
-The application can then use <code>SyncResolver</code> methods to get information
-about each conflict and decide what to do.  If the application logic or the user
-decides that a value in the <code>RowSet</code> object should be the one to
-persist, the application or user can overwrite the data source value with it.
-<P>
-The comment for the <code>SyncResolver</code> interface has more detail.
-
-<h3><a id="relspec">5.0 Related Specifications</a></h3>
-<ul>
-<li><a href="http://docs.oracle.com/javase/jndi/tutorial/index.html">JNDI</a>
-<li><a href="{@docRoot}/java/util/logging/package-summary.html">Java Logging
-APIs</a>
-</ul>
-<h3><a id="reldocs">6.0 Related Documentation</a></h3>
-<ul>
-<li><a href="http://docs.oracle.com/javase/tutorial/jdbc/">DataSource for JDBC
-Connections</a>
-</ul>
-
-</body>
-</html>
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Jun 08 09:40:28 2018 -0700
@@ -291,7 +291,7 @@
             ((v.flags() & HASINIT) != 0
              ||
              !((base == null ||
-               (base.hasTag(IDENT) && TreeInfo.name(base) == names._this)) &&
+               TreeInfo.isThisQualifier(base)) &&
                isAssignableAsBlankFinal(v, env)))) {
             if (v.isResourceVariable()) { //TWR resource
                 log.error(pos, Errors.TryResourceMayNotBeAssigned(v));
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java	Fri Jun 08 09:40:28 2018 -0700
@@ -2391,31 +2391,18 @@
         }
 
         public void visitAssign(JCAssign tree) {
-            JCTree lhs = TreeInfo.skipParens(tree.lhs);
-            if (!isIdentOrThisDotIdent(lhs))
-                scanExpr(lhs);
+            if (!TreeInfo.isIdentOrThisDotIdent(tree.lhs))
+                scanExpr(tree.lhs);
             scanExpr(tree.rhs);
-            letInit(lhs);
-        }
-        private boolean isIdentOrThisDotIdent(JCTree lhs) {
-            if (lhs.hasTag(IDENT))
-                return true;
-            if (!lhs.hasTag(SELECT))
-                return false;
-
-            JCFieldAccess fa = (JCFieldAccess)lhs;
-            return fa.selected.hasTag(IDENT) &&
-                   ((JCIdent)fa.selected).name == names._this;
+            letInit(tree.lhs);
         }
 
         // check fields accessed through this.<field> are definitely
         // assigned before reading their value
         public void visitSelect(JCFieldAccess tree) {
             super.visitSelect(tree);
-            JCTree sel = TreeInfo.skipParens(tree.selected);
             if (enforceThisDotInit &&
-                    sel.hasTag(IDENT) &&
-                    ((JCIdent)sel).name == names._this &&
+                    TreeInfo.isThisQualifier(tree.selected) &&
                     tree.sym.kind == VAR) {
                 checkInit(tree.pos(), (VarSymbol)tree.sym);
             }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/StringConcat.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -261,18 +261,20 @@
         public Item makeConcat(JCTree.JCAssignOp tree) {
             List<JCTree> args = collectAll(tree.lhs, tree.rhs);
             Item l = gen.genExpr(tree.lhs, tree.lhs.type);
-            emit(args, tree.type, tree.pos());
+            l.duplicate();
+            l.load();
+            emit(tree.pos(), args, false, tree.type);
             return l;
         }
 
         @Override
         public Item makeConcat(JCTree.JCBinary tree) {
             List<JCTree> args = collectAll(tree.lhs, tree.rhs);
-            emit(args, tree.type, tree.pos());
+            emit(tree.pos(), args, true, tree.type);
             return gen.getItems().makeStackItem(syms.stringType);
         }
 
-        protected abstract void emit(List<JCTree> args, Type type, JCDiagnostic.DiagnosticPosition pos);
+        protected abstract void emit(JCDiagnostic.DiagnosticPosition pos, List<JCTree> args, boolean generateFirstArg, Type type);
 
         /** Peel the argument list into smaller chunks. */
         protected List<List<JCTree>> split(List<JCTree> args) {
@@ -318,9 +320,10 @@
         }
 
         /** Emit the indy concat for all these arguments, possibly peeling along the way */
-        protected void emit(List<JCTree> args, Type type, JCDiagnostic.DiagnosticPosition pos) {
+        protected void emit(JCDiagnostic.DiagnosticPosition pos, List<JCTree> args, boolean generateFirstArg, Type type) {
             List<List<JCTree>> split = split(args);
 
+            boolean first = true;
             for (List<JCTree> t : split) {
                 Assert.check(!t.isEmpty(), "Arguments list is empty");
 
@@ -333,9 +336,11 @@
                     } else {
                         dynamicArgs.add(sharpestAccessible(arg.type));
                     }
-                    gen.genExpr(arg, arg.type).load();
+                    if (!first || generateFirstArg) {
+                        gen.genExpr(arg, arg.type).load();
+                    }
+                    first = false;
                 }
-
                 doCall(type, pos, dynamicArgs.toList());
             }
 
@@ -402,9 +407,10 @@
         }
 
         @Override
-        protected void emit(List<JCTree> args, Type type, JCDiagnostic.DiagnosticPosition pos) {
+        protected void emit(JCDiagnostic.DiagnosticPosition pos, List<JCTree> args, boolean generateFirstArg, Type type) {
             List<List<JCTree>> split = split(args);
 
+            boolean first = true;
             for (List<JCTree> t : split) {
                 Assert.check(!t.isEmpty(), "Arguments list is empty");
 
@@ -433,7 +439,10 @@
                         // Ordinary arguments come through the dynamic arguments.
                         recipe.append(TAG_ARG);
                         dynamicArgs.add(sharpestAccessible(arg.type));
-                        gen.genExpr(arg, arg.type).load();
+                        if (!first || generateFirstArg) {
+                            gen.genExpr(arg, arg.type).load();
+                        }
+                        first = false;
                     }
                 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/launcher/Main.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,550 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.launcher;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.net.URI;
+import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.NestingKind;
+import javax.lang.model.element.TypeElement;
+import javax.tools.FileObject;
+import javax.tools.ForwardingJavaFileManager;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.StandardLocation;
+
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.TaskEvent;
+import com.sun.source.util.TaskListener;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.code.Source;
+import com.sun.tools.javac.resources.LauncherProperties.Errors;
+import com.sun.tools.javac.util.JCDiagnostic.Error;
+
+import jdk.internal.misc.VM;
+
+import static javax.tools.JavaFileObject.Kind.SOURCE;
+
+/**
+ * Compiles a source file, and executes the main method it contains.
+ *
+ * <p><b>This is NOT part of any supported API.
+ * If you write code that depends on this, you do so at your own
+ * risk.  This code and its internal interfaces are subject to change
+ * or deletion without notice.</b></p>
+ */
+public class Main {
+    /**
+     * An exception used to report errors.
+     */
+    public class Fault extends Exception {
+        private static final long serialVersionUID = 1L;
+        Fault(Error error) {
+            super(Main.this.getMessage(error));
+        }
+    }
+
+    /**
+     * Compiles a source file, and executes the main method it contains.
+     *
+     * <p>This is normally invoked from the Java launcher, either when
+     * the {@code --source} option is used, or when the first argument
+     * that is not part of a runtime option ends in {@code .java}.
+     *
+     * <p>The first entry in the {@code args} array is the source file
+     * to be compiled and run; all subsequent entries are passed as
+     * arguments to the main method of the first class found in the file.
+     *
+     * <p>If any problem occurs before executing the main class, it will
+     * be reported to the standard error stream, and the the JVM will be
+     * terminated by calling {@code System.exit} with a non-zero return code.
+     *
+     * @param args the arguments
+     * @throws Throwable if the main method throws an exception
+     */
+    public static void main(String... args) throws Throwable {
+        try {
+            new Main(System.err).run(VM.getRuntimeArguments(), args);
+        } catch (Fault f) {
+            System.err.println(f.getMessage());
+            System.exit(1);
+        } catch (InvocationTargetException e) {
+            // leave VM to handle the stacktrace, in the standard manner
+            throw e.getTargetException();
+        }
+    }
+
+    /** Stream for reporting errors, such as compilation errors. */
+    private PrintWriter out;
+
+    /**
+     * Creates an instance of this class, providing a stream to which to report
+     * any errors.
+     *
+     * @param out the stream
+     */
+    public Main(PrintStream out) {
+        this(new PrintWriter(new OutputStreamWriter(out), true));
+    }
+
+    /**
+     * Creates an instance of this class, providing a stream to which to report
+     * any errors.
+     *
+     * @param out the stream
+     */
+    public Main(PrintWriter out) {
+        this.out = out;
+    }
+
+    /**
+     * Compiles a source file, and executes the main method it contains.
+     *
+     * <p>The first entry in the {@code args} array is the source file
+     * to be compiled and run; all subsequent entries are passed as
+     * arguments to the main method of the first class found in the file.
+     *
+     * <p>Options for {@code javac} are obtained by filtering the runtime arguments.
+     *
+     * <p>If the main method throws an exception, it will be propagated in an
+     * {@code InvocationTargetException}. In that case, the stack trace of the
+     * target exception will be truncated such that the main method will be the
+     * last entry on the stack. In other words, the stack frames leading up to the
+     * invocation of the main method will be removed.
+     *
+     * @param runtimeArgs the runtime arguments
+     * @param args the arguments
+     * @throws Fault if a problem is detected before the main method can be executed
+     * @throws InvocationTargetException if the main method throws an exception
+     */
+    public void run(String[] runtimeArgs, String[] args) throws Fault, InvocationTargetException {
+        Path file = getFile(args);
+
+        Context context = new Context();
+        String mainClassName = compile(file, getJavacOpts(runtimeArgs), context);
+
+        String[] appArgs = Arrays.copyOfRange(args, 1, args.length);
+        execute(mainClassName, appArgs, context);
+    }
+
+    /**
+     * Returns the path for the filename found in the first of an array of arguments.
+     *
+     * @param args the array
+     * @return the path
+     * @throws Fault if there is a problem determining the path, or if the file does not exist
+     */
+    private Path getFile(String[] args) throws Fault {
+        if (args.length == 0) {
+            // should not happen when invoked from launcher
+            throw new Fault(Errors.NoArgs);
+        }
+        Path file;
+        try {
+            file = Paths.get(args[0]);
+        } catch (InvalidPathException e) {
+            throw new Fault(Errors.InvalidFilename(args[0]));
+        }
+        if (!Files.exists(file)) {
+            // should not happen when invoked from launcher
+            throw new Fault(Errors.FileNotFound(file));
+        }
+        return file;
+    }
+
+    /**
+     * Reads a source file, ignoring the first line if it is not a Java source file and
+     * it begins with {@code #!}.
+     *
+     * <p>If it is not a Java source file, and if the first two bytes are {@code #!},
+     * indicating a "magic number" of an executable text file, the rest of the first line
+     * up to but not including the newline is ignored. All characters after the first two are
+     * read in the {@link Charset#defaultCharset default platform encoding}.
+     *
+     * @param file the file
+     * @return a file object containing the content of the file
+     * @throws Fault if an error occurs while reading the file
+     */
+    private JavaFileObject readFile(Path file) throws Fault {
+        // use a BufferedInputStream to guarantee that we can use mark and reset.
+        try (BufferedInputStream in = new BufferedInputStream(Files.newInputStream(file))) {
+            boolean ignoreFirstLine;
+            if (file.getFileName().toString().endsWith(".java")) {
+                ignoreFirstLine = false;
+            } else {
+                in.mark(2);
+                ignoreFirstLine = (in.read() == '#') && (in.read() == '!');
+                if (!ignoreFirstLine) {
+                    in.reset();
+                }
+            }
+            try (BufferedReader r = new BufferedReader(new InputStreamReader(in, Charset.defaultCharset()))) {
+                StringBuilder sb = new StringBuilder();
+                if (ignoreFirstLine) {
+                    r.readLine();
+                    sb.append("\n"); // preserve line numbers
+                }
+                char[] buf = new char[1024];
+                int n;
+                while ((n = r.read(buf, 0, buf.length)) != -1)  {
+                    sb.append(buf, 0, n);
+                }
+                return new SimpleJavaFileObject(file.toUri(), SOURCE) {
+                    @Override
+                    public String getName() {
+                        return file.toString();
+                    }
+                    @Override
+                    public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+                        return sb;
+                    }
+                    @Override
+                    public boolean isNameCompatible(String simpleName, JavaFileObject.Kind kind) {
+                        // reject package-info and module-info; accept other names
+                        return (kind == JavaFileObject.Kind.SOURCE)
+                                && SourceVersion.isIdentifier(simpleName);
+                    }
+                    @Override
+                    public String toString() {
+                        return "JavacSourceLauncher[" + file + "]";
+                    }
+                };
+            }
+        } catch (IOException e) {
+            throw new Fault(Errors.CantReadFile(file, e));
+        }
+    }
+
+    /**
+     * Returns the subset of the runtime arguments that are relevant to {@code javac}.
+     * Generally, the relevant options are those for setting paths and for configuring the
+     * module system.
+     *
+     * @param runtimeArgs the runtime arguments
+     * @return the subset of the runtime arguments
+     **/
+    private List<String> getJavacOpts(String... runtimeArgs) throws Fault {
+        List<String> javacOpts = new ArrayList<>();
+
+        String sourceOpt = System.getProperty("jdk.internal.javac.source");
+        if (sourceOpt != null) {
+            Source source = Source.lookup(sourceOpt);
+            if (source == null) {
+                throw new Fault(Errors.InvalidValueForSource(sourceOpt));
+            }
+            javacOpts.addAll(List.of("--release", sourceOpt));
+        }
+
+        for (int i = 0; i < runtimeArgs.length; i++) {
+            String arg = runtimeArgs[i];
+            String opt = arg, value = null;
+            if (arg.startsWith("--")) {
+                int eq = arg.indexOf('=');
+                if (eq > 0) {
+                    opt = arg.substring(0, eq);
+                    value = arg.substring(eq + 1);
+                }
+            }
+            switch (opt) {
+                // The following options all expect a value, either in the following
+                // position, or after '=', for options beginning "--".
+                case "--class-path": case "-classpath": case "-cp":
+                case "--module-path": case "-p":
+                case "--add-exports":
+                case "--add-modules":
+                case "--limit-modules":
+                case "--patch-module":
+                case "--upgrade-module-path":
+                    if (value == null) {
+                        if (i== runtimeArgs.length - 1) {
+                            // should not happen when invoked from launcher
+                            throw new Fault(Errors.NoValueForOption(opt));
+                        }
+                        value = runtimeArgs[++i];
+                    }
+                    if (opt.equals("--add-modules") && value.equals("ALL-DEFAULT")) {
+                        // this option is only supported at run time;
+                        // it is not required or supported at compile time
+                        break;
+                    }
+                    javacOpts.add(opt);
+                    javacOpts.add(value);
+                    break;
+                case "--enable-preview":
+                    javacOpts.add(opt);
+                    if (sourceOpt == null) {
+                        throw new Fault(Errors.EnablePreviewRequiresSource);
+                    }
+                    break;
+                default:
+                    // ignore all other runtime args
+            }
+        }
+
+        // add implicit options
+        javacOpts.add("-proc:none");
+
+        return javacOpts;
+    }
+
+    /**
+     * Compiles a source file, placing the class files in a map in memory.
+     * Any messages generated during compilation will be written to the stream
+     * provided when this object was created.
+     *
+     * @param file the source file
+     * @param javacOpts compilation options for {@code javac}
+     * @param context the context for the compilation
+     * @return the name of the first class found in the source file
+     * @throws Fault if any compilation errors occur, or if no class was found
+     */
+    private String compile(Path file, List<String> javacOpts, Context context) throws Fault {
+        JavaFileObject fo = readFile(file);
+
+        JavacTool javaCompiler = JavacTool.create();
+        StandardJavaFileManager stdFileMgr = javaCompiler.getStandardFileManager(null, null, null);
+        try {
+            stdFileMgr.setLocation(StandardLocation.SOURCE_PATH, Collections.emptyList());
+        } catch (IOException e) {
+            throw new java.lang.Error("unexpected exception from file manager", e);
+        }
+        JavaFileManager fm = context.getFileManager(stdFileMgr);
+        JavacTask t = javaCompiler.getTask(out, fm, null, javacOpts, null, List.of(fo));
+        MainClassListener l = new MainClassListener(t);
+        Boolean ok = t.call();
+        if (!ok) {
+            throw new Fault(Errors.CompilationFailed);
+        }
+        if (l.mainClass == null) {
+            throw new Fault(Errors.NoClass);
+        }
+        String mainClassName = l.mainClass.getQualifiedName().toString();
+        return mainClassName;
+    }
+
+    /**
+     * Invokes the {@code main} method of a specified class, using a class loader that
+     * will load recently compiled classes from memory.
+     *
+     * @param mainClassName the class to be executed
+     * @param appArgs the arguments for the {@code main} method
+     * @param context the context for the class to be executed
+     * @throws Fault if there is a problem finding or invoking the {@code main} method
+     * @throws InvocationTargetException if the {@code main} method throws an exception
+     */
+    private void execute(String mainClassName, String[] appArgs, Context context)
+            throws Fault, InvocationTargetException {
+        ClassLoader cl = context.getClassLoader(ClassLoader.getSystemClassLoader());
+        try {
+            Class<?> appClass = Class.forName(mainClassName, true, cl);
+            if (appClass.getClassLoader() != cl) {
+                throw new Fault(Errors.UnexpectedClass(mainClassName));
+            }
+            Method main = appClass.getDeclaredMethod("main", String[].class);
+            int PUBLIC_STATIC = Modifier.PUBLIC | Modifier.STATIC;
+            if ((main.getModifiers() & PUBLIC_STATIC) != PUBLIC_STATIC) {
+                throw new Fault(Errors.MainNotPublicStatic);
+            }
+            if (!main.getReturnType().equals(void.class)) {
+                throw new Fault(Errors.MainNotVoid);
+            }
+            main.setAccessible(true);
+            main.invoke(0, (Object) appArgs);
+        } catch (ClassNotFoundException e) {
+            throw new Fault(Errors.CantFindClass(mainClassName));
+        } catch (NoSuchMethodException e) {
+            throw new Fault(Errors.CantFindMainMethod(mainClassName));
+        } catch (IllegalAccessException e) {
+            throw new Fault(Errors.CantAccessMainMethod(mainClassName));
+        } catch (InvocationTargetException e) {
+            // remove stack frames for source launcher
+            int invocationFrames = e.getStackTrace().length;
+            Throwable target = e.getTargetException();
+            StackTraceElement[] targetTrace = target.getStackTrace();
+            target.setStackTrace(Arrays.copyOfRange(targetTrace, 0, targetTrace.length - invocationFrames));
+            throw e;
+        }
+    }
+
+    private static final String bundleName = "com.sun.tools.javac.resources.launcher";
+    private ResourceBundle resourceBundle = null;
+    private String errorPrefix;
+
+    /**
+     * Returns a localized string from a resource bundle.
+     *
+     * @param error the error for which to get the localized text
+     * @return the localized string
+     */
+    private String getMessage(Error error) {
+        String key = error.key();
+        Object[] args = error.getArgs();
+        try {
+            if (resourceBundle == null) {
+                resourceBundle = ResourceBundle.getBundle(bundleName);
+                errorPrefix = resourceBundle.getString("launcher.error");
+            }
+            String resource = resourceBundle.getString(key);
+            String message = MessageFormat.format(resource, args);
+            return errorPrefix + message;
+        } catch (MissingResourceException e) {
+            return "Cannot access resource; " + key + Arrays.toString(args);
+        }
+    }
+
+    /**
+     * A listener to detect the first class found in a compilation.
+     */
+    static class MainClassListener implements TaskListener {
+        TypeElement mainClass;
+
+        MainClassListener(JavacTask t) {
+            t.addTaskListener(this);
+        }
+
+        @Override
+        public void started(TaskEvent ev) {
+            if (ev.getKind() == TaskEvent.Kind.ANALYZE && mainClass == null) {
+                TypeElement te = ev.getTypeElement();
+                if (te.getNestingKind() == NestingKind.TOP_LEVEL) {
+                    mainClass = te;
+                }
+            }
+        }
+    }
+
+    /**
+     * An object to encapulate the set of in-memory classes, such that
+     * they can be written by a file manager and subsequently used by
+     * a class loader.
+     */
+    private static class Context {
+        private Map<String, byte[]> inMemoryClasses = new HashMap<>();
+
+        JavaFileManager getFileManager(StandardJavaFileManager delegate) {
+            return new MemoryFileManager(inMemoryClasses, delegate);
+        }
+
+        ClassLoader getClassLoader(ClassLoader parent) {
+            return new MemoryClassLoader(inMemoryClasses, parent);
+        }
+    }
+
+    /**
+     * An in-memory file manager.
+     *
+     * <p>Class files (of kind {@link JavaFileObject.Kind#CLASS CLASS} written to
+     * {@link StandardLocation#CLASS_OUTPUT} will be written to an in-memory cache.
+     * All other file manager operations will be delegated to a specified file manager.
+     */
+    private static class MemoryFileManager extends ForwardingJavaFileManager<JavaFileManager> {
+        private final Map<String, byte[]> map;
+
+        MemoryFileManager(Map<String, byte[]> map, JavaFileManager delegate) {
+            super(delegate);
+            this.map = map;
+        }
+
+        @Override
+        public JavaFileObject getJavaFileForOutput(Location location, String className,
+                JavaFileObject.Kind kind, FileObject sibling) throws IOException {
+            if (location == StandardLocation.CLASS_OUTPUT && kind == JavaFileObject.Kind.CLASS) {
+                return createInMemoryClassFile(className);
+            } else {
+                return super.getJavaFileForOutput(location, className, kind, sibling);
+            }
+        }
+
+        private JavaFileObject createInMemoryClassFile(String className) {
+            URI uri = URI.create("memory:///" + className.replace('.', '/') + ".class");
+            return new SimpleJavaFileObject(uri, JavaFileObject.Kind.CLASS) {
+                @Override
+                public OutputStream openOutputStream() {
+                    return new ByteArrayOutputStream() {
+                        @Override
+                        public void close() throws IOException {
+                            super.close();
+                            map.put(className, toByteArray());
+                        }
+                    };
+                }
+            };
+        }
+    }
+
+    /**
+     * An in-memory classloader, that uses an in-memory cache written by {@link MemoryFileManager}.
+     *
+     * <p>The classloader uses the standard parent-delegation model, just providing
+     * {@code findClass} to find classes in the in-memory cache.
+     */
+    private static class MemoryClassLoader extends ClassLoader {
+        private final Map<String, byte[]> map;
+
+        MemoryClassLoader(Map<String, byte[]> map, ClassLoader parent) {
+            super(parent);
+            this.map = map;
+        }
+
+        @Override
+        protected Class<?> findClass(String name) throws ClassNotFoundException {
+            byte[] bytes = map.get(name);
+            if (bytes == null) {
+                throw new ClassNotFoundException(name);
+            }
+            return defineClass(name, bytes, 0, bytes.length);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/launcher.properties	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,136 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Messages in this file which use "placeholders" for values (e.g. {0}, {1})
+# are preceded by a stylized comment describing the type of the corresponding
+# values.
+# The simple types currently in use are:
+#
+# annotation        annotation compound
+# boolean           true or false
+# diagnostic        a sub-message; see compiler.misc.*
+# fragment          similar to 'message segment', but with more specific type
+# modifier          a Java modifier; e.g. public, private, protected
+# file              a file URL
+# file object       a file URL - similar to 'file' but typically used for source/class files, hence more specific
+# flag              a Flags.Flag instance
+# name              a name, typically a Java identifier
+# number            an integer
+# option name       the name of a command line option
+# source version    a source version number, such as 1.5, 1.6, 1.7
+# string            a general string
+# symbol            the name of a declared type
+# symbol kind       the kind of a symbol (i.e. method, variable)
+# kind name         an informative description of the kind of a declaration; see compiler.misc.kindname.*
+# token             the name of a non-terminal in source code; see compiler.misc.token.*
+# type              a Java type; e.g. int, X, X<T>
+# object            a Java object (unspecified)
+# unused            the value is not used in this message
+#
+# The following compound types are also used:
+#
+# collection of X   a comma-separated collection of items; e.g. collection of type
+# list of X         a comma-separated list of items; e.g. list of type
+# set of X          a comma-separated set of items; e.g. set of modifier
+#
+# These may be composed:
+#
+# list of type or message segment
+#
+# The following type aliases are supported:
+#
+# message segment --> diagnostic or fragment
+# file name --> file, path or file object
+#
+# Custom comments are supported in parenthesis i.e.
+#
+# number (classfile major version)
+#
+# These comments are used internally in order to generate an enum-like class declaration containing
+# a method/field for each of the diagnostic keys listed here. Those methods/fields can then be used
+# by javac code to build diagnostics in a type-safe fashion.
+#
+# In addition, these comments are verified by the jtreg test test/tools/javac/diags/MessageInfo,
+# using info derived from the collected set of examples in test/tools/javac/diags/examples.
+# MessageInfo can also be run as a standalone utility providing more facilities
+# for manipulating this file. For more details, see MessageInfo.java.
+
+## All errors are preceded by this string.
+launcher.error=\
+    error:\u0020
+
+launcher.err.no.args=\
+    no filename
+
+# 0: string
+launcher.err.invalid.filename=\
+    invalid filename: {0}
+
+# 0: path
+launcher.err.file.not.found=\
+    file not found: {0}
+
+launcher.err.compilation.failed=\
+    compilation failed
+
+launcher.err.no.class=\
+    no class declared in file
+
+launcher.err.main.not.public.static=\
+    ''main'' method is not declared ''public static''
+
+launcher.err.main.not.void=\
+    ''main'' method is not declared with a return type of ''void''
+
+# 0: string
+launcher.err.cant.find.class=\
+    can''t find class: {0}
+
+# 0: string
+launcher.err.unexpected.class=\
+    class found on application class path: {0}
+
+# 0: string
+launcher.err.cant.find.main.method=\
+    can''t find main(String[]) method in class: {0}
+
+# 0: string
+launcher.err.cant.access.main.method=\
+    can''t access main method in class: {0}
+
+# 0: path, 1: object
+launcher.err.cant.read.file=\
+    error reading file {0}: {1}
+
+# 0: string
+launcher.err.no.value.for.option=\
+    no value given for option: {0}
+
+# 0: string
+launcher.err.invalid.value.for.source=\
+    invalid value for --source option: {0}
+
+launcher.err.enable.preview.requires.source=\
+    --enable-preview must be used with --source
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/TreeInfo.java	Fri Jun 08 09:40:28 2018 -0700
@@ -148,6 +148,36 @@
         }
     }
 
+    /** Is this tree a 'this' identifier?
+     */
+    public static boolean isThisQualifier(JCTree tree) {
+        switch (tree.getTag()) {
+            case PARENS:
+                return isThisQualifier(skipParens(tree));
+            case IDENT: {
+                JCIdent id = (JCIdent)tree;
+                return id.name == id.name.table.names._this;
+            }
+            default:
+                return false;
+        }
+    }
+
+    /** Is this tree an identifier, possibly qualified by 'this'?
+     */
+    public static boolean isIdentOrThisDotIdent(JCTree tree) {
+        switch (tree.getTag()) {
+            case PARENS:
+                return isIdentOrThisDotIdent(skipParens(tree));
+            case IDENT:
+                return true;
+            case SELECT:
+                return isThisQualifier(((JCFieldAccess)tree).selected);
+            default:
+                return false;
+        }
+    }
+
     /** Is this a call to super?
      */
     public static boolean isSuperCall(JCTree tree) {
--- a/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.crypto.ec/share/native/libsunec/ECC_JNI.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,9 @@
 #include <jni.h>
 #include "jni_util.h"
 #include "impl/ecc_impl.h"
+#include "sun_security_ec_ECDHKeyAgreement.h"
+#include "sun_security_ec_ECKeyPairGenerator.h"
+#include "sun_security_ec_ECDSASignature.h"
 
 #define ILLEGAL_STATE_EXCEPTION "java/lang/IllegalStateException"
 #define INVALID_ALGORITHM_PARAMETER_EXCEPTION \
--- a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -37,7 +37,13 @@
 #include <wincrypt.h>
 #include <stdio.h>
 #include <memory>
-
+#include "sun_security_mscapi_Key.h"
+#include "sun_security_mscapi_KeyStore.h"
+#include "sun_security_mscapi_PRNG.h"
+#include "sun_security_mscapi_RSACipher.h"
+#include "sun_security_mscapi_RSAKeyPairGenerator.h"
+#include "sun_security_mscapi_RSAPublicKey.h"
+#include "sun_security_mscapi_RSASignature.h"
 
 #define OID_EKU_ANY         "2.5.29.37.0"
 
@@ -1313,7 +1319,7 @@
  * Signature: (Ljava/lang/String;)V
  */
 JNIEXPORT void JNICALL Java_sun_security_mscapi_KeyStore_destroyKeyContainer
-  (JNIEnv *env, jclass clazz, jstring keyContainerName)
+  (JNIEnv *env, jobject clazz, jstring keyContainerName)
 {
     HCRYPTPROV hCryptProv = NULL;
     const char* pszKeyContainerName = NULL;
@@ -1435,7 +1441,7 @@
  * Signature: (J)[B
  */
 JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSAPublicKey_getPublicKeyBlob
-    (JNIEnv *env, jclass clazz, jlong hCryptKey) {
+    (JNIEnv *env, jobject clazz, jlong hCryptKey) {
 
     jbyteArray blob = NULL;
     DWORD dwBlobLen;
@@ -1486,7 +1492,7 @@
  * Signature: ([B)[B
  */
 JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSAPublicKey_getExponent
-    (JNIEnv *env, jclass clazz, jbyteArray jKeyBlob) {
+    (JNIEnv *env, jobject clazz, jbyteArray jKeyBlob) {
 
     jbyteArray exponent = NULL;
     jbyte*     exponentBytes = NULL;
@@ -1542,7 +1548,7 @@
  * Signature: ([B)[B
  */
 JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_RSAPublicKey_getModulus
-    (JNIEnv *env, jclass clazz, jbyteArray jKeyBlob) {
+    (JNIEnv *env, jobject clazz, jbyteArray jKeyBlob) {
 
     jbyteArray modulus = NULL;
     jbyte*     modulusBytes = NULL;
@@ -1815,7 +1821,7 @@
  * Signature: (I[B[B[B[B[B[B[B[B)[B
  */
 JNIEXPORT jbyteArray JNICALL Java_sun_security_mscapi_KeyStore_generatePrivateKeyBlob
-    (JNIEnv *env, jclass clazz,
+    (JNIEnv *env, jobject clazz,
         jint jKeyBitLength,
         jbyteArray jModulus,
         jbyteArray jPublicExponent,
@@ -1852,7 +1858,7 @@
  * Signature: ([BLjava/lang/String;I)Lsun/security/mscapi/RSAPrivateKey;
  */
 JNIEXPORT jobject JNICALL Java_sun_security_mscapi_KeyStore_storePrivateKey
-    (JNIEnv *env, jclass clazz, jbyteArray keyBlob, jstring keyContainerName,
+    (JNIEnv *env, jobject clazz, jbyteArray keyBlob, jstring keyContainerName,
      jint keySize)
 {
     HCRYPTPROV hCryptProv = NULL;
--- a/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCrypto.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCrypto.c	Fri Jun 08 09:40:28 2018 -0700
@@ -30,6 +30,13 @@
 #include "jni_util.h"
 #include "nativeCrypto.h"
 #include "nativeFunc.h"
+#include "com_oracle_security_ucrypto_NativeCipher.h"
+#include "com_oracle_security_ucrypto_NativeDigest.h"
+#include "com_oracle_security_ucrypto_NativeKey.h"
+#include "com_oracle_security_ucrypto_NativeKey.h"
+#include "com_oracle_security_ucrypto_NativeRSACipher.h"
+#include "com_oracle_security_ucrypto_NativeRSASignature.h"
+#include "com_oracle_security_ucrypto_UcryptoProvider.h"
 
 /*
  * Dumps out byte array in hex with and name and length info
--- a/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCryptoMD.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.crypto.ucrypto/solaris/native/libj2ucrypto/nativeCryptoMD.c	Fri Jun 08 09:40:28 2018 -0700
@@ -30,7 +30,7 @@
 #include "jni_util.h"
 #include "nativeCrypto.h"
 #include "nativeFunc.h"
-
+#include "com_oracle_security_ucrypto_NativeDigestMD.h"
 
 extern void throwOutOfMemoryError(JNIEnv *env, const char *msg);
 extern jbyte* getBytes(JNIEnv *env, jbyteArray bytes, int offset, int len);
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/memory/StringTable.java	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- *
- */
-
-package sun.jvm.hotspot.memory;
-
-import java.io.*;
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.oops.*;
-import sun.jvm.hotspot.types.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.utilities.*;
-
-public class StringTable extends sun.jvm.hotspot.utilities.Hashtable {
-  static {
-    VM.registerVMInitializedObserver(new Observer() {
-        public void update(Observable o, Object data) {
-          initialize(VM.getVM().getTypeDataBase());
-        }
-      });
-  }
-
-  private static synchronized void initialize(TypeDataBase db) {
-    Type type = db.lookupType("StringTable");
-    theTableField  = type.getAddressField("_the_table");
-  }
-
-  // Fields
-  private static AddressField theTableField;
-
-  // Accessors
-  public static StringTable getTheTable() {
-    Address tmp = theTableField.getValue();
-    return (StringTable) VMObjectFactory.newObject(StringTable.class, tmp);
-  }
-
-  public StringTable(Address addr) {
-    super(addr);
-  }
-
-  public interface StringVisitor {
-    public void visit(Instance string);
-  }
-
-  public void stringsDo(StringVisitor visitor) {
-    ObjectHeap oh = VM.getVM().getObjectHeap();
-    int numBuckets = tableSize();
-    for (int i = 0; i < numBuckets; i++) {
-      for (HashtableEntry e = (HashtableEntry) bucket(i); e != null;
-           e = (HashtableEntry) e.next()) {
-        Instance s = (Instance)oh.newOop(e.literalValue().addOffsetToAsOopHandle(0));
-        visitor.visit(s);
-      }
-    }
-  }
-}
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java	Fri Jun 08 09:40:28 2018 -0700
@@ -79,7 +79,6 @@
   private Universe     universe;
   private ObjectHeap   heap;
   private SymbolTable  symbols;
-  private StringTable  strings;
   private SystemDictionary dict;
   private ClassLoaderDataGraph cldGraph;
   private Threads      threads;
@@ -655,13 +654,6 @@
     return symbols;
   }
 
-  public StringTable getStringTable() {
-    if (strings == null) {
-      strings = StringTable.getTheTable();
-    }
-    return strings;
-  }
-
   public SystemDictionary getSystemDictionary() {
     if (dict == null) {
       dict = new SystemDictionary();
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/tools/HeapSummary.java	Fri Jun 08 09:40:28 2018 -0700
@@ -129,7 +129,6 @@
       }
 
       System.out.println();
-      printInternStringStatistics();
    }
 
    // Helper methods
@@ -258,41 +257,4 @@
          return -1;
       }
    }
-
-   private void printInternStringStatistics() {
-      class StringStat implements StringTable.StringVisitor {
-         private int count;
-         private long size;
-         private OopField stringValueField;
-
-         StringStat() {
-            VM vm = VM.getVM();
-            SystemDictionary sysDict = vm.getSystemDictionary();
-            InstanceKlass strKlass = sysDict.getStringKlass();
-            // String has a field named 'value' of type 'byte[]'.
-            stringValueField = (OopField) strKlass.findField("value", "[B");
-         }
-
-         private long stringSize(Instance instance) {
-            // We include String content in size calculation.
-            return instance.getObjectSize() +
-                   stringValueField.getValue(instance).getObjectSize();
-         }
-
-         public void visit(Instance str) {
-            count++;
-            size += stringSize(str);
-         }
-
-         public void print() {
-            System.out.println(count +
-                  " interned Strings occupying " + size + " bytes.");
-         }
-      }
-
-      StringStat stat = new StringStat();
-      StringTable strTable = VM.getVM().getStringTable();
-      strTable.stringsDo(stat);
-      stat.print();
-   }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/AbstractOptionSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/AbstractOptionSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -56,7 +56,6 @@
 package jdk.internal.joptsimple;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 
 import static java.util.Collections.*;
@@ -70,22 +69,22 @@
  * @param <V> represents the type of the arguments this option accepts
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
  */
-abstract class AbstractOptionSpec<V> implements OptionSpec<V>, OptionDescriptor {
-    private final List<String> options = new ArrayList<String>();
+public abstract class AbstractOptionSpec<V> implements OptionSpec<V>, OptionDescriptor {
+    private final List<String> options = new ArrayList<>();
     private final String description;
     private boolean forHelp;
 
-    protected AbstractOptionSpec( String option ) {
+    AbstractOptionSpec( String option ) {
         this( singletonList( option ), EMPTY );
     }
 
-    protected AbstractOptionSpec( Collection<String> options, String description ) {
+    AbstractOptionSpec( List<String> options, String description ) {
         arrangeOptions( options );
 
         this.description = description;
     }
 
-    public final Collection<String> options() {
+    public final List<String> options() {
         return unmodifiableList( options );
     }
 
@@ -119,12 +118,8 @@
     protected V convertWith( ValueConverter<V> converter, String argument ) {
         try {
             return Reflection.convertWith( converter, argument );
-        }
-        catch ( ReflectionException ex ) {
-            throw new OptionArgumentConversionException( options(), argument, ex );
-        }
-        catch ( ValueConversionException ex ) {
-            throw new OptionArgumentConversionException( options(), argument, ex );
+        } catch ( ReflectionException | ValueConversionException ex ) {
+            throw new OptionArgumentConversionException( this, argument, ex );
         }
     }
 
@@ -139,14 +134,14 @@
     abstract void handleOption( OptionParser parser, ArgumentList arguments, OptionSet detectedOptions,
         String detectedArgument );
 
-    private void arrangeOptions( Collection<String> unarranged ) {
+    private void arrangeOptions( List<String> unarranged ) {
         if ( unarranged.size() == 1 ) {
             options.addAll( unarranged );
             return;
         }
 
-        List<String> shortOptions = new ArrayList<String>();
-        List<String> longOptions = new ArrayList<String>();
+        List<String> shortOptions = new ArrayList<>();
+        List<String> longOptions = new ArrayList<>();
 
         for ( String each : unarranged ) {
             if ( each.length() == 1 )
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/AlternativeLongOptionSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/AlternativeLongOptionSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,26 +55,40 @@
 
 package jdk.internal.joptsimple;
 
+import jdk.internal.joptsimple.internal.Messages;
+
+import java.util.Locale;
+
 import static java.util.Collections.*;
 
 import static jdk.internal.joptsimple.ParserRules.*;
 
 /**
- * Represents the <kbd>"-W"</kbd> form of long option specification.
+ * Represents the {@code "-W"} form of long option specification.
  *
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
  */
 class AlternativeLongOptionSpec extends ArgumentAcceptingOptionSpec<String> {
     AlternativeLongOptionSpec() {
-        super( singletonList( RESERVED_FOR_EXTENSIONS ), true, "Alternative form of long options" );
+        super( singletonList( RESERVED_FOR_EXTENSIONS ),
+            true,
+            Messages.message(
+                Locale.getDefault(),
+                "jdk.internal.joptsimple.HelpFormatterMessages",
+                AlternativeLongOptionSpec.class,
+                "description" ) );
 
-        describedAs( "opt=value" );
+        describedAs( Messages.message(
+            Locale.getDefault(),
+            "jdk.internal.joptsimple.HelpFormatterMessages",
+            AlternativeLongOptionSpec.class,
+            "arg.description" ) );
     }
 
     @Override
     protected void detectOptionArgument( OptionParser parser, ArgumentList arguments, OptionSet detectedOptions ) {
         if ( !arguments.hasMore() )
-            throw new OptionMissingRequiredArgumentException( options() );
+            throw new OptionMissingRequiredArgumentException( this );
 
         arguments.treatNextAsLongOption();
     }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ArgumentAcceptingOptionSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ArgumentAcceptingOptionSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -56,13 +56,12 @@
 package jdk.internal.joptsimple;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.StringTokenizer;
 
 import static java.util.Collections.*;
+import static java.util.Objects.*;
 
-import static jdk.internal.joptsimple.internal.Objects.*;
 import static jdk.internal.joptsimple.internal.Reflection.*;
 import static jdk.internal.joptsimple.internal.Strings.*;
 
@@ -88,12 +87,13 @@
 public abstract class ArgumentAcceptingOptionSpec<V> extends AbstractOptionSpec<V> {
     private static final char NIL_VALUE_SEPARATOR = '\u0000';
 
+    private final boolean argumentRequired;
+    private final List<V> defaultValues = new ArrayList<>();
+
     private boolean optionRequired;
-    private final boolean argumentRequired;
     private ValueConverter<V> converter;
     private String argumentDescription = "";
     private String valueSeparator = String.valueOf( NIL_VALUE_SEPARATOR );
-    private final List<V> defaultValues = new ArrayList<V>();
 
     ArgumentAcceptingOptionSpec( String option, boolean argumentRequired ) {
         super( option );
@@ -101,7 +101,7 @@
         this.argumentRequired = argumentRequired;
     }
 
-    ArgumentAcceptingOptionSpec( Collection<String> options, boolean argumentRequired, String description ) {
+    ArgumentAcceptingOptionSpec( List<String> options, boolean argumentRequired, String description ) {
         super( options, description );
 
         this.argumentRequired = argumentRequired;
@@ -182,7 +182,7 @@
      *   </code>
      * </pre>
      *
-     * <p>Then {@code options.valuesOf( "z" )} would yield the list {@code [foo, bar, baz, fizz, buzz]}.</p>
+     * <p>Then <code>options.valuesOf( "z" )</code> would yield the list {@code [foo, bar, baz, fizz, buzz]}.</p>
      *
      * <p>You cannot use Unicode U+0000 as the separator.</p>
      *
@@ -211,7 +211,7 @@
      *   </code>
      * </pre>
      *
-     * <p>Then {@code options.valuesOf( "z" )} would yield the list {@code [foo, bar, baz, fizz, buzz]}.</p>
+     * <p>Then <code>options.valuesOf( "z" )</code> would yield the list {@code [foo, bar, baz, fizz, buzz]}.</p>
      *
      * <p>You cannot use Unicode U+0000 in the separator.</p>
      *
@@ -236,8 +236,9 @@
      * @throws NullPointerException if {@code value}, {@code values}, or any elements of {@code values} are
      * {@code null}
      */
-    @SuppressWarnings("unchecked")
-    public ArgumentAcceptingOptionSpec<V> defaultsTo( V value, V... values ) {
+    @SafeVarargs
+    @SuppressWarnings("varargs")
+    public final ArgumentAcceptingOptionSpec<V> defaultsTo( V value, V... values ) {
         addDefaultValue( value );
         defaultsTo( values );
 
@@ -275,7 +276,7 @@
     }
 
     private void addDefaultValue( V value ) {
-        ensureNotNull( value );
+        requireNonNull( value );
         defaultValues.add( value );
     }
 
@@ -283,7 +284,7 @@
     final void handleOption( OptionParser parser, ArgumentList arguments, OptionSet detectedOptions,
         String detectedArgument ) {
 
-        if ( isNullOrEmpty( detectedArgument ) )
+        if ( detectedArgument == null )
             detectOptionArgument( parser, arguments, detectedOptions );
         else
             addArguments( detectedOptions, detectedArgument );
@@ -314,8 +315,7 @@
             while ( lexer.hasMoreTokens() )
                 convert( lexer.nextToken() );
             return true;
-        }
-        catch ( OptionException ignored ) {
+        } catch ( OptionException ignored ) {
             return false;
         }
     }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ArgumentList.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ArgumentList.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/BuiltinHelpFormatter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/BuiltinHelpFormatter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,14 +55,9 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
-import java.util.Comparator;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
+import java.util.*;
 
+import jdk.internal.joptsimple.internal.Messages;
 import jdk.internal.joptsimple.internal.Rows;
 import jdk.internal.joptsimple.internal.Strings;
 
@@ -73,10 +68,17 @@
 /**
  * <p>A help formatter that allows configuration of overall row width and column separator width.</p>
  *
- * <p>The formatter produces a two-column output. The left column is for the options, and the right column for their
+ * <p>The formatter produces output in two sections: one for the options, and one for non-option arguments.</p>
+ *
+ * <p>The options section has two columns: the left column for the options, and the right column for their
  * descriptions. The formatter will allow as much space as possible for the descriptions, by minimizing the option
  * column's width, no greater than slightly less than half the overall desired width.</p>
  *
+ * <p>The non-option arguments section is one column, occupying as much width as it can.</p>
+ *
+ * <p>Subclasses are free to override bits of this implementation as they see fit. Inspect the code
+ * carefully to understand the flow of control that this implementation guarantees.</p>
+ *
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
  */
 public class BuiltinHelpFormatter implements HelpFormatter {
@@ -102,7 +104,20 @@
         optionRows = new Rows( desiredOverallWidth, desiredColumnSeparatorWidth );
     }
 
+    /**
+     * {@inheritDoc}
+     *
+     * <p>This implementation:</p>
+     * <ul>
+     *     <li>Sorts the given descriptors by their first elements of {@link OptionDescriptor#options()}</li>
+     *     <li>Passes the resulting sorted set to {@link #addRows(java.util.Collection)}</li>
+     *     <li>Returns the result of {@link #formattedHelpOutput()}</li>
+     * </ul>
+     */
     public String format( Map<String, ? extends OptionDescriptor> options ) {
+        optionRows.reset();
+        nonOptionRows.reset();
+
         Comparator<OptionDescriptor> comparator =
             new Comparator<OptionDescriptor>() {
                 public int compare( OptionDescriptor first, OptionDescriptor second ) {
@@ -110,7 +125,7 @@
                 }
             };
 
-        Set<OptionDescriptor> sorted = new TreeSet<OptionDescriptor>( comparator );
+        Set<OptionDescriptor> sorted = new TreeSet<>( comparator );
         sorted.addAll( options.values() );
 
         addRows( sorted );
@@ -118,21 +133,102 @@
         return formattedHelpOutput();
     }
 
-    private String formattedHelpOutput() {
+    /**
+     * Adds a row of option help output in the left column, with empty space in the right column.
+     *
+     * @param single text to put in the left column
+     */
+    protected void addOptionRow( String single ) {
+        addOptionRow( single, "" );
+    }
+
+    /**
+     * Adds a row of option help output in the left and right columns.
+     *
+     * @param left text to put in the left column
+     * @param right text to put in the right column
+     */
+    protected void addOptionRow( String left, String right ) {
+        optionRows.add( left, right );
+    }
+
+    /**
+     * Adds a single row of non-option argument help.
+     *
+     * @param single single row of non-option argument help text
+     */
+    protected void addNonOptionRow( String single ) {
+        nonOptionRows.add( single, "" );
+    }
+
+    /**
+     * Resizes the columns of all the rows to be no wider than the widest element in that column.
+     */
+    protected void fitRowsToWidth() {
+        nonOptionRows.fitToWidth();
+        optionRows.fitToWidth();
+    }
+
+    /**
+     * Produces non-option argument help.
+     *
+     * @return non-option argument help
+     */
+    protected String nonOptionOutput() {
+        return nonOptionRows.render();
+    }
+
+    /**
+     * Produces help for options and their descriptions.
+     *
+     * @return option help
+     */
+    protected String optionOutput() {
+        return optionRows.render();
+    }
+
+    /**
+     * <p>Produces help output for an entire set of options and non-option arguments.</p>
+     *
+     * <p>This implementation concatenates:</p>
+     * <ul>
+     *     <li>the result of {@link #nonOptionOutput()}</li>
+     *     <li>if there is non-option output, a line separator</li>
+     *     <li>the result of {@link #optionOutput()}</li>
+     * </ul>
+     *
+     * @return help output for entire set of options and non-option arguments
+     */
+    protected String formattedHelpOutput() {
         StringBuilder formatted = new StringBuilder();
-        String nonOptionDisplay = nonOptionRows.render();
+        String nonOptionDisplay = nonOptionOutput();
         if ( !Strings.isNullOrEmpty( nonOptionDisplay ) )
             formatted.append( nonOptionDisplay ).append( LINE_SEPARATOR );
-        formatted.append( optionRows.render() );
+        formatted.append( optionOutput() );
 
         return formatted.toString();
     }
 
-    private void addRows( Collection<? extends OptionDescriptor> options ) {
+    /**
+     * <p>Adds rows of help output for the given options.</p>
+     *
+     * <p>This implementation:</p>
+     * <ul>
+     *     <li>Calls {@link #addNonOptionsDescription(java.util.Collection)} with the options as the argument</li>
+ *         <li>If there are no options, calls {@link #addOptionRow(String)} with an argument that indicates
+ *         that no options are specified.</li>
+ *         <li>Otherwise, calls {@link #addHeaders(java.util.Collection)} with the options as the argument,
+ *         followed by {@link #addOptions(java.util.Collection)} with the options as the argument.</li>
+     *     <li>Calls {@link #fitRowsToWidth()}.</li>
+     * </ul>
+     *
+     * @param options descriptors for the configured options of a parser
+     */
+    protected void addRows( Collection<? extends OptionDescriptor> options ) {
         addNonOptionsDescription( options );
 
         if ( options.isEmpty() )
-            optionRows.add( "No options specified", "" );
+            addOptionRow( message( "no.options.specified" ) );
         else {
             addHeaders( options );
             addOptions( options );
@@ -141,34 +237,87 @@
         fitRowsToWidth();
     }
 
-    private void addNonOptionsDescription( Collection<? extends OptionDescriptor> options ) {
+    /**
+     * <p>Adds non-option arguments descriptions to the help output.</p>
+     *
+     * <p>This implementation:</p>
+     * <ul>
+     *     <li>{@linkplain #findAndRemoveNonOptionsSpec(java.util.Collection) Finds and removes the non-option
+     *     arguments descriptor}</li>
+     *     <li>{@linkplain #shouldShowNonOptionArgumentDisplay(OptionDescriptor) Decides whether there is
+     *     anything to show for non-option arguments}</li>
+     *     <li>If there is, {@linkplain #addNonOptionRow(String) adds a header row} and
+     *     {@linkplain #addNonOptionRow(String) adds a}
+     *     {@linkplain #createNonOptionArgumentsDisplay(OptionDescriptor) non-option arguments description} </li>
+     * </ul>
+     *
+     * @param options descriptors for the configured options of a parser
+     */
+    protected void addNonOptionsDescription( Collection<? extends OptionDescriptor> options ) {
         OptionDescriptor nonOptions = findAndRemoveNonOptionsSpec( options );
         if ( shouldShowNonOptionArgumentDisplay( nonOptions ) ) {
-            nonOptionRows.add( "Non-option arguments:", "" );
-            nonOptionRows.add(createNonOptionArgumentsDisplay(nonOptions), "");
+            addNonOptionRow( message( "non.option.arguments.header" ) );
+            addNonOptionRow( createNonOptionArgumentsDisplay( nonOptions ) );
         }
     }
 
-    private boolean shouldShowNonOptionArgumentDisplay( OptionDescriptor nonOptions ) {
-        return !Strings.isNullOrEmpty( nonOptions.description() )
-            || !Strings.isNullOrEmpty( nonOptions.argumentTypeIndicator() )
-            || !Strings.isNullOrEmpty( nonOptions.argumentDescription() );
+    /**
+     * <p>Decides whether or not to show a non-option arguments help.</p>
+     *
+     * <p>This implementation responds with {@code true} if the non-option descriptor has a non-{@code null},
+     * non-empty value for any of {@link OptionDescriptor#description()},
+     * {@link OptionDescriptor#argumentTypeIndicator()}, or {@link OptionDescriptor#argumentDescription()}.</p>
+     *
+     * @param nonOptionDescriptor non-option argument descriptor
+     * @return {@code true} if non-options argument help should be shown
+     */
+    protected boolean shouldShowNonOptionArgumentDisplay( OptionDescriptor nonOptionDescriptor ) {
+        return !Strings.isNullOrEmpty( nonOptionDescriptor.description() )
+            || !Strings.isNullOrEmpty( nonOptionDescriptor.argumentTypeIndicator() )
+            || !Strings.isNullOrEmpty( nonOptionDescriptor.argumentDescription() );
     }
 
-    private String createNonOptionArgumentsDisplay(OptionDescriptor nonOptions) {
+    /**
+     * <p>Creates a non-options argument help string.</p>
+     *
+     * <p>This implementation creates an empty string buffer and calls
+     * {@link #maybeAppendOptionInfo(StringBuilder, OptionDescriptor)}
+     * and {@link #maybeAppendNonOptionsDescription(StringBuilder, OptionDescriptor)}, passing them the
+     * buffer and the non-option arguments descriptor.</p>
+     *
+     * @param nonOptionDescriptor non-option argument descriptor
+     * @return help string for non-options
+     */
+    protected String createNonOptionArgumentsDisplay( OptionDescriptor nonOptionDescriptor ) {
         StringBuilder buffer = new StringBuilder();
-        maybeAppendOptionInfo( buffer, nonOptions );
-        maybeAppendNonOptionsDescription( buffer, nonOptions );
+        maybeAppendOptionInfo( buffer, nonOptionDescriptor );
+        maybeAppendNonOptionsDescription( buffer, nonOptionDescriptor );
 
         return buffer.toString();
     }
 
-    private void maybeAppendNonOptionsDescription( StringBuilder buffer, OptionDescriptor nonOptions ) {
+    /**
+     * <p>Appends help for the given non-option arguments descriptor to the given buffer.</p>
+     *
+     * <p>This implementation appends {@code " -- "} if the buffer has text in it and the non-option arguments
+     * descriptor has a {@link OptionDescriptor#description()}; followed by the
+     * {@link OptionDescriptor#description()}.</p>
+     *
+     * @param buffer string buffer
+     * @param nonOptions non-option arguments descriptor
+     */
+    protected void maybeAppendNonOptionsDescription( StringBuilder buffer, OptionDescriptor nonOptions ) {
         buffer.append( buffer.length() > 0 && !Strings.isNullOrEmpty( nonOptions.description() ) ? " -- " : "" )
             .append( nonOptions.description() );
     }
 
-    private OptionDescriptor findAndRemoveNonOptionsSpec( Collection<? extends OptionDescriptor> options ) {
+    /**
+     * Finds the non-option arguments descriptor in the given collection, removes it, and returns it.
+     *
+     * @param options descriptors for the configured options of a parser
+     * @return the non-option arguments descriptor
+     */
+    protected OptionDescriptor findAndRemoveNonOptionsSpec( Collection<? extends OptionDescriptor> options ) {
         for ( Iterator<? extends OptionDescriptor> it = options.iterator(); it.hasNext(); ) {
             OptionDescriptor next = it.next();
             if ( next.representsNonOptions() ) {
@@ -180,17 +329,32 @@
         throw new AssertionError( "no non-options argument spec" );
     }
 
-    private void addHeaders( Collection<? extends OptionDescriptor> options ) {
+    /**
+     * <p>Adds help row headers for option help columns.</p>
+     *
+     * <p>This implementation uses the headers {@code "Option"} and {@code "Description"}. If the options contain
+     * a "required" option, the {@code "Option"} header looks like {@code "Option (* = required)}. Both headers
+     * are "underlined" using {@code "-"}.</p>
+     *
+     * @param options descriptors for the configured options of a parser
+     */
+    protected void addHeaders( Collection<? extends OptionDescriptor> options ) {
         if ( hasRequiredOption( options ) ) {
-            optionRows.add("Option (* = required)", "Description");
-            optionRows.add("---------------------", "-----------");
+            addOptionRow( message( "option.header.with.required.indicator" ), message( "description.header" ) );
+            addOptionRow( message( "option.divider.with.required.indicator" ), message( "description.divider" ) );
         } else {
-            optionRows.add("Option", "Description");
-            optionRows.add("------", "-----------");
+            addOptionRow( message( "option.header" ), message( "description.header" ) );
+            addOptionRow( message( "option.divider" ), message( "description.divider" ) );
         }
     }
 
-    private boolean hasRequiredOption( Collection<? extends OptionDescriptor> options ) {
+    /**
+     * Tells whether the given option descriptors contain a "required" option.
+     *
+     * @param options descriptors for the configured options of a parser
+     * @return {@code true} if at least one of the options is "required"
+     */
+    protected final boolean hasRequiredOption( Collection<? extends OptionDescriptor> options ) {
         for ( OptionDescriptor each : options ) {
             if ( each.isRequired() )
                 return true;
@@ -199,19 +363,46 @@
         return false;
     }
 
-    private void addOptions( Collection<? extends OptionDescriptor> options ) {
+    /**
+     * <p>Adds help rows for the given options.</p>
+     *
+     * <p>This implementation loops over the given options, and for each, calls {@link #addOptionRow(String, String)}
+     * using the results of {@link #createOptionDisplay(OptionDescriptor)} and
+     * {@link #createDescriptionDisplay(OptionDescriptor)}, respectively, as arguments.</p>
+     *
+     * @param options descriptors for the configured options of a parser
+     */
+    protected void addOptions( Collection<? extends OptionDescriptor> options ) {
         for ( OptionDescriptor each : options ) {
             if ( !each.representsNonOptions() )
-                optionRows.add( createOptionDisplay( each ), createDescriptionDisplay( each ) );
+                addOptionRow( createOptionDisplay( each ), createDescriptionDisplay( each ) );
         }
     }
 
-    private String createOptionDisplay( OptionDescriptor descriptor ) {
+    /**
+     * <p>Creates a string for how the given option descriptor is to be represented in help.</p>
+     *
+     * <p>This implementation gives a string consisting of the concatenation of:</p>
+     * <ul>
+     *     <li>{@code "* "} for "required" options, otherwise {@code ""}</li>
+     *     <li>For each of the {@link OptionDescriptor#options()} of the descriptor, separated by {@code ", "}:
+     *         <ul>
+     *             <li>{@link #optionLeader(String)} of the option</li>
+     *             <li>the option</li>
+     *         </ul>
+     *     </li>
+     *     <li>the result of {@link #maybeAppendOptionInfo(StringBuilder, OptionDescriptor)}</li>
+     * </ul>
+     *
+     * @param descriptor a descriptor for a configured option of a parser
+     * @return help string
+     */
+    protected String createOptionDisplay( OptionDescriptor descriptor ) {
         StringBuilder buffer = new StringBuilder( descriptor.isRequired() ? "* " : "" );
 
         for ( Iterator<String> i = descriptor.options().iterator(); i.hasNext(); ) {
             String option = i.next();
-            buffer.append( option.length() > 1 ? DOUBLE_HYPHEN : HYPHEN );
+            buffer.append( optionLeader( option ) );
             buffer.append( option );
 
             if ( i.hasNext() )
@@ -223,31 +414,105 @@
         return buffer.toString();
     }
 
-    private void maybeAppendOptionInfo( StringBuilder buffer, OptionDescriptor descriptor ) {
+    /**
+     * <p>Gives a string that represents the given option's "option leader" in help.</p>
+     *
+     * <p>This implementation answers with {@code "--"} for options of length greater than one; otherwise answers
+     * with {@code "-"}.</p>
+     *
+     * @param option a string option
+     * @return an "option leader" string
+     */
+    protected String optionLeader( String option ) {
+        return option.length() > 1 ? DOUBLE_HYPHEN : HYPHEN;
+    }
+
+    /**
+     * <p>Appends additional info about the given option to the given buffer.</p>
+     *
+     * <p>This implementation:</p>
+     * <ul>
+     *     <li>calls {@link #extractTypeIndicator(OptionDescriptor)} for the descriptor</li>
+     *     <li>calls {@link jdk.internal.joptsimple.OptionDescriptor#argumentDescription()} for the descriptor</li>
+     *     <li>if either of the above is present, calls
+     *     {@link #appendOptionHelp(StringBuilder, String, String, boolean)}</li>
+     * </ul>
+     *
+     * @param buffer string buffer
+     * @param descriptor a descriptor for a configured option of a parser
+     */
+    protected void maybeAppendOptionInfo( StringBuilder buffer, OptionDescriptor descriptor ) {
         String indicator = extractTypeIndicator( descriptor );
         String description = descriptor.argumentDescription();
-        if ( indicator != null || !isNullOrEmpty( description ) )
+        if ( descriptor.acceptsArguments()
+            || !isNullOrEmpty( description )
+            || descriptor.representsNonOptions() ) {
+
             appendOptionHelp( buffer, indicator, description, descriptor.requiresArgument() );
+        }
     }
 
-    private String extractTypeIndicator( OptionDescriptor descriptor ) {
+    /**
+     * <p>Gives an indicator of the type of arguments of the option described by the given descriptor,
+     * for use in help.</p>
+     *
+     * <p>This implementation asks for the {@link OptionDescriptor#argumentTypeIndicator()} of the given
+     * descriptor, and if it is present and not {@code "java.lang.String"}, parses it as a fully qualified
+     * class name and returns the base name of that class; otherwise returns {@code "String"}.</p>
+     *
+     * @param descriptor a descriptor for a configured option of a parser
+     * @return type indicator text
+     */
+    protected String extractTypeIndicator( OptionDescriptor descriptor ) {
         String indicator = descriptor.argumentTypeIndicator();
 
         if ( !isNullOrEmpty( indicator ) && !String.class.getName().equals( indicator ) )
             return shortNameOf( indicator );
 
-        return null;
+        return "String";
     }
 
-    private void appendOptionHelp( StringBuilder buffer, String typeIndicator, String description, boolean required ) {
+    /**
+     * <p>Appends info about an option's argument to the given buffer.</p>
+     *
+     * <p>This implementation calls {@link #appendTypeIndicator(StringBuilder, String, String, char, char)} with
+     * the surrounding characters {@code '<'} and {@code '>'} for options with {@code required} arguments, and
+     * with the surrounding characters {@code '['} and {@code ']'} for options with optional arguments.</p>
+     *
+     * @param buffer string buffer
+     * @param typeIndicator type indicator
+     * @param description type description
+     * @param required indicator of "required"-ness of the argument of the option
+     */
+    protected void appendOptionHelp( StringBuilder buffer, String typeIndicator, String description,
+                                     boolean required ) {
         if ( required )
             appendTypeIndicator( buffer, typeIndicator, description, '<', '>' );
         else
             appendTypeIndicator( buffer, typeIndicator, description, '[', ']' );
     }
 
-    private void appendTypeIndicator( StringBuilder buffer, String typeIndicator, String description,
-                                      char start, char end ) {
+    /**
+     * <p>Appends a type indicator for an option's argument to the given buffer.</p>
+     *
+     * <p>This implementation appends, in order:</p>
+     * <ul>
+     *     <li>{@code ' '}</li>
+     *     <li>{@code start}</li>
+     *     <li>the type indicator, if not {@code null}</li>
+     *     <li>if the description is present, then {@code ": "} plus the description if the type indicator is
+     *     present; otherwise the description only</li>
+     *     <li>{@code end}</li>
+     * </ul>
+     *
+     * @param buffer string buffer
+     * @param typeIndicator type indicator
+     * @param description type description
+     * @param start starting character
+     * @param end ending character
+     */
+    protected void appendTypeIndicator( StringBuilder buffer, String typeIndicator, String description,
+                                        char start, char end ) {
         buffer.append( ' ' ).append( start );
         if ( typeIndicator != null )
             buffer.append( typeIndicator );
@@ -262,21 +527,69 @@
         buffer.append( end );
     }
 
-    private String createDescriptionDisplay( OptionDescriptor descriptor ) {
+    /**
+     * <p>Gives a string representing a description of the option with the given descriptor.</p>
+     *
+     * <p>This implementation:</p>
+     * <ul>
+     *     <li>Asks for the descriptor's {@link OptionDescriptor#defaultValues()}</li>
+     *     <li>If they're not present, answers the descriptor's {@link OptionDescriptor#description()}.</li>
+     *     <li>If they are present, concatenates and returns:
+     *         <ul>
+     *             <li>the descriptor's {@link OptionDescriptor#description()}</li>
+     *             <li>{@code ' '}</li>
+     *             <li>{@code "default: "} plus the result of {@link #createDefaultValuesDisplay(java.util.List)},
+     *             surrounded by parentheses</li>
+     *         </ul>
+     *     </li>
+     * </ul>
+     *
+     * @param descriptor a descriptor for a configured option of a parser
+     * @return display text for the option's description
+     */
+    protected String createDescriptionDisplay( OptionDescriptor descriptor ) {
         List<?> defaultValues = descriptor.defaultValues();
         if ( defaultValues.isEmpty() )
             return descriptor.description();
 
         String defaultValuesDisplay = createDefaultValuesDisplay( defaultValues );
-        return ( descriptor.description() + ' ' + surround( "default: " + defaultValuesDisplay, '(', ')' ) ).trim();
+        return ( descriptor.description()
+            + ' '
+            + surround( message( "default.value.header" ) + ' ' + defaultValuesDisplay, '(', ')' )
+        ).trim();
     }
 
-    private String createDefaultValuesDisplay( List<?> defaultValues ) {
+    /**
+     * <p>Gives a display string for the default values of an option's argument.</p>
+     *
+     * <p>This implementation gives the {@link Object#toString()} of the first value if there is only one value,
+     * otherwise gives the {@link Object#toString()} of the whole list.</p>
+     *
+     * @param defaultValues some default values for a given option's argument
+     * @return a display string for those default values
+     */
+    protected String createDefaultValuesDisplay( List<?> defaultValues ) {
         return defaultValues.size() == 1 ? defaultValues.get( 0 ).toString() : defaultValues.toString();
     }
 
-    private void fitRowsToWidth() {
-        nonOptionRows.fitToWidth();
-        optionRows.fitToWidth();
+    /**
+     * <p>Looks up and gives a resource bundle message.</p>
+     *
+     * <p>This implementation looks in the bundle {@code "jdk.internal.joptsimple.HelpFormatterMessages"} in the default
+     * locale, using a key that is the concatenation of this class's fully qualified name, {@code '.'},
+     * and the given key suffix, formats the corresponding value using the given arguments, and returns
+     * the result.</p>
+     *
+     * @param keySuffix suffix to use when looking up the bundle message
+     * @param args arguments to fill in the message template with
+     * @return a formatted localized message
+     */
+    protected String message( String keySuffix, Object... args ) {
+        return Messages.message(
+            Locale.getDefault(),
+            "jdk.internal.joptsimple.HelpFormatterMessages",
+            BuiltinHelpFormatter.class,
+            keySuffix,
+            args );
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ExceptionMessages.properties	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,44 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+jdk.internal.joptsimple.IllegalOptionSpecificationException.message = {0} is not a legal option character
+jdk.internal.joptsimple.MissingRequiredOptionsException.message = Missing required option(s) {0}
+jdk.internal.joptsimple.MultipleArgumentsForOptionException.message = Found multiple arguments for option {0}, but you asked for only one
+jdk.internal.joptsimple.OptionArgumentConversionException.message = Cannot parse argument ''{0}'' of option {1}
+jdk.internal.joptsimple.OptionMissingRequiredArgumentException.message = Option {0} requires an argument
+jdk.internal.joptsimple.UnavailableOptionException.message = Option(s) {0} are unavailable given other options on the command line
+jdk.internal.joptsimple.UnconfiguredOptionException.message = Option(s) {0} not configured on this parser
+jdk.internal.joptsimple.UnrecognizedOptionException.message = {0} is not a recognized option
+jdk.internal.joptsimple.util.DateConverter.without.pattern.message = Value [{0}] does not match date/time pattern
+jdk.internal.joptsimple.util.DateConverter.with.pattern.message = Value [{0}] does not match date/time pattern [{1}]
+jdk.internal.joptsimple.util.RegexMatcher.message = Value [{0}] did not match regex [{1}]
+jdk.internal.joptsimple.util.EnumConverter.message = Value [{0}] is not one of [{1}]
+jdk.internal.joptsimple.util.PathConverter.file.existing.message = File [{0}] does not exist
+jdk.internal.joptsimple.util.PathConverter.directory.existing.message = Directory [{0}] does not exist
+jdk.internal.joptsimple.util.PathConverter.file.not.existing.message = File [{0}] does already exist
+jdk.internal.joptsimple.util.PathConverter.file.overwritable.message = File [{0}] is not overwritable
+jdk.internal.joptsimple.util.PathConverter.file.readable.message = File [{0}] is not readable
+jdk.internal.joptsimple.util.PathConverter.file.writable.message = File [{0}] is not writable
+jdk.internal.joptsimple.util.InetAddressConverter.message = Cannot convert value [{0}] into an InetAddress
\ No newline at end of file
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/HelpFormatter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/HelpFormatter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/HelpFormatterMessages.properties	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,36 @@
+#
+# Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+jdk.internal.joptsimple.BuiltinHelpFormatter.no.options.specified = No options specified
+jdk.internal.joptsimple.BuiltinHelpFormatter.non.option.arguments.header = Non-option arguments:
+jdk.internal.joptsimple.BuiltinHelpFormatter.option.header.with.required.indicator = Option (* = required)
+jdk.internal.joptsimple.BuiltinHelpFormatter.option.divider.with.required.indicator = ---------------------
+jdk.internal.joptsimple.BuiltinHelpFormatter.option.header = Option
+jdk.internal.joptsimple.BuiltinHelpFormatter.option.divider = ------
+jdk.internal.joptsimple.BuiltinHelpFormatter.description.header = Description
+jdk.internal.joptsimple.BuiltinHelpFormatter.description.divider = -----------
+jdk.internal.joptsimple.BuiltinHelpFormatter.default.value.header = default:
+jdk.internal.joptsimple.AlternativeLongOptionSpec.description = Alternative form of long options
+jdk.internal.joptsimple.AlternativeLongOptionSpec.arg.description = opt=value
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/IllegalOptionSpecificationException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/IllegalOptionSpecificationException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -70,7 +70,7 @@
     }
 
     @Override
-    public String getMessage() {
-        return singleOptionMessage() + " is not a legal option character";
+    Object[] messageArguments() {
+        return new Object[] { singleOptionString() };
     }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/MissingRequiredOptionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +0,0 @@
-/*
- * 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
- * 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 is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * The MIT License
- *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package jdk.internal.joptsimple;
-
-import java.util.Collection;
-
-/**
- * Thrown when an option is marked as required, but not specified on the command line.
- *
- * @author <a href="https://github.com/TC1">Emils Solmanis</a>
- */
-class MissingRequiredOptionException extends OptionException {
-    private static final long serialVersionUID = -1L;
-
-    protected MissingRequiredOptionException( Collection<String> options ) {
-        super( options );
-    }
-
-    @Override
-    public String getMessage() {
-        return "Missing required option(s) " + multipleOptionMessage();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/MissingRequiredOptionsException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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 is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package jdk.internal.joptsimple;
+
+import java.util.List;
+
+/**
+ * Thrown when options marked as required are not specified on the command line.
+ *
+ * @author <a href="https://github.com/TC1">Emils Solmanis</a>
+ */
+class MissingRequiredOptionsException extends OptionException {
+    private static final long serialVersionUID = -1L;
+
+    protected MissingRequiredOptionsException( List<? extends OptionSpec<?>> missingRequiredOptions ) {
+        super( missingRequiredOptions );
+    }
+
+    @Override
+    Object[] messageArguments() {
+        return new Object[] { multipleOptionString() };
+    }
+}
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/MultipleArgumentsForOptionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/MultipleArgumentsForOptionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,7 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import static java.util.Collections.*;
 
 /**
  * Thrown when asking an {@link OptionSet} for a single argument of an option when many have been specified.
@@ -65,12 +65,12 @@
 class MultipleArgumentsForOptionException extends OptionException {
     private static final long serialVersionUID = -1L;
 
-    MultipleArgumentsForOptionException( Collection<String> options ) {
-        super( options );
+    MultipleArgumentsForOptionException( OptionSpec<?> options ) {
+        super( singleton( options ) );
     }
 
     @Override
-    public String getMessage() {
-        return "Found multiple arguments for option " + multipleOptionMessage() + ", but you asked for only one";
+    Object[] messageArguments() {
+        return new Object[] { singleOptionString() };
     }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/NoArgumentOptionSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/NoArgumentOptionSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,6 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
 import java.util.List;
 
 import static java.util.Collections.*;
@@ -70,7 +69,7 @@
         this( singletonList( option ), "" );
     }
 
-    NoArgumentOptionSpec( Collection<String> options, String description ) {
+    NoArgumentOptionSpec( List<String> options, String description ) {
         super( options, description );
     }
 
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/NonOptionArgumentSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/NonOptionArgumentSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -87,7 +87,7 @@
     private String argumentDescription = "";
 
     NonOptionArgumentSpec() {
-        this("");
+        this( "" );
     }
 
     NonOptionArgumentSpec( String description ) {
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionArgumentConversionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionArgumentConversionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,7 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import static java.util.Collections.*;
 
 /**
  * Thrown when a problem occurs converting an argument of an option from {@link String} to another type.
@@ -67,14 +67,14 @@
 
     private final String argument;
 
-    OptionArgumentConversionException( Collection<String> options, String argument, Throwable cause ) {
-        super( options, cause );
+    OptionArgumentConversionException( OptionSpec<?> options, String argument, Throwable cause ) {
+        super( singleton( options ), cause );
 
         this.argument = argument;
     }
 
     @Override
-    public String getMessage() {
-        return "Cannot parse argument '" + argument + "' of option " + multipleOptionMessage();
+    Object[] messageArguments() {
+        return new Object[] { argument, singleOptionString() };
     }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionDeclarer.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionDeclarer.java	Fri Jun 08 09:40:28 2018 -0700
@@ -25,14 +25,20 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import java.util.List;
 
 /**
- * Trains the option parser. This interface aids integration with other code which may expose declaration of options but
- * not actual command-line parsing.
+ * Trains the option parser. This interface aids integration that disposes declaration of options but not actual
+ * command-line parsing.
+ *
+ * Typical use is for another class to implement {@code OptionDeclarer} as a facade, forwarding calls to an
+ * {@code OptionParser} instance.
+ *
+ * Note that although this is an interface, the returned values of calls are concrete jopt-simple classes.
  *
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
  * @see OptionParser
+ * @since 4.6
  */
 public interface OptionDeclarer {
     /**
@@ -78,12 +84,12 @@
      * @throws OptionException if any of the options contain illegal characters
      * @throws NullPointerException if the option list or any of its elements are {@code null}
      */
-    OptionSpecBuilder acceptsAll( Collection<String> options );
+    OptionSpecBuilder acceptsAll( List<String> options );
 
     /**
      * Tells the parser to recognize the given options, and treat them as synonymous.
      *
-     * @see #acceptsAll(Collection)
+     * @see #acceptsAll(List)
      * @param options the options to recognize and treat as synonymous
      * @param description a string that describes the purpose of the option.  This is used when generating help
      * information about the parser.
@@ -92,7 +98,7 @@
      * @throws NullPointerException if the option list or any of its elements are {@code null}
      * @throws IllegalArgumentException if the option list is empty
      */
-    OptionSpecBuilder acceptsAll( Collection<String> options, String description );
+    OptionSpecBuilder acceptsAll( List<String> options, String description );
 
     /**
      * Gives an object that represents an access point for non-option arguments on a command line.
@@ -127,7 +133,7 @@
     void allowsUnrecognizedOptions();
 
     /**
-     * Tells the parser either to recognize or ignore <kbd>"-W"</kbd>-style long options.
+     * Tells the parser either to recognize or ignore {@code -W}-style long options.
      *
      * @param recognize {@code true} if the parser is to recognize the special style of long options
      */
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionDescriptor.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionDescriptor.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,6 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
 import java.util.List;
 
 /**
@@ -70,7 +69,7 @@
      *
      * @return synonymous options
      */
-    Collection<String> options();
+    List<String> options();
 
     /**
      * Description of this option's purpose.
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -58,11 +58,15 @@
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Iterator;
+import java.util.LinkedHashSet;
 import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import jdk.internal.joptsimple.internal.Strings;
 
 import static java.util.Collections.*;
-
-import static jdk.internal.joptsimple.internal.Strings.*;
+import static jdk.internal.joptsimple.internal.Messages.*;
 
 /**
  * Thrown when a problem occurs during option parsing.
@@ -72,16 +76,30 @@
 public abstract class OptionException extends RuntimeException {
     private static final long serialVersionUID = -1L;
 
-    private final List<String> options = new ArrayList<String>();
+    private final List<String> options = new ArrayList<>();
 
-    protected OptionException( Collection<String> options ) {
+    protected OptionException( List<String> options ) {
         this.options.addAll( options );
     }
 
-    protected OptionException( Collection<String> options, Throwable cause ) {
+    protected OptionException( Collection<? extends OptionSpec<?>> options ) {
+        this.options.addAll( specsToStrings( options ) );
+    }
+
+    protected OptionException( Collection<? extends OptionSpec<?>> options, Throwable cause ) {
         super( cause );
+        this.options.addAll( specsToStrings( options ) );
+    }
 
-        this.options.addAll( options );
+    private List<String> specsToStrings( Collection<? extends OptionSpec<?>> options ) {
+        List<String> strings = new ArrayList<>();
+        for ( OptionSpec<?> each : options )
+            strings.add( specToString( each ) );
+        return strings;
+    }
+
+    private String specToString( OptionSpec<?> option ) {
+        return Strings.join( new ArrayList<>( option.options() ), "/" );
     }
 
     /**
@@ -89,23 +107,24 @@
      *
      * @return the option being considered when the exception was created
      */
-    public Collection<String> options() {
-        return unmodifiableCollection( options );
+    public List<String> options() {
+        return unmodifiableList( options );
     }
 
-    protected final String singleOptionMessage() {
-        return singleOptionMessage( options.get( 0 ) );
+    protected final String singleOptionString() {
+        return singleOptionString( options.get( 0 ) );
     }
 
-    protected final String singleOptionMessage( String option ) {
-        return SINGLE_QUOTE + option + SINGLE_QUOTE;
+    protected final String singleOptionString( String option ) {
+        return option;
     }
 
-    protected final String multipleOptionMessage() {
+    protected final String multipleOptionString() {
         StringBuilder buffer = new StringBuilder( "[" );
 
-        for ( Iterator<String> iter = options.iterator(); iter.hasNext(); ) {
-            buffer.append( singleOptionMessage( iter.next() ) );
+        Set<String> asSet = new LinkedHashSet<String>( options );
+        for ( Iterator<String> iter = asSet.iterator(); iter.hasNext(); ) {
+            buffer.append( singleOptionString(iter.next()) );
             if ( iter.hasNext() )
                 buffer.append( ", " );
         }
@@ -118,4 +137,19 @@
     static OptionException unrecognizedOption( String option ) {
         return new UnrecognizedOptionException( option );
     }
+
+    @Override
+    public final String getMessage() {
+        return localizedMessage( Locale.getDefault() );
+    }
+
+    final String localizedMessage( Locale locale ) {
+        return formattedMessage( locale );
+    }
+
+    private String formattedMessage( Locale locale ) {
+        return message( locale, "jdk.internal.joptsimple.ExceptionMessages", getClass(), "message", messageArguments() );
+    }
+
+    abstract Object[] messageArguments();
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionMissingRequiredArgumentException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionMissingRequiredArgumentException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,22 +55,22 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import static java.util.Arrays.*;
 
 /**
- * Thrown when the option parser discovers an option that requires an argument, but that argument is missing.
+ * Thrown when the option parser discovers options that require an argument, but are missing an argument.
  *
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
  */
 class OptionMissingRequiredArgumentException extends OptionException {
     private static final long serialVersionUID = -1L;
 
-    OptionMissingRequiredArgumentException( Collection<String> options ) {
-        super( options );
+    OptionMissingRequiredArgumentException( OptionSpec<?> option ) {
+        super( asList( option ) );
     }
 
     @Override
-    public String getMessage() {
-        return "Option " + multipleOptionMessage() + " requires an argument";
+    Object[] messageArguments() {
+        return new Object[] { singleOptionString() };
     }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionParser.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionParser.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,18 +55,16 @@
 
 package jdk.internal.joptsimple;
 
-import jdk.internal.joptsimple.internal.AbbreviationMap;
-import jdk.internal.joptsimple.util.KeyValuePair;
-
 import java.io.IOException;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.Writer;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
+
+import jdk.internal.joptsimple.internal.AbbreviationMap;
+import jdk.internal.joptsimple.internal.SimpleOptionNameMap;
+import jdk.internal.joptsimple.internal.OptionNameMap;
+import jdk.internal.joptsimple.util.KeyValuePair;
 
 import static java.util.Collections.*;
 import static jdk.internal.joptsimple.OptionException.*;
@@ -80,57 +78,58 @@
  * <p>This parser supports short options and long options.</p>
  *
  * <ul>
- *   <li><dfn>Short options</dfn> begin with a single hyphen ("<kbd>-</kbd>") followed by a single letter or digit,
- *   or question mark ("<kbd>?</kbd>"), or dot ("<kbd>.</kbd>").</li>
+ *   <li><dfn>Short options</dfn> begin with a single hyphen ("{@code -}") followed by a single letter or digit,
+ *   or question mark ("{@code ?}"), or dot ("{@code .}"), or underscore ("{@code _}").</li>
  *
  *   <li>Short options can accept single arguments. The argument can be made required or optional. The option's
  *   argument can occur:
  *     <ul>
- *       <li>in the slot after the option, as in <kbd>-d /tmp</kbd></li>
- *       <li>right up against the option, as in <kbd>-d/tmp</kbd></li>
- *       <li>right up against the option separated by an equals sign (<kbd>"="</kbd>), as in <kbd>-d=/tmp</kbd></li>
+ *       <li>in the slot after the option, as in {@code -d /tmp}</li>
+ *       <li>right up against the option, as in {@code -d/tmp}</li>
+ *       <li>right up against the option separated by an equals sign ({@code "="}), as in {@code -d=/tmp}</li>
  *     </ul>
  *   To specify <em>n</em> arguments for an option, specify the option <em>n</em> times, once for each argument,
- *   as in <kbd>-d /tmp -d /var -d /opt</kbd>; or, when using the
+ *   as in {@code -d /tmp -d /var -d /opt}; or, when using the
  *   {@linkplain ArgumentAcceptingOptionSpec#withValuesSeparatedBy(char) "separated values"} clause of the "fluent
  *   interface" (see below), give multiple values separated by a given character as a single argument to the
  *   option.</li>
  *
- *   <li>Short options can be clustered, so that <kbd>-abc</kbd> is treated as <kbd>-a -b -c</kbd>. If a short option
+ *   <li>Short options can be clustered, so that {@code -abc} is treated as {@code -a -b -c}. If a short option
  *   in the cluster can accept an argument, the remaining characters are interpreted as the argument for that
  *   option.</li>
  *
- *   <li>An argument consisting only of two hyphens (<kbd>"--"</kbd>) signals that the remaining arguments are to be
+ *   <li>An argument consisting only of two hyphens ({@code "--"}) signals that the remaining arguments are to be
  *   treated as non-options.</li>
  *
  *   <li>An argument consisting only of a single hyphen is considered a non-option argument (though it can be an
  *   argument of an option). Many Unix programs treat single hyphens as stand-ins for the standard input or standard
  *   output streams.</li>
  *
- *   <li><dfn>Long options</dfn> begin with two hyphens (<kbd>"--"</kbd>), followed by multiple letters, digits,
+ *   <li><dfn>Long options</dfn> begin with two hyphens ({@code "--"}), followed by multiple letters, digits,
  *   hyphens, question marks, or dots. A hyphen cannot be the first character of a long option specification when
  *   configuring the parser.</li>
  *
- *   <li>You can abbreviate long options, so long as the abbreviation is unique.</li>
+ *   <li>You can abbreviate long options, so long as the abbreviation is unique. Suppress this behavior if
+ *   you wish using {@linkplain OptionParser#OptionParser(boolean) this constructor}.</li>
  *
  *   <li>Long options can accept single arguments.  The argument can be made required or optional.  The option's
  *   argument can occur:
  *     <ul>
- *       <li>in the slot after the option, as in <kbd>--directory /tmp</kbd></li>
- *       <li>right up against the option separated by an equals sign (<kbd>"="</kbd>), as in
- *       <kbd>--directory=/tmp</kbd>
+ *       <li>in the slot after the option, as in {@code --directory /tmp}</li>
+ *       <li>right up against the option separated by an equals sign ({@code "="}), as in
+ *       {@code --directory=/tmp}
  *     </ul>
  *   Specify multiple arguments for a long option in the same manner as for short options (see above).</li>
  *
- *   <li>You can use a single hyphen (<kbd>"-"</kbd>) instead of a double hyphen (<kbd>"--"</kbd>) for a long
+ *   <li>You can use a single hyphen ({@code "-"}) instead of a double hyphen ({@code "--"}) for a long
  *   option.</li>
  *
- *   <li>The option <kbd>-W</kbd> is reserved.  If you tell the parser to {@linkplain
+ *   <li>The option {@code -W} is reserved.  If you tell the parser to {@linkplain
  *   #recognizeAlternativeLongOptions(boolean) recognize alternative long options}, then it will treat, for example,
- *   <kbd>-W foo=bar</kbd> as the long option <kbd>foo</kbd> with argument <kbd>bar</kbd>, as though you had written
- *   <kbd>--foo=bar</kbd>.</li>
+ *   {@code -W foo=bar} as the long option {@code foo} with argument {@code bar}, as though you had written
+ *   {@code --foo=bar}.</li>
  *
- *   <li>You can specify <kbd>-W</kbd> as a valid short option, or use it as an abbreviation for a long option, but
+ *   <li>You can specify {@code -W} as a valid short option, or use it as an abbreviation for a long option, but
  *   {@linkplain #recognizeAlternativeLongOptions(boolean) recognizing alternative long options} will always supersede
  *   this behavior.</li>
  *
@@ -148,15 +147,15 @@
  *     parser.accepts( "2" );
  *     OptionSet options = parser.parse( "-a", "-2" );
  *   </code></pre>
- *   In this case, the option set contains <kbd>"a"</kbd> with argument <kbd>-2</kbd>, not both <kbd>"a"</kbd> and
- *   <kbd>"2"</kbd>. Swapping the elements in the <em>args</em> array gives the latter.</li>
+ *   In this case, the option set contains {@code "a"} with argument {@code -2}, not both {@code "a"} and
+ *   {@code "2"}. Swapping the elements in the <em>args</em> array gives the latter.</li>
  * </ul>
  *
  * <p>There are two ways to tell the parser what options to recognize:</p>
  *
  * <ol>
  *   <li>A "fluent interface"-style API for specifying options, available since version 2. Sentences in this fluent
- *   interface language begin with a call to {@link #accepts(String) accepts} or {@link #acceptsAll(Collection)
+ *   interface language begin with a call to {@link #accepts(String) accepts} or {@link #acceptsAll(List)
  *   acceptsAll} methods; calls on the ensuing chain of objects describe whether the options can take an argument,
  *   whether the argument is required or optional, to what type arguments of the options should be converted if any,
  *   etc. Since version 3, these calls return an instance of {@link OptionSpec}, which can subsequently be used to
@@ -169,28 +168,28 @@
  *     <ul>
  *       <li>Any letter or digit is treated as an option character.</li>
  *
- *       <li>An option character can be immediately followed by an asterisk (*) to indicate that the option is a
- *       "help" option.</li>
+ *       <li>An option character can be immediately followed by an asterisk ({@code *)} to indicate that
+ *       the option is a "help" option.</li>
  *
- *       <li>If an option character (with possible trailing asterisk) is followed by a single colon (<kbd>":"</kbd>),
+ *       <li>If an option character (with possible trailing asterisk) is followed by a single colon ({@code ":"}),
  *       then the option requires an argument.</li>
  *
- *       <li>If an option character (with possible trailing asterisk) is followed by two colons (<kbd>"::"</kbd>),
+ *       <li>If an option character (with possible trailing asterisk) is followed by two colons ({@code "::"}),
  *       then the option accepts an optional argument.</li>
  *
  *       <li>Otherwise, the option character accepts no argument.</li>
  *
- *       <li>If the option specification string begins with a plus sign (<kbd>"+"</kbd>), the parser will behave
+ *       <li>If the option specification string begins with a plus sign ({@code "+" }), the parser will behave
  *       "POSIX-ly correct".</li>
  *
- *       <li>If the option specification string contains the sequence <kbd>"W;"</kbd> (capital W followed by a
+ *       <li>If the option specification string contains the sequence {@code "W;"} (capital W followed by a
  *       semicolon), the parser will recognize the alternative form of long options.</li>
  *     </ul>
  *   </li>
  * </ol>
  *
- * <p>Each of the options in a list of options given to {@link #acceptsAll(Collection) acceptsAll} is treated as a
- * synonym of the others.  For example:
+ * <p>Each of the options in a list of options given to {@link #acceptsAll(List) acceptsAll} is treated as a
+ * synonym of the others.  For example:</p>
  *   <pre>
  *     <code>
  *     OptionParser parser = new OptionParser();
@@ -198,14 +197,14 @@
  *     OptionSet options = parser.parse( "-w" );
  *     </code>
  *   </pre>
- * In this case, <code>options.{@link OptionSet#has(String) has}</code> would answer {@code true} when given arguments
- * <kbd>"w"</kbd>, <kbd>"interactive"</kbd>, and <kbd>"confirmation"</kbd>. The {@link OptionSet} would give the same
+ * <p>In this case, <code>options.{@link OptionSet#has(String) has}</code> would answer {@code true} when given arguments
+ * {@code "w"}, {@code "interactive"}, and {@code "confirmation"}. The {@link OptionSet} would give the same
  * responses to these arguments for its other methods as well.</p>
  *
  * <p>By default, as with GNU {@code getopt()}, the parser allows intermixing of options and non-options. If, however,
  * the parser has been created to be "POSIX-ly correct", then the first argument that does not look lexically like an
  * option, and is not a required argument of a preceding option, signals the end of options. You can still bind
- * optional arguments to their options using the abutting (for short options) or <kbd>=</kbd> syntax.</p>
+ * optional arguments to their options using the abutting (for short options) or {@code =} syntax.</p>
  *
  * <p>Unlike GNU {@code getopt()}, this parser does not honor the environment variable {@code POSIXLY_CORRECT}.
  * "POSIX-ly correct" parsers are configured by either:</p>
@@ -214,16 +213,20 @@
  *   <li>using the method {@link #posixlyCorrect(boolean)}, or</li>
  *
  *   <li>using the {@linkplain #OptionParser(String) constructor} with an argument whose first character is a plus sign
- *   (<kbd>"+"</kbd>)</li>
+ *   ({@code "+"})</li>
  * </ol>
  *
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
  * @see <a href="http://www.gnu.org/software/libc/manual">The GNU C Library</a>
  */
 public class OptionParser implements OptionDeclarer {
-    private final AbbreviationMap<AbstractOptionSpec<?>> recognizedOptions;
-    private final Map<Collection<String>, Set<OptionSpec<?>>> requiredIf;
-    private final Map<Collection<String>, Set<OptionSpec<?>>> requiredUnless;
+    private final OptionNameMap<AbstractOptionSpec<?>> recognizedOptions;
+    private final ArrayList<AbstractOptionSpec<?>> trainingOrder;
+    private final Map<List<String>, Set<OptionSpec<?>>> requiredIf;
+    private final Map<List<String>, Set<OptionSpec<?>>> requiredUnless;
+    private final Map<List<String>, Set<OptionSpec<?>>> availableIf;
+    private final Map<List<String>, Set<OptionSpec<?>>> availableUnless;
+
     private OptionParserState state;
     private boolean posixlyCorrect;
     private boolean allowsUnrecognizedOptions;
@@ -234,11 +237,28 @@
      * behavior.
      */
     public OptionParser() {
-        recognizedOptions = new AbbreviationMap<AbstractOptionSpec<?>>();
-        requiredIf = new HashMap<Collection<String>, Set<OptionSpec<?>>>();
-        requiredUnless = new HashMap<Collection<String>, Set<OptionSpec<?>>>();
+        this(true);
+    }
+
+    /**
+     * Creates an option parser that initially recognizes no options, and does not exhibit "POSIX-ly correct"
+     * behavior.
+     *
+     * @param allowAbbreviations whether unambiguous abbreviations of long options should be recognized
+     * by the parser
+     */
+    public OptionParser( boolean allowAbbreviations ) {
+        trainingOrder = new ArrayList<>();
+        requiredIf = new HashMap<>();
+        requiredUnless = new HashMap<>();
+        availableIf = new HashMap<>();
+        availableUnless = new HashMap<>();
         state = moreOptions( false );
 
+        recognizedOptions = allowAbbreviations
+            ? new AbbreviationMap<AbstractOptionSpec<?>>()
+            : new SimpleOptionNameMap<AbstractOptionSpec<?>>();
+
         recognize( new NonOptionArgumentSpec<String>() );
     }
 
@@ -266,11 +286,11 @@
         return acceptsAll( singletonList( option ), description );
     }
 
-    public OptionSpecBuilder acceptsAll( Collection<String> options ) {
+    public OptionSpecBuilder acceptsAll( List<String> options ) {
         return acceptsAll( options, "" );
     }
 
-    public OptionSpecBuilder acceptsAll( Collection<String> options, String description ) {
+    public OptionSpecBuilder acceptsAll( List<String> options, String description ) {
         if ( options.isEmpty() )
             throw new IllegalArgumentException( "need at least one option" );
 
@@ -280,7 +300,7 @@
     }
 
     public NonOptionArgumentSpec<String> nonOptions() {
-        NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<String>();
+        NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<>();
 
         recognize( spec );
 
@@ -288,7 +308,7 @@
     }
 
     public NonOptionArgumentSpec<String> nonOptions( String description ) {
-        NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<String>( description );
+        NonOptionArgumentSpec<String> spec = new NonOptionArgumentSpec<>( description );
 
         recognize( spec );
 
@@ -321,6 +341,7 @@
 
     void recognize( AbstractOptionSpec<?> spec ) {
         recognizedOptions.putAll( spec.options(), spec );
+        trainingOrder.add( spec );
     }
 
     /**
@@ -348,7 +369,7 @@
      * @see #printHelpOn(OutputStream)
      */
     public void printHelpOn( Writer sink ) throws IOException {
-        sink.write( helpFormatter.format( recognizedOptions.toJavaUtilMap() ) );
+        sink.write( helpFormatter.format( _recognizedOptions() ) );
         sink.flush();
     }
 
@@ -366,15 +387,29 @@
     }
 
     /**
-     * Retrieves all the options which have been configured for the parser.
+     * Retrieves all options-spec pairings which have been configured for the parser in the same order as declared
+     * during training. Option flags for specs are alphabetized by {@link OptionSpec#options()}; only the order of the
+     * specs is preserved.
      *
-     * @return a {@link Map} containing all the configured options and their corresponding {@link OptionSpec}
+     * (Note: prior to 4.7 the order was alphabetical across all options regardless of spec.)
+     *
+     * @return a map containing all the configured options and their corresponding {@link OptionSpec}
+     * @since 4.6
      */
     public Map<String, OptionSpec<?>> recognizedOptions() {
-        return new HashMap<String, OptionSpec<?>>( recognizedOptions.toJavaUtilMap() );
+        return new LinkedHashMap<String, OptionSpec<?>>( _recognizedOptions() );
     }
 
-    /**
+    private Map<String, AbstractOptionSpec<?>> _recognizedOptions() {
+        Map<String, AbstractOptionSpec<?>> options = new LinkedHashMap<>();
+        for ( AbstractOptionSpec<?> spec : trainingOrder ) {
+            for ( String option : spec.options() )
+                options.put( option, spec );
+        }
+        return options;
+    }
+
+   /**
      * Parses the given command line arguments according to the option specifications given to the parser.
      *
      * @param arguments arguments to parse
@@ -393,43 +428,87 @@
         reset();
 
         ensureRequiredOptions( detected );
+        ensureAllowedOptions( detected );
 
         return detected;
     }
 
+    /**
+     * Mandates mutual exclusiveness for the options built by the specified builders.
+     *
+     * @param specs descriptors for options that should be mutually exclusive on a command line.
+     * @throws NullPointerException if {@code specs} is {@code null}
+     */
+    public void mutuallyExclusive( OptionSpecBuilder... specs ) {
+        for ( int i = 0; i < specs.length; i++ ) {
+            for ( int j = 0; j < specs.length; j++ ) {
+                if ( i != j )
+                    specs[i].availableUnless( specs[j] );
+            }
+        }
+    }
+
     private void ensureRequiredOptions( OptionSet options ) {
-        Collection<String> missingRequiredOptions = missingRequiredOptions( options );
+        List<AbstractOptionSpec<?>> missingRequiredOptions = missingRequiredOptions(options);
         boolean helpOptionPresent = isHelpOptionPresent( options );
 
         if ( !missingRequiredOptions.isEmpty() && !helpOptionPresent )
-            throw new MissingRequiredOptionException( missingRequiredOptions );
+            throw new MissingRequiredOptionsException( missingRequiredOptions );
     }
 
-    private Collection<String> missingRequiredOptions( OptionSet options ) {
-        Collection<String> missingRequiredOptions = new HashSet<String>();
+    private void ensureAllowedOptions( OptionSet options ) {
+        List<AbstractOptionSpec<?>> forbiddenOptions = unavailableOptions( options );
+        boolean helpOptionPresent = isHelpOptionPresent( options );
+
+        if ( !forbiddenOptions.isEmpty() && !helpOptionPresent )
+            throw new UnavailableOptionException( forbiddenOptions );
+    }
+
+    private List<AbstractOptionSpec<?>> missingRequiredOptions( OptionSet options ) {
+        List<AbstractOptionSpec<?>> missingRequiredOptions = new ArrayList<>();
 
         for ( AbstractOptionSpec<?> each : recognizedOptions.toJavaUtilMap().values() ) {
             if ( each.isRequired() && !options.has( each ) )
-                missingRequiredOptions.addAll( each.options() );
+                missingRequiredOptions.add(each);
+        }
+
+        for ( Map.Entry<List<String>, Set<OptionSpec<?>>> each : requiredIf.entrySet() ) {
+            AbstractOptionSpec<?> required = specFor( each.getKey().iterator().next() );
+
+            if ( optionsHasAnyOf( options, each.getValue() ) && !options.has( required ) )
+                missingRequiredOptions.add( required );
         }
 
-        for ( Map.Entry<Collection<String>, Set<OptionSpec<?>>> eachEntry : requiredIf.entrySet() ) {
-            AbstractOptionSpec<?> required = specFor( eachEntry.getKey().iterator().next() );
+        for ( Map.Entry<List<String>, Set<OptionSpec<?>>> each : requiredUnless.entrySet() ) {
+            AbstractOptionSpec<?> required = specFor(each.getKey().iterator().next());
+
+            if ( !optionsHasAnyOf( options, each.getValue() ) && !options.has( required ) )
+                missingRequiredOptions.add( required );
+        }
 
-            if ( optionsHasAnyOf( options, eachEntry.getValue() ) && !options.has( required ) ) {
-                missingRequiredOptions.addAll( required.options() );
+        return missingRequiredOptions;
+    }
+
+    private List<AbstractOptionSpec<?>> unavailableOptions(OptionSet options) {
+        List<AbstractOptionSpec<?>> unavailableOptions = new ArrayList<>();
+
+        for ( Map.Entry<List<String>, Set<OptionSpec<?>>> eachEntry : availableIf.entrySet() ) {
+            AbstractOptionSpec<?> forbidden = specFor( eachEntry.getKey().iterator().next() );
+
+            if ( !optionsHasAnyOf( options, eachEntry.getValue() ) && options.has( forbidden ) ) {
+                unavailableOptions.add(forbidden);
             }
         }
 
-        for ( Map.Entry<Collection<String>, Set<OptionSpec<?>>> eachEntry : requiredUnless.entrySet() ) {
-            AbstractOptionSpec<?> required = specFor( eachEntry.getKey().iterator().next() );
+        for ( Map.Entry<List<String>, Set<OptionSpec<?>>> eachEntry : availableUnless.entrySet() ) {
+            AbstractOptionSpec<?> forbidden = specFor( eachEntry.getKey().iterator().next() );
 
-            if ( !optionsHasAnyOf( options, eachEntry.getValue() ) && !options.has( required ) ) {
-                missingRequiredOptions.addAll( required.options() );
+            if ( optionsHasAnyOf( options, eachEntry.getValue() ) && options.has( forbidden ) ) {
+                unavailableOptions.add(forbidden);
             }
         }
 
-        return missingRequiredOptions;
+        return unavailableOptions;
     }
 
     private boolean optionsHasAnyOf( OptionSet options, Collection<OptionSpec<?>> specs ) {
@@ -443,12 +522,14 @@
 
     private boolean isHelpOptionPresent( OptionSet options ) {
         boolean helpOptionPresent = false;
+
         for ( AbstractOptionSpec<?> each : recognizedOptions.toJavaUtilMap().values() ) {
             if ( each.isForHelp() && options.has( each ) ) {
                 helpOptionPresent = true;
                 break;
             }
         }
+
         return helpOptionPresent;
     }
 
@@ -505,24 +586,40 @@
         return recognizedOptions.contains( option );
     }
 
-    void requiredIf( Collection<String> precedentSynonyms, String required ) {
+    void requiredIf( List<String> precedentSynonyms, String required ) {
         requiredIf( precedentSynonyms, specFor( required ) );
     }
 
-    void requiredIf( Collection<String> precedentSynonyms, OptionSpec<?> required ) {
-        putRequiredOption( precedentSynonyms, required, requiredIf );
+    void requiredIf( List<String> precedentSynonyms, OptionSpec<?> required ) {
+        putDependentOption( precedentSynonyms, required, requiredIf );
     }
 
-    void requiredUnless( Collection<String> precedentSynonyms, String required ) {
+    void requiredUnless( List<String> precedentSynonyms, String required ) {
         requiredUnless( precedentSynonyms, specFor( required ) );
     }
 
-    void requiredUnless( Collection<String> precedentSynonyms, OptionSpec<?> required ) {
-        putRequiredOption( precedentSynonyms, required, requiredUnless );
+    void requiredUnless( List<String> precedentSynonyms, OptionSpec<?> required ) {
+        putDependentOption( precedentSynonyms, required, requiredUnless );
+    }
+
+    void availableIf( List<String> precedentSynonyms, String available ) {
+        availableIf( precedentSynonyms, specFor( available ) );
     }
 
-    private void putRequiredOption( Collection<String> precedentSynonyms, OptionSpec<?> required,
-        Map<Collection<String>, Set<OptionSpec<?>>> target ) {
+    void availableIf( List<String> precedentSynonyms, OptionSpec<?> available) {
+        putDependentOption( precedentSynonyms, available, availableIf );
+    }
+
+    void availableUnless( List<String> precedentSynonyms, String available ) {
+        availableUnless( precedentSynonyms, specFor( available ) );
+    }
+
+    void availableUnless( List<String> precedentSynonyms, OptionSpec<?> available ) {
+        putDependentOption( precedentSynonyms, available, availableUnless );
+    }
+
+    private void putDependentOption( List<String> precedentSynonyms, OptionSpec<?> required,
+        Map<List<String>, Set<OptionSpec<?>>> target ) {
 
         for ( String each : precedentSynonyms ) {
             AbstractOptionSpec<?> spec = specFor( each );
@@ -532,7 +629,7 @@
 
         Set<OptionSpec<?>> associated = target.get( precedentSynonyms );
         if ( associated == null ) {
-            associated = new HashSet<OptionSpec<?>>();
+            associated = new HashSet<>();
             target.put( precedentSynonyms, associated );
         }
 
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionParserState.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionParserState.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSet.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSet.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,11 +55,14 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.IdentityHashMap;
+import java.util.List;
+import java.util.Map;
 
 import static java.util.Collections.*;
-
-import static jdk.internal.joptsimple.internal.Objects.*;
+import static java.util.Objects.*;
 
 /**
  * Representation of a group of detected command line options, their arguments, and non-option arguments.
@@ -77,9 +80,9 @@
      * Package-private because clients don't create these.
      */
     OptionSet( Map<String, AbstractOptionSpec<?>> recognizedSpecs ) {
-        detectedSpecs = new ArrayList<OptionSpec<?>>();
-        detectedOptions = new HashMap<String, AbstractOptionSpec<?>>();
-        optionsToArguments = new IdentityHashMap<AbstractOptionSpec<?>, List<String>>();
+        detectedSpecs = new ArrayList<>();
+        detectedOptions = new HashMap<>();
+        optionsToArguments = new IdentityHashMap<>();
         defaultValues = defaultValues( recognizedSpecs );
         this.recognizedSpecs = recognizedSpecs;
     }
@@ -90,7 +93,7 @@
      * @return {@code true} if any options were detected
      */
     public boolean hasOptions() {
-        return !detectedOptions.isEmpty();
+        return !( detectedOptions.size() == 1 && detectedOptions.values().iterator().next().representsNonOptions() );
     }
 
     /**
@@ -148,7 +151,7 @@
      * @see #hasArgument(String)
      */
     public boolean hasArgument( OptionSpec<?> option ) {
-        ensureNotNull( option );
+        requireNonNull( option );
 
         List<String> values = optionsToArguments.get( option );
         return values != null && !values.isEmpty();
@@ -169,7 +172,7 @@
      * @throws OptionException if more than one argument was detected for the option
      */
     public Object valueOf( String option ) {
-        ensureNotNull( option );
+        requireNonNull( option );
 
         AbstractOptionSpec<?> spec = detectedOptions.get( option );
         if ( spec == null ) {
@@ -194,7 +197,7 @@
      * @throws ClassCastException if the arguments of this option are not of the expected type
      */
     public <V> V valueOf( OptionSpec<V> option ) {
-        ensureNotNull( option );
+        requireNonNull( option );
 
         List<V> values = valuesOf( option );
         switch ( values.size() ) {
@@ -203,7 +206,7 @@
             case 1:
                 return values.get( 0 );
             default:
-                throw new MultipleArgumentsForOptionException( option.options() );
+                throw new MultipleArgumentsForOptionException( option );
         }
     }
 
@@ -217,7 +220,7 @@
      * @throws NullPointerException if {@code option} is {@code null}
      */
     public List<?> valuesOf( String option ) {
-        ensureNotNull( option );
+        requireNonNull( option );
 
         AbstractOptionSpec<?> spec = detectedOptions.get( option );
         return spec == null ? defaultValuesFor( option ) : valuesOf( spec );
@@ -238,14 +241,14 @@
      * example, if the type does not implement a correct conversion constructor or method
      */
     public <V> List<V> valuesOf( OptionSpec<V> option ) {
-        ensureNotNull( option );
+        requireNonNull( option );
 
         List<String> values = optionsToArguments.get( option );
         if ( values == null || values.isEmpty() )
             return defaultValueFor( option );
 
         AbstractOptionSpec<V> spec = (AbstractOptionSpec<V>) option;
-        List<V> convertedValues = new ArrayList<V>();
+        List<V> convertedValues = new ArrayList<>();
         for ( String each : values )
             convertedValues.add( spec.convert( each ) );
 
@@ -260,7 +263,7 @@
      */
     public List<OptionSpec<?>> specs() {
         List<OptionSpec<?>> specs = detectedSpecs;
-        specs.remove( detectedOptions.get( NonOptionArgumentSpec.NAME ) );
+        specs.removeAll( singletonList( detectedOptions.get( NonOptionArgumentSpec.NAME ) ) );
 
         return unmodifiableList( specs );
     }
@@ -271,10 +274,13 @@
      * @return the declared options as a map
      */
     public Map<OptionSpec<?>, List<?>> asMap() {
-        Map<OptionSpec<?>, List<?>> map = new HashMap<OptionSpec<?>, List<?>>();
-        for ( AbstractOptionSpec<?> spec : recognizedSpecs.values() )
+        Map<OptionSpec<?>, List<?>> map = new HashMap<>();
+
+        for ( AbstractOptionSpec<?> spec : recognizedSpecs.values() ) {
             if ( !spec.representsNonOptions() )
                 map.put( spec, valuesOf( spec ) );
+        }
+
         return unmodifiableMap( map );
     }
 
@@ -282,7 +288,8 @@
      * @return the detected non-option arguments
      */
     public List<?> nonOptionArguments() {
-        return unmodifiableList( valuesOf( detectedOptions.get( NonOptionArgumentSpec.NAME ) ) );
+        AbstractOptionSpec<?> spec = detectedOptions.get( NonOptionArgumentSpec.NAME );
+        return valuesOf( spec );
     }
 
     void add( AbstractOptionSpec<?> spec ) {
@@ -298,7 +305,7 @@
         List<String> optionArguments = optionsToArguments.get( spec );
 
         if ( optionArguments == null ) {
-            optionArguments = new ArrayList<String>();
+            optionArguments = new ArrayList<>();
             optionsToArguments.put( spec, optionArguments );
         }
 
@@ -315,25 +322,22 @@
             return false;
 
         OptionSet other = (OptionSet) that;
-        Map<AbstractOptionSpec<?>, List<String>> thisOptionsToArguments =
-            new HashMap<AbstractOptionSpec<?>, List<String>>( optionsToArguments );
-        Map<AbstractOptionSpec<?>, List<String>> otherOptionsToArguments =
-            new HashMap<AbstractOptionSpec<?>, List<String>>( other.optionsToArguments );
+        Map<AbstractOptionSpec<?>, List<String>> thisOptionsToArguments = new HashMap<>( optionsToArguments );
+        Map<AbstractOptionSpec<?>, List<String>> otherOptionsToArguments = new HashMap<>( other.optionsToArguments );
         return detectedOptions.equals( other.detectedOptions )
             && thisOptionsToArguments.equals( otherOptionsToArguments );
     }
 
     @Override
     public int hashCode() {
-        Map<AbstractOptionSpec<?>, List<String>> thisOptionsToArguments =
-            new HashMap<AbstractOptionSpec<?>, List<String>>( optionsToArguments );
+        Map<AbstractOptionSpec<?>, List<String>> thisOptionsToArguments = new HashMap<>( optionsToArguments );
         return detectedOptions.hashCode() ^ thisOptionsToArguments.hashCode();
     }
 
     @SuppressWarnings( "unchecked" )
     private <V> List<V> defaultValuesFor( String option ) {
         if ( defaultValues.containsKey( option ) )
-            return (List<V>) defaultValues.get( option );
+            return unmodifiableList( (List<V>) defaultValues.get( option ) );
 
         return emptyList();
     }
@@ -343,7 +347,7 @@
     }
 
     private static Map<String, List<?>> defaultValues( Map<String, AbstractOptionSpec<?>> recognizedSpecs ) {
-        Map<String, List<?>> defaults = new HashMap<String, List<?>>();
+        Map<String, List<?>> defaults = new HashMap<>();
         for ( Map.Entry<String, AbstractOptionSpec<?>> each : recognizedSpecs.entrySet() )
             defaults.put( each.getKey(), each.getValue().defaultValues() );
         return defaults;
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,6 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
 import java.util.List;
 
 /**
@@ -116,7 +115,7 @@
     /**
      * @return the string representations of this option
      */
-    Collection<String> options();
+    List<String> options();
 
     /**
      * Tells whether this option is designated as a "help" option. The presence of a "help" option on a command line
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSpecBuilder.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSpecBuilder.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -56,7 +56,6 @@
 package jdk.internal.joptsimple;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
 
@@ -90,7 +89,7 @@
 public class OptionSpecBuilder extends NoArgumentOptionSpec {
     private final OptionParser parser;
 
-    OptionSpecBuilder( OptionParser parser, Collection<String> options, String description ) {
+    OptionSpecBuilder( OptionParser parser, List<String> options, String description ) {
         super( options, description );
 
         this.parser = parser;
@@ -107,8 +106,7 @@
      * @return a specification for the option
      */
     public ArgumentAcceptingOptionSpec<String> withRequiredArg() {
-        ArgumentAcceptingOptionSpec<String> newSpec =
-            new RequiredArgumentOptionSpec<String>( options(), description() );
+        ArgumentAcceptingOptionSpec<String> newSpec = new RequiredArgumentOptionSpec<>( options(), description() );
         parser.recognize( newSpec );
 
         return newSpec;
@@ -121,7 +119,7 @@
      */
     public ArgumentAcceptingOptionSpec<String> withOptionalArg() {
         ArgumentAcceptingOptionSpec<String> newSpec =
-            new OptionalArgumentOptionSpec<String>( options(), description() );
+            new OptionalArgumentOptionSpec<>( options(), description() );
         parser.recognize( newSpec );
 
         return newSpec;
@@ -141,9 +139,8 @@
      */
     public OptionSpecBuilder requiredIf( String dependent, String... otherDependents ) {
         List<String> dependents = validatedDependents( dependent, otherDependents );
-        for ( String each : dependents ) {
+        for ( String each : dependents )
             parser.requiredIf( options(), each );
-        }
 
         return this;
     }
@@ -210,8 +207,91 @@
         return this;
     }
 
+    /**
+     * <p>Informs an option parser that this builder's option is allowed if the given option is present on the command
+     * line.</p>
+     *
+     * <p>For a given option, you <em>should not</em> mix this with {@link #availableUnless(String, String...)
+     * availableUnless} to avoid conflicts.</p>
+     *
+     * @param dependent an option whose presence on a command line makes this builder's option allowed
+     * @param otherDependents other options whose presence on a command line makes this builder's option allowed
+     * @return self, so that the caller can add clauses to the fluent interface sentence
+     * @throws OptionException if any of the dependent options haven't been configured in the parser yet
+     */
+    public OptionSpecBuilder availableIf( String dependent, String... otherDependents ) {
+        List<String> dependents = validatedDependents( dependent, otherDependents );
+        for ( String each : dependents )
+            parser.availableIf( options(), each );
+
+        return this;
+    }
+
+    /**
+     * <p>Informs an option parser that this builder's option is allowed if the given option is present on the command
+     * line.</p>
+     *
+     * <p>For a given option, you <em>should not</em> mix this with {@link #availableUnless(OptionSpec, OptionSpec[])
+     * requiredUnless} to avoid conflicts.</p>
+     *
+     * <p>This method recognizes only instances of options returned from the fluent interface methods.</p>
+     *
+     * @param dependent the option whose presence on a command line makes this builder's option allowed
+     * @param otherDependents other options whose presence on a command line makes this builder's option allowed
+     * @return self, so that the caller can add clauses to the fluent interface sentence
+     */
+    public OptionSpecBuilder availableIf( OptionSpec<?> dependent, OptionSpec<?>... otherDependents ) {
+        parser.availableIf( options(), dependent );
+
+        for ( OptionSpec<?> each : otherDependents )
+            parser.availableIf( options(), each );
+
+        return this;
+    }
+
+    /**
+     * <p>Informs an option parser that this builder's option is allowed if the given option is absent on the command
+     * line.</p>
+     *
+     * <p>For a given option, you <em>should not</em> mix this with {@link #availableIf(OptionSpec, OptionSpec[])
+     * requiredIf} to avoid conflicts.</p>
+     *
+     * @param dependent an option whose absence on a command line makes this builder's option allowed
+     * @param otherDependents other options whose absence on a command line makes this builder's option allowed
+     * @return self, so that the caller can add clauses to the fluent interface sentence
+     * @throws OptionException if any of the dependent options haven't been configured in the parser yet
+     */
+    public OptionSpecBuilder availableUnless( String dependent, String... otherDependents ) {
+        List<String> dependents = validatedDependents( dependent, otherDependents );
+        for ( String each : dependents )
+            parser.availableUnless( options(), each );
+
+        return this;
+    }
+
+    /**
+     * <p>Informs an option parser that this builder's option is allowed if the given option is absent on the command
+     * line.</p>
+     *
+     * <p>For a given option, you <em>should not</em> mix this with {@link #availableIf(OptionSpec, OptionSpec[])
+     * requiredIf} to avoid conflicts.</p>
+     *
+     * <p>This method recognizes only instances of options returned from the fluent interface methods.</p>
+     *
+     * @param dependent the option whose absence on a command line makes this builder's option allowed
+     * @param otherDependents other options whose absence on a command line makes this builder's option allowed
+     * @return self, so that the caller can add clauses to the fluent interface sentence
+     */
+    public OptionSpecBuilder availableUnless( OptionSpec<?> dependent, OptionSpec<?>... otherDependents ) {
+        parser.availableUnless( options(), dependent );
+        for ( OptionSpec<?> each : otherDependents )
+            parser.availableUnless(options(), each);
+
+        return this;
+    }
+
     private List<String> validatedDependents( String dependent, String... otherDependents ) {
-        List<String> dependents = new ArrayList<String>();
+        List<String> dependents = new ArrayList<>();
         dependents.add( dependent );
         Collections.addAll( dependents, otherDependents );
 
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSpecTokenizer.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionSpecTokenizer.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionalArgumentOptionSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/OptionalArgumentOptionSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,7 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import java.util.List;
 
 /**
  * Specification of an option that accepts an optional argument.
@@ -68,7 +68,7 @@
         super( option, false );
     }
 
-    OptionalArgumentOptionSpec( Collection<String> options, String description ) {
+    OptionalArgumentOptionSpec( List<String> options, String description ) {
         super( options, false, description );
     }
 
@@ -77,7 +77,7 @@
         if ( arguments.hasMore() ) {
             String nextArgument = arguments.peek();
 
-            if ( !parser.looksLikeAnOption( nextArgument ) )
+            if ( !parser.looksLikeAnOption( nextArgument ) && canConvertArgument( nextArgument ) )
                 handleOptionArgument( parser, detectedOptions, arguments );
             else if ( isArgumentOfNumberType() && canConvertArgument( nextArgument ) )
                 addArguments( detectedOptions, arguments.next() );
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ParserRules.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ParserRules.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,7 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import java.util.List;
 
 import static java.lang.Character.*;
 
@@ -97,7 +97,7 @@
             ensureLegalOptionCharacter( option.charAt( i ) );
     }
 
-    static void ensureLegalOptions( Collection<String> options ) {
+    static void ensureLegalOptions( List<String> options ) {
         for ( String each : options )
             ensureLegalOption( each );
     }
@@ -108,7 +108,7 @@
     }
 
     private static boolean isAllowedPunctuation( char option ) {
-        String allowedPunctuation = "?." + HYPHEN_CHAR;
+        String allowedPunctuation = "?._" + HYPHEN_CHAR;
         return allowedPunctuation.indexOf( option ) != -1;
     }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/README	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/README	Fri Jun 08 09:40:28 2018 -0700
@@ -1,3 +1,3 @@
-JOpt Simple, Version 4.6
+JOpt Simple, Version 5.0.4
 https://pholser.github.io/jopt-simple/
 
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/RequiredArgumentOptionSpec.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/RequiredArgumentOptionSpec.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,7 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import java.util.List;
 
 /**
  * Specification of an option that accepts a required argument.
@@ -68,14 +68,14 @@
         super( option, true );
     }
 
-    RequiredArgumentOptionSpec( Collection<String> options, String description ) {
+    RequiredArgumentOptionSpec( List<String> options, String description ) {
         super( options, true, description );
     }
 
     @Override
     protected void detectOptionArgument( OptionParser parser, ArgumentList arguments, OptionSet detectedOptions ) {
         if ( !arguments.hasMore() )
-            throw new OptionMissingRequiredArgumentException( options() );
+            throw new OptionMissingRequiredArgumentException( this );
 
         addArguments( detectedOptions, arguments.next() );
     }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/UnacceptableNumberOfNonOptionsException.java	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,84 +0,0 @@
-/*
- * 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
- * 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 is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * The MIT License
- *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package jdk.internal.joptsimple;
-
-import static java.util.Collections.*;
-
-/**
- * Thrown when the option parser detects an unacceptable number of {@code linkplain NonOptionArgumentSpec
- * non-option arguments}.
- *
- * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
- */
-class UnacceptableNumberOfNonOptionsException extends OptionException {
-    private static final long serialVersionUID = -1L;
-    private final int minimum;
-    private final int maximum;
-    private final int actual;
-
-    UnacceptableNumberOfNonOptionsException( int minimum, int maximum, int actual ) {
-        super( singletonList( NonOptionArgumentSpec.NAME ) );
-
-        this.minimum = minimum;
-        this.maximum = maximum;
-        this.actual = actual;
-    }
-
-    @Override
-    public String getMessage() {
-        return String.format( "actual = %d, minimum = %d, maximum = %d", actual, minimum, maximum );
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/UnavailableOptionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package jdk.internal.joptsimple;
+
+import java.util.List;
+
+/**
+ * Thrown when options marked as allowed are specified on the command line, but the options they depend upon are
+ * present/not present.
+ */
+class UnavailableOptionException extends OptionException {
+    private static final long serialVersionUID = -1L;
+
+    UnavailableOptionException( List<? extends OptionSpec<?>> forbiddenOptions ) {
+        super( forbiddenOptions );
+    }
+
+    @Override
+    Object[] messageArguments() {
+        return new Object[] { multipleOptionString() };
+    }
+}
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/UnconfiguredOptionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/UnconfiguredOptionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,7 +55,7 @@
 
 package jdk.internal.joptsimple;
 
-import java.util.Collection;
+import java.util.List;
 
 import static java.util.Collections.*;
 
@@ -71,12 +71,12 @@
         this( singletonList( option ) );
     }
 
-    UnconfiguredOptionException( Collection<String> options ) {
+    UnconfiguredOptionException( List<String> options ) {
         super( options );
     }
 
     @Override
-    public String getMessage() {
-        return "Option " + multipleOptionMessage() + " has not been configured on this parser";
+    Object[] messageArguments() {
+        return new Object[] { multipleOptionString() };
     }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/UnrecognizedOptionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/UnrecognizedOptionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -70,7 +70,7 @@
     }
 
     @Override
-    public String getMessage() {
-        return singleOptionMessage() + " is not a recognized option";
+    Object[] messageArguments() {
+        return new Object[] { singleOptionString() };
     }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ValueConversionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ValueConversionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ValueConverter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/ValueConverter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -76,7 +76,7 @@
      *
      * @return the target class for conversion
      */
-    Class<V> valueType();
+    Class<? extends V> valueType();
 
     /**
      * Gives a string that describes the pattern of the values this converter expects, if any.  For example, a date
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/AbbreviationMap.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/AbbreviationMap.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -84,37 +84,41 @@
  *
  * @param <V> a constraint on the types of the values in the map
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
- * @see <a href="http://www.perldoc.com/perl5.8.0/lib/Text/Abbrev.html">Perl's Text::Abbrev module</a>
+ * @see <a href="http://perldoc.perl.org/Text/Abbrev.html">Perl's Text::Abbrev module</a>
+ * @see <a href="https://en.wikipedia.org/wiki/Radix_tree">Radix tree</a>
  */
-public class AbbreviationMap<V> {
+public class AbbreviationMap<V> implements OptionNameMap<V> {
+    private final Map<Character, AbbreviationMap<V>> children = new TreeMap<>();
+
     private String key;
     private V value;
-    private final Map<Character, AbbreviationMap<V>> children = new TreeMap<Character, AbbreviationMap<V>>();
     private int keysBeyond;
 
     /**
      * <p>Tells whether the given key is in the map, or whether the given key is a unique
      * abbreviation of a key that is in the map.</p>
      *
-     * @param aKey key to look up
+     * @param key key to look up
      * @return {@code true} if {@code key} is present in the map
      * @throws NullPointerException if {@code key} is {@code null}
      */
-    public boolean contains( String aKey ) {
-        return get( aKey ) != null;
+    @Override
+    public boolean contains(String key) {
+        return get(key) != null;
     }
 
     /**
      * <p>Answers the value associated with the given key.  The key can be a unique
      * abbreviation of a key that is in the map. </p>
      *
-     * @param aKey key to look up
+     * @param key key to look up
      * @return the value associated with {@code aKey}; or {@code null} if there is no
      * such value or {@code aKey} is not a unique abbreviation of a key in the map
      * @throws NullPointerException if {@code aKey} is {@code null}
      */
-    public V get( String aKey ) {
-        char[] chars = charsOf( aKey );
+    @Override
+    public V get( String key ) {
+        char[] chars = charsOf( key );
 
         AbbreviationMap<V> child = this;
         for ( char each : chars ) {
@@ -130,18 +134,19 @@
      * <p>Associates a given value with a given key.  If there was a previous
      * association, the old value is replaced with the new one.</p>
      *
-     * @param aKey key to create in the map
+     * @param key key to create in the map
      * @param newValue value to associate with the key
      * @throws NullPointerException if {@code aKey} or {@code newValue} is {@code null}
      * @throws IllegalArgumentException if {@code aKey} is a zero-length string
      */
-    public void put( String aKey, V newValue ) {
+    @Override
+    public void put( String key, V newValue ) {
         if ( newValue == null )
             throw new NullPointerException();
-        if ( aKey.length() == 0 )
+        if ( key.length() == 0 )
             throw new IllegalArgumentException();
 
-        char[] chars = charsOf( aKey );
+        char[] chars = charsOf(key);
         add( chars, newValue, 0, chars.length );
     }
 
@@ -154,6 +159,7 @@
      * @throws NullPointerException if {@code keys} or {@code newValue} is {@code null}
      * @throws IllegalArgumentException if any of {@code keys} is a zero-length string
      */
+    @Override
     public void putAll( Iterable<String> keys, V newValue ) {
         for ( String each : keys )
             put( each, newValue );
@@ -170,7 +176,7 @@
         char nextChar = chars[ offset ];
         AbbreviationMap<V> child = children.get( nextChar );
         if ( child == null ) {
-            child = new AbbreviationMap<V>();
+            child = new AbbreviationMap<>();
             children.put( nextChar, child );
         }
 
@@ -188,15 +194,16 @@
     /**
      * <p>If the map contains the given key, dissociates the key from its value.</p>
      *
-     * @param aKey key to remove
+     * @param key key to remove
      * @throws NullPointerException if {@code aKey} is {@code null}
      * @throws IllegalArgumentException if {@code aKey} is a zero-length string
      */
-    public void remove( String aKey ) {
-        if ( aKey.length() == 0 )
+    @Override
+    public void remove( String key ) {
+        if ( key.length() == 0 )
             throw new IllegalArgumentException();
 
-        char[] keyChars = charsOf( aKey );
+        char[] keyChars = charsOf(key);
         remove( keyChars, 0, keyChars.length );
     }
 
@@ -242,8 +249,9 @@
      *
      * @return a Java map corresponding to this abbreviation map
      */
+    @Override
     public Map<String, V> toJavaUtilMap() {
-        Map<String, V> mappings = new TreeMap<String, V>();
+        Map<String, V> mappings = new TreeMap<>();
         addToMappings( mappings );
         return mappings;
     }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Classes.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Classes.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -62,7 +62,7 @@
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
  */
 public final class Classes {
-    private static final Map<Class<?>, Class<?>> WRAPPERS = new HashMap<Class<?>, Class<?>>( 13 );
+    private static final Map<Class<?>, Class<?>> WRAPPERS = new HashMap<>( 13 );
 
     static {
         WRAPPERS.put( boolean.class, Boolean.class );
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Columns.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Columns.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -58,7 +58,6 @@
 import java.text.BreakIterator;
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Locale;
 
 import static java.text.BreakIterator.*;
 
@@ -82,7 +81,7 @@
         List<String> options = piecesOf( row.option, optionWidth );
         List<String> descriptions = piecesOf( row.description, descriptionWidth );
 
-        List<Row> rows = new ArrayList<Row>();
+        List<Row> rows = new ArrayList<>();
         for ( int i = 0; i < Math.max( options.size(), descriptions.size() ); ++i )
             rows.add( new Row( itemOrEmpty( options, i ), itemOrEmpty( descriptions, i ) ) );
 
@@ -94,7 +93,7 @@
     }
 
     private List<String> piecesOf( String raw, int width ) {
-        List<String> pieces = new ArrayList<String>();
+        List<String> pieces = new ArrayList<>();
 
         for ( String each : raw.trim().split( LINE_SEPARATOR ) )
             pieces.addAll( piecesOfEmbeddedLine( each, width ) );
@@ -103,9 +102,9 @@
     }
 
     private List<String> piecesOfEmbeddedLine( String line, int width ) {
-        List<String> pieces = new ArrayList<String>();
+        List<String> pieces = new ArrayList<>();
 
-        BreakIterator words = BreakIterator.getLineInstance( Locale.US );
+        BreakIterator words = BreakIterator.getLineInstance();
         words.setText( line );
 
         StringBuilder nextPiece = new StringBuilder();
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/ConstructorInvokingValueConverter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/ConstructorInvokingValueConverter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Messages.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package jdk.internal.joptsimple.internal;
+
+import java.text.MessageFormat;
+import java.util.Locale;
+import java.util.ResourceBundle;
+
+/**
+ * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
+ */
+public class Messages {
+    private Messages() {
+        throw new UnsupportedOperationException();
+    }
+
+    public static String message( Locale locale, String bundleName, Class<?> type, String key, Object... args ) {
+        ResourceBundle bundle = ResourceBundle.getBundle( bundleName, locale );
+        String template = bundle.getString( type.getName() + '.' + key );
+        MessageFormat format = new MessageFormat( template );
+        format.setLocale( locale );
+        return format.format( args );
+    }
+}
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/MethodInvokingValueConverter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/MethodInvokingValueConverter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Objects.java	Thu Jun 07 23:12:35 2018 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,76 +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.
- */
-
-/*
- * This file is available under and governed by the GNU General Public
- * License version 2 only, as published by the Free Software Foundation.
- * However, the following notice accompanied the original version of this
- * file:
- *
- * The MIT License
- *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
- *
- * Permission is hereby granted, free of charge, to any person obtaining
- * a copy of this software and associated documentation files (the
- * "Software"), to deal in the Software without restriction, including
- * without limitation the rights to use, copy, modify, merge, publish,
- * distribute, sublicense, and/or sell copies of the Software, and to
- * permit persons to whom the Software is furnished to do so, subject to
- * the following conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
-
-package jdk.internal.joptsimple.internal;
-
-/**
- * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
- */
-public final class Objects {
-    private Objects() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
-     * Rejects {@code null} references.
-     *
-     * @param target reference to check
-     * @throws NullPointerException if {@code target} is {@code null}
-     */
-    public static void ensureNotNull( Object target ) {
-        if ( target == null )
-            throw new NullPointerException();
-    }
-}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/OptionNameMap.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package jdk.internal.joptsimple.internal;
+
+import java.util.Map;
+
+/**
+ * Map-like interface for storing String-value pairs.
+ *
+ * @param <V> type of values stored in the map
+ */
+public interface OptionNameMap<V> {
+    boolean contains( String key );
+
+    V get( String key );
+
+    void put( String key, V newValue );
+
+    void putAll( Iterable<String> keys, V newValue );
+
+    void remove( String key );
+
+    Map<String, V> toJavaUtilMap();
+}
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Reflection.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Reflection.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -98,22 +98,20 @@
 
     private static <V> ValueConverter<V> valueOfConverter( Class<V> clazz ) {
         try {
-            Method valueOf = clazz.getDeclaredMethod( "valueOf", String.class );
+            Method valueOf = clazz.getMethod( "valueOf", String.class );
             if ( meetsConverterRequirements( valueOf, clazz ) )
-                return new MethodInvokingValueConverter<V>( valueOf, clazz );
+                return new MethodInvokingValueConverter<>( valueOf, clazz );
 
             return null;
-        }
-        catch ( NoSuchMethodException ignored ) {
+        } catch ( NoSuchMethodException ignored ) {
             return null;
         }
     }
 
     private static <V> ValueConverter<V> constructorConverter( Class<V> clazz ) {
         try {
-            return new ConstructorInvokingValueConverter<V>( clazz.getConstructor( String.class ) );
-        }
-        catch ( NoSuchMethodException ignored ) {
+            return new ConstructorInvokingValueConverter<>( clazz.getConstructor( String.class ) );
+        } catch ( NoSuchMethodException ignored ) {
             return null;
         }
     }
@@ -130,8 +128,7 @@
     public static <T> T instantiate( Constructor<T> constructor, Object... args ) {
         try {
             return constructor.newInstance( args );
-        }
-        catch ( Exception ex ) {
+        } catch ( Exception ex ) {
             throw reflectionException( ex );
         }
     }
@@ -147,8 +144,7 @@
     public static Object invoke( Method method, Object... args ) {
         try {
             return method.invoke( null, args );
-        }
-        catch ( Exception ex ) {
+        } catch ( Exception ex ) {
             throw reflectionException( ex );
         }
     }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/ReflectionException.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/ReflectionException.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Row.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Row.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Rows.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Rows.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,8 +55,8 @@
 
 package jdk.internal.joptsimple.internal;
 
-import java.util.LinkedHashSet;
-import java.util.Set;
+import java.util.ArrayList;
+import java.util.List;
 
 import static java.lang.Math.*;
 
@@ -68,7 +68,8 @@
 public class Rows {
     private final int overallWidth;
     private final int columnSeparatorWidth;
-    private final Set<Row> rows = new LinkedHashSet<Row>();
+    private final List<Row> rows = new ArrayList<>();
+
     private int widthOfWidestOption;
     private int widthOfWidestDescription;
 
@@ -87,7 +88,7 @@
         widthOfWidestDescription = max( widthOfWidestDescription, row.description.length() );
     }
 
-    private void reset() {
+    public void reset() {
         rows.clear();
         widthOfWidestOption = 0;
         widthOfWidestDescription = 0;
@@ -96,7 +97,7 @@
     public void fitToWidth() {
         Columns columns = new Columns( optionWidth(), descriptionWidth() );
 
-        Set<Row> fitted = new LinkedHashSet<Row>();
+        List<Row> fitted = new ArrayList<>();
         for ( Row each : rows )
             fitted.addAll( columns.fit( each ) );
 
@@ -122,7 +123,7 @@
     }
 
     private int descriptionWidth() {
-        return min( ( overallWidth - columnSeparatorWidth ) / 2, widthOfWidestDescription );
+        return min( overallWidth - optionWidth() - columnSeparatorWidth, widthOfWidestDescription );
     }
 
     private StringBuilder pad( StringBuilder buffer, String s, int length ) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/SimpleOptionNameMap.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package jdk.internal.joptsimple.internal;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * <p>An {@code OptionNameMap} which wraps and behaves like {@code HashMap}.</p>
+ */
+public class SimpleOptionNameMap<V> implements OptionNameMap<V> {
+    private final Map<String, V> map = new HashMap<>();
+
+    @Override
+    public boolean contains( String key ) {
+        return map.containsKey( key );
+    }
+
+    @Override
+    public V get( String key ) {
+        return map.get( key );
+    }
+
+    @Override
+    public void put( String key, V newValue ) {
+        map.put( key, newValue );
+    }
+
+    @Override
+    public void putAll( Iterable<String> keys, V newValue ) {
+        for ( String each : keys )
+            map.put( each, newValue );
+    }
+
+    @Override
+    public void remove( String key ) {
+        map.remove( key );
+    }
+
+    @Override
+    public Map<String, V> toJavaUtilMap() {
+        return new HashMap<>( map );
+    }
+}
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Strings.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/internal/Strings.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -56,7 +56,6 @@
 package jdk.internal.joptsimple.internal;
 
 import java.util.Iterator;
-import java.util.List;
 
 import static java.lang.System.*;
 import static java.util.Arrays.*;
@@ -66,7 +65,6 @@
  */
 public final class Strings {
     public static final String EMPTY = "";
-    public static final String SINGLE_QUOTE = "'";
     public static final String LINE_SEPARATOR = getProperty( "line.separator" );
 
     private Strings() {
@@ -96,7 +94,7 @@
      * @return {@code true} if the target string is null or empty
      */
     public static boolean isNullOrEmpty( String target ) {
-        return target == null || EMPTY.equals( target );
+        return target == null || target.isEmpty();
     }
 
 
@@ -132,7 +130,7 @@
      * @param separator the separator
      * @return the joined string
      */
-    public static String join( List<String> pieces, String separator ) {
+    public static String join( Iterable<String> pieces, String separator ) {
         StringBuilder buffer = new StringBuilder();
 
         for ( Iterator<String> iter = pieces.iterator(); iter.hasNext(); ) {
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/DateConverter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/DateConverter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -59,9 +59,11 @@
 import java.text.ParsePosition;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.Locale;
 
 import jdk.internal.joptsimple.ValueConversionException;
 import jdk.internal.joptsimple.ValueConverter;
+import jdk.internal.joptsimple.internal.Messages;
 
 /**
  * Converts values to {@link Date}s using a {@link DateFormat} object.
@@ -121,10 +123,22 @@
     }
 
     private String message( String value ) {
-        String message = "Value [" + value + "] does not match date/time pattern";
-        if ( formatter instanceof SimpleDateFormat )
-            message += " [" + ( (SimpleDateFormat) formatter ).toPattern() + ']';
+        String key;
+        Object[] arguments;
 
-        return message;
+        if ( formatter instanceof SimpleDateFormat ) {
+            key = "with.pattern.message";
+            arguments = new Object[] { value, ( (SimpleDateFormat) formatter ).toPattern() };
+        } else {
+            key = "without.pattern.message";
+            arguments = new Object[] { value };
+        }
+
+        return Messages.message(
+            Locale.getDefault(),
+            "jdk.internal.joptsimple.ExceptionMessages",
+            DateConverter.class,
+            key,
+            arguments );
     }
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/EnumConverter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file is available under and governed by the GNU General Public
+ * License version 2 only, as published by the Free Software Foundation.
+ * However, the following notice accompanied the original version of this
+ * file:
+ *
+ * The MIT License
+ *
+ * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+ * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+ * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+ * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+package jdk.internal.joptsimple.util;
+
+import java.text.MessageFormat;
+import java.util.EnumSet;
+import java.util.Iterator;
+import java.util.ResourceBundle;
+
+import jdk.internal.joptsimple.ValueConversionException;
+import jdk.internal.joptsimple.ValueConverter;
+
+/**
+ * Converts values to {@link java.lang.Enum}s.
+ *
+ * @author <a href="mailto:christian.ohr@gmail.com">Christian Ohr</a>
+ */
+public abstract class EnumConverter<E extends Enum<E>> implements ValueConverter<E> {
+    private final Class<E> clazz;
+
+    private String delimiters = "[,]";
+
+    /**
+     * This constructor must be called by subclasses, providing the enum class as the parameter.
+     *
+     * @param clazz enum class
+     */
+    protected EnumConverter( Class<E> clazz ) {
+        this.clazz = clazz;
+    }
+
+    @Override
+    public E convert( String value ) {
+        for ( E each : valueType().getEnumConstants() ) {
+            if ( each.name().equalsIgnoreCase( value ) ) {
+                return each;
+            }
+        }
+
+        throw new ValueConversionException( message( value ) );
+    }
+
+    @Override
+    public Class<E> valueType() {
+        return clazz;
+    }
+
+    /**
+     * Sets the delimiters for the message string. Must be a 3-letter string,
+     * where the first character is the prefix, the second character is the
+     * delimiter between the values, and the 3rd character is the suffix.
+     *
+     * @param delimiters delimiters for message string. Default is [,]
+     */
+    public void setDelimiters( String delimiters ) {
+        this.delimiters = delimiters;
+    }
+
+    @Override
+    public String valuePattern() {
+        EnumSet<E> values = EnumSet.allOf( valueType() );
+
+        StringBuilder builder = new StringBuilder();
+        builder.append( delimiters.charAt(0) );
+        for ( Iterator<E> i = values.iterator(); i.hasNext(); ) {
+            builder.append( i.next().toString() );
+            if ( i.hasNext() )
+                builder.append( delimiters.charAt( 1 ) );
+        }
+        builder.append( delimiters.charAt( 2 ) );
+
+        return builder.toString();
+    }
+
+    private String message( String value ) {
+        ResourceBundle bundle = ResourceBundle.getBundle( "jdk.internal.joptsimple.ExceptionMessages" );
+        Object[] arguments = new Object[] { value, valuePattern() };
+        String template = bundle.getString( EnumConverter.class.getName() + ".message" );
+        return new MessageFormat( template ).format( arguments );
+    }
+}
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/InetAddressConverter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/InetAddressConverter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -57,9 +57,11 @@
 
 import java.net.InetAddress;
 import java.net.UnknownHostException;
+import java.util.Locale;
 
 import jdk.internal.joptsimple.ValueConversionException;
 import jdk.internal.joptsimple.ValueConverter;
+import jdk.internal.joptsimple.internal.Messages;
 
 /**
  * Converts values to {@link java.net.InetAddress} using {@link InetAddress#getByName(String) getByName}.
@@ -70,8 +72,9 @@
     public InetAddress convert( String value ) {
         try {
             return InetAddress.getByName( value );
-        } catch ( UnknownHostException e ) {
-            throw new ValueConversionException( "Cannot convert value [" + value + " into an InetAddress", e );
+        }
+        catch ( UnknownHostException e ) {
+            throw new ValueConversionException( message( value ) );
         }
     }
 
@@ -82,4 +85,13 @@
     public String valuePattern() {
         return null;
     }
+
+    private String message( String value ) {
+        return Messages.message(
+            Locale.getDefault(),
+            "jdk.internal.joptsimple.ExceptionMessages",
+            InetAddressConverter.class,
+            "message",
+            value );
+    }
 }
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/KeyValuePair.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/KeyValuePair.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -60,7 +60,7 @@
 /**
  * <p>A simple string key/string value pair.</p>
  *
- * <p>This is useful as an argument type for options whose values take on the form <kbd>key=value</kbd>, such as JVM
+ * <p>This is useful as an argument type for options whose values take on the form {@code key=value}, such as JVM
  * command line system properties.</p>
  *
  * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
@@ -75,7 +75,7 @@
     }
 
     /**
-     * Parses a string assumed to be of the form <kbd>key=value</kbd> into its parts.
+     * Parses a string assumed to be of the form {@code key=value} into its parts.
      *
      * @param asString key-value string
      * @return a key-value pair
@@ -84,7 +84,7 @@
     public static KeyValuePair valueOf( String asString ) {
         int equalsIndex = asString.indexOf( '=' );
         if ( equalsIndex == -1 )
-            return new KeyValuePair( asString, EMPTY );
+            return new KeyValuePair( asString, null );
 
         String aKey = asString.substring( 0, equalsIndex );
         String aValue = equalsIndex == asString.length() - 1 ? EMPTY : asString.substring( equalsIndex + 1 );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/PathConverter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  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.joptsimple.util;
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.text.MessageFormat;
+import java.util.ResourceBundle;
+
+import jdk.internal.joptsimple.ValueConversionException;
+import jdk.internal.joptsimple.ValueConverter;
+
+/**
+ * Converts command line options to {@link Path} objects and checks the status of the underlying file.
+ */
+public class PathConverter implements ValueConverter<Path> {
+    private final PathProperties[] pathProperties;
+
+    public PathConverter( PathProperties... pathProperties ) {
+        this.pathProperties = pathProperties;
+    }
+
+    @Override
+    public Path convert( String value ) {
+        Path path = Paths.get(value);
+
+        if ( pathProperties != null ) {
+            for ( PathProperties each : pathProperties ) {
+                if ( !each.accept( path ) )
+                    throw new ValueConversionException( message( each.getMessageKey(), path.toString() ) );
+            }
+        }
+
+        return path;
+    }
+
+    @Override
+    public Class<Path> valueType() {
+        return Path.class;
+    }
+
+    @Override
+    public String valuePattern() {
+        return null;
+    }
+
+    private String message( String errorKey, String value ) {
+        ResourceBundle bundle = ResourceBundle.getBundle( "jdk.internal.joptsimple.ExceptionMessages" );
+        Object[] arguments = new Object[] { value, valuePattern() };
+        String template = bundle.getString( PathConverter.class.getName() + "." + errorKey + ".message" );
+        return new MessageFormat( template ).format( arguments );
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/PathProperties.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.joptsimple.util;
+
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+/**
+ * Enum for checking common conditions of files and directories.
+ *
+ * @see jdk.internal.joptsimple.util.PathConverter
+ */
+public enum PathProperties {
+    FILE_EXISTING( "file.existing" ) {
+        @Override
+        boolean accept( Path path ) {
+            return Files.isRegularFile( path );
+        }
+    },
+    DIRECTORY_EXISTING( "directory.existing" ) {
+        @Override
+        boolean accept( Path path ) {
+            return Files.isDirectory( path );
+        }
+    },
+    NOT_EXISTING( "file.not.existing" ) {
+        @Override
+        boolean accept( Path path ) {
+            return Files.notExists( path );
+        }
+    },
+    FILE_OVERWRITABLE( "file.overwritable" ) {
+        @Override
+        boolean accept( Path path ) {
+            return FILE_EXISTING.accept( path ) && WRITABLE.accept( path );
+        }
+    },
+    READABLE( "file.readable" ) {
+        @Override
+        boolean accept( Path path ) {
+            return Files.isReadable( path );
+        }
+    },
+    WRITABLE( "file.writable" ) {
+        @Override
+        boolean accept( Path path ) {
+            return Files.isWritable( path );
+        }
+    };
+
+    private final String messageKey;
+
+    private PathProperties( String messageKey ) {
+        this.messageKey = messageKey;
+    }
+
+    abstract boolean accept( Path path );
+
+    String getMessageKey() {
+        return messageKey;
+    }
+}
--- a/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/RegexMatcher.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/classes/jdk/internal/joptsimple/util/RegexMatcher.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,7 +31,7 @@
  *
  * The MIT License
  *
- * Copyright (c) 2004-2014 Paul R. Holser, Jr.
+ * Copyright (c) 2004-2015 Paul R. Holser, Jr.
  *
  * Permission is hereby granted, free of charge, to any person obtaining
  * a copy of this software and associated documentation files (the
@@ -55,9 +55,11 @@
 
 package jdk.internal.joptsimple.util;
 
+import java.util.Locale;
 import java.util.regex.Pattern;
 
 import static java.util.regex.Pattern.*;
+import static jdk.internal.joptsimple.internal.Messages.message;
 
 import jdk.internal.joptsimple.ValueConversionException;
 import jdk.internal.joptsimple.ValueConverter;
@@ -96,8 +98,7 @@
 
     public String convert( String value ) {
         if ( !pattern.matcher( value ).matches() ) {
-            throw new ValueConversionException(
-                "Value [" + value + "] did not match regex [" + pattern.pattern() + ']' );
+            raiseValueConversionFailure( value );
         }
 
         return value;
@@ -110,4 +111,15 @@
     public String valuePattern() {
         return pattern.pattern();
     }
+
+    private void raiseValueConversionFailure( String value ) {
+        String message = message(
+            Locale.getDefault(),
+            "jdk.internal.joptsimple.ExceptionMessages",
+            RegexMatcher.class,
+            "message",
+            value,
+            pattern.pattern() );
+        throw new ValueConversionException( message );
+    }
 }
--- a/src/jdk.internal.opt/share/legal/jopt-simple.md	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.opt/share/legal/jopt-simple.md	Fri Jun 08 09:40:28 2018 -0700
@@ -1,4 +1,4 @@
-## jopt-simple v4.6
+## jopt-simple v5.0.4
 
 ### MIT License
 <pre>
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/UnsafeCompareAndExchangeNode.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/java/UnsafeCompareAndExchangeNode.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,6 +23,7 @@
 package org.graalvm.compiler.nodes.java;
 
 import jdk.vm.ci.meta.JavaKind;
+import org.graalvm.compiler.core.common.type.Stamp;
 import org.graalvm.compiler.graph.NodeClass;
 import org.graalvm.compiler.nodeinfo.NodeInfo;
 import org.graalvm.compiler.nodes.NodeView;
@@ -55,8 +56,7 @@
     private final LocationIdentity locationIdentity;
 
     public UnsafeCompareAndExchangeNode(ValueNode object, ValueNode offset, ValueNode expected, ValueNode newValue, JavaKind valueKind, LocationIdentity locationIdentity) {
-        super(TYPE, expected.stamp(NodeView.DEFAULT).meet(newValue.stamp(NodeView.DEFAULT)));
-        assert expected.stamp(NodeView.DEFAULT).isCompatible(newValue.stamp(NodeView.DEFAULT));
+        super(TYPE, meetInputs(expected.stamp(NodeView.DEFAULT), newValue.stamp(NodeView.DEFAULT)));
         this.object = object;
         this.offset = offset;
         this.expected = expected;
@@ -65,6 +65,11 @@
         this.locationIdentity = locationIdentity;
     }
 
+    private static Stamp meetInputs(Stamp expected, Stamp newValue) {
+        assert expected.isCompatible(newValue);
+        return expected.unrestricted().meet(newValue.unrestricted());
+    }
+
     public ValueNode object() {
         return object;
     }
--- a/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.jdk9.test/src/org/graalvm/compiler/replacements/jdk9/UnsafeReplacementsTest.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements.jdk9.test/src/org/graalvm/compiler/replacements/jdk9/UnsafeReplacementsTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -26,11 +26,15 @@
 import jdk.vm.ci.code.TargetDescription;
 import jdk.vm.ci.meta.ResolvedJavaMethod;
 import org.graalvm.compiler.api.test.Graal;
+import org.graalvm.compiler.core.phases.HighTier;
+import org.graalvm.compiler.options.OptionValues;
 import org.graalvm.compiler.replacements.test.MethodSubstitutionTest;
 import org.graalvm.compiler.runtime.RuntimeProvider;
 import org.graalvm.compiler.test.AddExports;
 import org.junit.Test;
 
+import java.lang.reflect.Field;
+
 @AddExports("java.base/jdk.internal.misc")
 public class UnsafeReplacementsTest extends MethodSubstitutionTest {
 
@@ -310,4 +314,200 @@
         test("unsafeGetAndSetLong");
         test("unsafeGetAndSetObject");
     }
+
+    public static void fieldInstance() {
+        JdkInternalMiscUnsafeAccessTestBoolean.testFieldInstance();
+    }
+
+    @Test
+    public void testFieldInstance() {
+        test(new OptionValues(getInitialOptions(), HighTier.Options.Inline, false), "fieldInstance");
+    }
+
+    public static void array() {
+        JdkInternalMiscUnsafeAccessTestBoolean.testArray();
+    }
+
+    @Test
+    public void testArray() {
+        test(new OptionValues(getInitialOptions(), HighTier.Options.Inline, false), "array");
+    }
+
+    public static void fieldStatic() {
+        JdkInternalMiscUnsafeAccessTestBoolean.testFieldStatic();
+    }
+
+    @Test
+    public void testFieldStatic() {
+        test(new OptionValues(getInitialOptions(), HighTier.Options.Inline, false), "fieldStatic");
+    }
+
+    public static class JdkInternalMiscUnsafeAccessTestBoolean {
+        static final int ITERATIONS = 100000;
+
+        static final int WEAK_ATTEMPTS = 10;
+
+        static final long V_OFFSET;
+
+        static final Object STATIC_V_BASE;
+
+        static final long STATIC_V_OFFSET;
+
+        static final int ARRAY_OFFSET;
+
+        static final int ARRAY_SHIFT;
+
+        static {
+            try {
+                Field staticVField = UnsafeReplacementsTest.JdkInternalMiscUnsafeAccessTestBoolean.class.getDeclaredField("staticV");
+                STATIC_V_BASE = unsafe.staticFieldBase(staticVField);
+                STATIC_V_OFFSET = unsafe.staticFieldOffset(staticVField);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            try {
+                Field vField = UnsafeReplacementsTest.JdkInternalMiscUnsafeAccessTestBoolean.class.getDeclaredField("v");
+                V_OFFSET = unsafe.objectFieldOffset(vField);
+            } catch (Exception e) {
+                throw new RuntimeException(e);
+            }
+
+            ARRAY_OFFSET = unsafe.arrayBaseOffset(boolean[].class);
+            int ascale = unsafe.arrayIndexScale(boolean[].class);
+            ARRAY_SHIFT = 31 - Integer.numberOfLeadingZeros(ascale);
+        }
+
+        static boolean staticV;
+
+        boolean v;
+
+        @BytecodeParserForceInline
+        public static void testFieldInstance() {
+            JdkInternalMiscUnsafeAccessTestBoolean t = new JdkInternalMiscUnsafeAccessTestBoolean();
+            for (int c = 0; c < ITERATIONS; c++) {
+                testAccess(t, V_OFFSET);
+            }
+        }
+
+        public static void testFieldStatic() {
+            for (int c = 0; c < ITERATIONS; c++) {
+                testAccess(STATIC_V_BASE, STATIC_V_OFFSET);
+            }
+        }
+
+        public static void testArray() {
+            boolean[] array = new boolean[10];
+            for (int c = 0; c < ITERATIONS; c++) {
+                for (int i = 0; i < array.length; i++) {
+                    testAccess(array, (((long) i) << ARRAY_SHIFT) + ARRAY_OFFSET);
+                }
+            }
+        }
+
+        public static void assertEquals(Object seen, Object expected, String message) {
+            if (seen != expected) {
+                throw new AssertionError(message + " - seen: " + seen + ", expected: " + expected);
+            }
+        }
+
+        // Checkstyle: stop
+        @BytecodeParserForceInline
+        public static void testAccess(Object base, long offset) {
+            // Advanced compare
+            {
+                boolean r = unsafe.compareAndExchangeBoolean(base, offset, false, true);
+                assertEquals(r, false, "success compareAndExchange boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, true, "success compareAndExchange boolean value");
+            }
+
+            {
+                boolean r = unsafe.compareAndExchangeBoolean(base, offset, false, false);
+                assertEquals(r, true, "failing compareAndExchange boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, true, "failing compareAndExchange boolean value");
+            }
+
+            {
+                boolean r = unsafe.compareAndExchangeBooleanAcquire(base, offset, true, false);
+                assertEquals(r, true, "success compareAndExchangeAcquire boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, false, "success compareAndExchangeAcquire boolean value");
+            }
+
+            {
+                boolean r = unsafe.compareAndExchangeBooleanAcquire(base, offset, true, false);
+                assertEquals(r, false, "failing compareAndExchangeAcquire boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, false, "failing compareAndExchangeAcquire boolean value");
+            }
+
+            {
+                boolean r = unsafe.compareAndExchangeBooleanRelease(base, offset, false, true);
+                assertEquals(r, false, "success compareAndExchangeRelease boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, true, "success compareAndExchangeRelease boolean value");
+            }
+
+            {
+                boolean r = unsafe.compareAndExchangeBooleanRelease(base, offset, false, false);
+                assertEquals(r, true, "failing compareAndExchangeRelease boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, true, "failing compareAndExchangeRelease boolean value");
+            }
+
+            {
+                boolean success = false;
+                for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+                    success = unsafe.weakCompareAndSetBooleanPlain(base, offset, true, false);
+                }
+                assertEquals(success, true, "weakCompareAndSetPlain boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, false, "weakCompareAndSetPlain boolean value");
+            }
+
+            {
+                boolean success = false;
+                for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+                    success = unsafe.weakCompareAndSetBooleanAcquire(base, offset, false, true);
+                }
+                assertEquals(success, true, "weakCompareAndSetAcquire boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, true, "weakCompareAndSetAcquire boolean");
+            }
+
+            {
+                boolean success = false;
+                for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+                    success = unsafe.weakCompareAndSetBooleanRelease(base, offset, true, false);
+                }
+                assertEquals(success, true, "weakCompareAndSetRelease boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, false, "weakCompareAndSetRelease boolean");
+            }
+
+            {
+                boolean success = false;
+                for (int c = 0; c < WEAK_ATTEMPTS && !success; c++) {
+                    success = unsafe.weakCompareAndSetBoolean(base, offset, false, true);
+                }
+                assertEquals(success, true, "weakCompareAndSet boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, true, "weakCompareAndSet boolean");
+            }
+
+            unsafe.putBoolean(base, offset, false);
+
+            // Compare set and get
+            {
+                boolean o = unsafe.getAndSetBoolean(base, offset, true);
+                assertEquals(o, false, "getAndSet boolean");
+                boolean x = unsafe.getBoolean(base, offset);
+                assertEquals(x, true, "getAndSet boolean value");
+            }
+
+        }
+        // Checkstyle: resume
+    }
 }
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlConfiguration.java	Fri Jun 08 09:40:28 2018 -0700
@@ -452,8 +452,12 @@
      * packages is more than one. Sets {@link #createoverview} field to true.
      */
     protected void setCreateOverview() {
-        if ((overviewpath != null || packages.size() > 1) && !nooverview) {
-            createoverview = true;
+        if (!nooverview) {
+            if (overviewpath != null
+                    || modules.size() > 1
+                    || (modules.isEmpty() && packages.size() > 1)) {
+                createoverview = true;
+            }
         }
     }
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDoclet.java	Fri Jun 08 09:40:28 2018 -0700
@@ -172,8 +172,12 @@
             }
         }
 
-        if (!configuration.frames && !configuration.createoverview) {
-            IndexRedirectWriter.generate(configuration);
+        if (!configuration.frames) {
+            if (configuration.createoverview) {
+                IndexRedirectWriter.generate(configuration, DocPaths.OVERVIEW_SUMMARY, DocPaths.INDEX);
+            } else {
+                IndexRedirectWriter.generate(configuration);
+            }
         }
 
         if (configuration.helpfile.isEmpty() && !configuration.nohelp) {
@@ -201,7 +205,7 @@
         }
     }
 
-    protected void copyJqueryFiles() throws DocletException {
+    private void copyJqueryFiles() throws DocletException {
         List<String> files = Arrays.asList(
                 "jquery-1.12.4.js",
                 "jquery-ui.js",
@@ -245,7 +249,6 @@
     protected void generateClassFiles(SortedSet<TypeElement> arr, ClassTree classtree)
             throws DocletException {
         List<TypeElement> list = new ArrayList<>(arr);
-        ListIterator<TypeElement> iterator = list.listIterator();
         for (TypeElement klass : list) {
             if (utils.hasHiddenTag(klass) ||
                     !(configuration.isGeneratedDoc(klass) && utils.isIncluded(klass))) {
@@ -274,7 +277,6 @@
                 ModuleIndexFrameWriter.generate(configuration);
             }
             List<ModuleElement> mdles = new ArrayList<>(configuration.modulePackages.keySet());
-            int i = 0;
             for (ModuleElement mdle : mdles) {
                 if (configuration.frames && configuration.modules.size() > 1) {
                     ModulePackageIndexFrameWriter.generate(configuration, mdle);
@@ -283,21 +285,10 @@
                 AbstractBuilder moduleSummaryBuilder =
                         configuration.getBuilderFactory().getModuleSummaryBuilder(mdle);
                 moduleSummaryBuilder.build();
-                i++;
             }
         }
     }
 
-    PackageElement getNamedPackage(List<PackageElement> list, int idx) {
-        if (idx < list.size()) {
-            PackageElement pkg = list.get(idx);
-            if (pkg != null && !pkg.isUnnamed()) {
-                return pkg;
-            }
-        }
-        return null;
-    }
-
     /**
      * {@inheritDoc}
      */
@@ -308,11 +299,10 @@
             PackageIndexFrameWriter.generate(configuration);
         }
         List<PackageElement> pList = new ArrayList<>(packages);
-        for (int i = 0 ; i < pList.size() ; i++) {
+        for (PackageElement pkg : pList) {
             // if -nodeprecated option is set and the package is marked as
             // deprecated, do not generate the package-summary.html, package-frame.html
             // and package-tree.html pages for that package.
-            PackageElement pkg = pList.get(i);
             if (!(configuration.nodeprecated && utils.isDeprecated(pkg))) {
                 if (configuration.frames) {
                     PackageFrameWriter.generate(configuration, pkg);
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/IndexRedirectWriter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -41,8 +41,8 @@
 import jdk.javadoc.internal.doclets.toolkit.util.DocPaths;
 
 /**
- * Writes an index.html file that tries to redirect to an alternate page.
- * The redirect uses JavaSCript, if enabled, falling back on
+ * Writes a file that tries to redirect to an alternate page.
+ * The redirect uses JavaScript, if enabled, falling back on
  * {@code <meta http-eqiv=refresh content="0,<uri>">}.
  * If neither are supported/enabled in a browser, the page displays the
  * standard "JavaScipt not enabled" message, and a link to the alternate page.
@@ -51,21 +51,27 @@
 
     public static void generate(HtmlConfiguration configuration)
             throws DocFileIOException {
-        IndexRedirectWriter indexRedirect;
-        DocPath filename = DocPaths.INDEX;
-            indexRedirect = new IndexRedirectWriter(configuration, filename);
-            indexRedirect.generateIndexFile();
+        generate(configuration, DocPaths.INDEX, configuration.topFile);
     }
 
-    IndexRedirectWriter(HtmlConfiguration configuration, DocPath filename) {
+    public static void generate(HtmlConfiguration configuration, DocPath fileName, DocPath target)
+            throws DocFileIOException {
+        IndexRedirectWriter indexRedirect = new IndexRedirectWriter(configuration, fileName, target);
+        indexRedirect.generateIndexFile();
+    }
+
+    private DocPath target;
+
+    private IndexRedirectWriter(HtmlConfiguration configuration, DocPath filename, DocPath target) {
         super(configuration, filename);
+        this.target = target;
     }
 
     /**
      * Generate an index file that redirects to an alternate file.
      * @throws DocFileIOException if there is a problem generating the file
      */
-    void generateIndexFile() throws DocFileIOException {
+    private void generateIndexFile() throws DocFileIOException {
         DocType htmlDocType = DocType.forVersion(configuration.htmlVersion);
         Content htmlComment = contents.newPage;
         Head head = new Head(path, configuration.htmlVersion, configuration.docletVersion)
@@ -77,15 +83,16 @@
                 : resources.getText("doclet.Generated_Docs_Untitled");
 
         head.setTitle(title)
-                .setCharset(configuration.charset);
+                .setCharset(configuration.charset)
+                .setCanonicalLink(target);
 
-        String topFilePath = configuration.topFile.getPath();
+        String targetPath = target.getPath();
         Script script = new Script("window.location.replace(")
-                .appendStringLiteral(topFilePath, '\'')
+                .appendStringLiteral(targetPath, '\'')
                 .append(")");
         HtmlTree metaRefresh = new HtmlTree(HtmlTag.META)
                 .addAttr(HtmlAttr.HTTP_EQUIV, "Refresh")
-                .addAttr(HtmlAttr.CONTENT, "0;" + topFilePath);
+                .addAttr(HtmlAttr.CONTENT, "0;" + targetPath);
         head.addContent(
                 script.asContent(),
                 configuration.isOutputHtml5() ? HtmlTree.NOSCRIPT(metaRefresh) : metaRefresh);
@@ -94,7 +101,7 @@
         bodyContent.addContent(HtmlTree.NOSCRIPT(
                 HtmlTree.P(contents.getContent("doclet.No_Script_Message"))));
 
-        bodyContent.addContent(HtmlTree.P(HtmlTree.A(topFilePath, new StringContent(topFilePath))));
+        bodyContent.addContent(HtmlTree.P(HtmlTree.A(targetPath, new StringContent(targetPath))));
 
         Content body = new HtmlTree(HtmlTag.BODY);
         if (configuration.allowTag(HtmlTag.MAIN)) {
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/markup/Head.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -67,7 +67,8 @@
     private Script mainBodyScript;
     private final List<Script> scripts;
     private final List<Content> extraContent;
-    boolean addDefaultScript = true;
+    private boolean addDefaultScript = true;
+    private DocPath canonicalLink;
 
     private static final Calendar calendar = new GregorianCalendar(TimeZone.getDefault());
 
@@ -228,6 +229,16 @@
     }
 
     /**
+     * Specifies a value for a
+     * <a href="https://en.wikipedia.org/wiki/Canonical_link_element">canonical link</a>
+     * in the {@code <head>} element.
+     * @param link
+     */
+    public void setCanonicalLink(DocPath link) {
+        this.canonicalLink = link;
+    }
+
+    /**
      * Adds additional content to be included in the HEAD element.
      *
      * @param contents the content
@@ -271,6 +282,13 @@
             tree.addContent(c);
         }
 
+        if (canonicalLink != null) {
+            HtmlTree link = new HtmlTree(HtmlTag.LINK);
+            link.addAttr(HtmlAttr.REL, "canonical");
+            link.addAttr(HtmlAttr.HREF, canonicalLink.getPath());
+            tree.addContent(link);
+        }
+
         addStylesheets(tree);
         addScripts(tree);
 
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/resources/stylesheet.css	Fri Jun 08 09:40:28 2018 -0700
@@ -884,7 +884,7 @@
     border: 1px solid black;
 }
 table.striped > thead {
-    background-color: #DDD;
+    background-color: #E3E3E3;
 }
 table.striped > thead > tr > th, table.striped > thead > tr > td {
     border: 1px solid black;
--- a/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.jdeps/share/classes/com/sun/tools/jdeps/ModuleDotGraph.java	Fri Jun 08 09:40:28 2018 -0700
@@ -44,6 +44,7 @@
 import java.util.Deque;
 import java.util.HashSet;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
@@ -329,7 +330,7 @@
 
                 out.format("digraph \"%s\" {%n", name);
                 out.format("  nodesep=.5;%n");
-                out.format("  ranksep=%f;%n", attributes.rankSep());
+                out.format((Locale)null, "  ranksep=%f;%n", attributes.rankSep());
                 out.format("  pencolor=transparent;%n");
                 out.format("  node [shape=plaintext, fontcolor=\"%s\", fontname=\"%s\","
                                 + " fontsize=%d, margin=\".2,.2\"];%n",
--- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/TargetVM.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/TargetVM.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,7 +53,7 @@
      * TO DO: The limit numbers below are somewhat arbitrary and should
      * be configurable in the future.
      */
-    static private final int OVERLOADED_QUEUE = 2000;
+    static private final int OVERLOADED_QUEUE = 10000;
     static private final int UNDERLOADED_QUEUE = 100;
 
     TargetVM(VirtualMachineImpl vm, Connection connection) {
--- a/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.jlink/share/classes/jdk/tools/jmod/JmodTask.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1224,7 +1224,7 @@
 
             all.put(CMD_FILENAME, new OptionDescriptor() {
                 @Override
-                public Collection<String> options() {
+                public List<String> options() {
                     List<String> ret = new ArrayList<>();
                     ret.add(CMD_FILENAME);
                     return ret;
@@ -1314,7 +1314,7 @@
                         .withValuesConvertedBy(new PatternConverter());
 
         OptionSpec<Void> help
-                = parser.acceptsAll(Set.of("h", "help", "?"), getMessage("main.opt.help"))
+                = parser.acceptsAll(List.of("h", "help", "?"), getMessage("main.opt.help"))
                         .forHelp();
 
         OptionSpec<Void> helpExtra
@@ -1347,7 +1347,7 @@
                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
 
         OptionSpec<List<Path>> modulePath
-                = parser.acceptsAll(Set.of("p", "module-path"),
+                = parser.acceptsAll(List.of("p", "module-path"),
                                     getMessage("main.opt.module-path"))
                         .withRequiredArg()
                         .withValuesConvertedBy(DirPathConverter.INSTANCE);
--- a/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.net/linux/native/libextnet/LinuxSocketOptions.c	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, 2018 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,7 @@
 #include <netinet/tcp.h>
 #include <netinet/in.h>
 #include "jni_util.h"
+#include "jdk_net_LinuxSocketOptions.h"
 
 /*
  * Class:     jdk_net_LinuxSocketOptions
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ByteCodeMachine.java	Fri Jun 08 09:40:28 2018 -0700
@@ -541,7 +541,6 @@
             sprev = s;
             s++;
         }
-        sprev = sbegin; // break;
     }
 
     private void opAnyCharMLStar() {
@@ -550,7 +549,6 @@
             sprev = s;
             s++;
         }
-        sprev = sbegin; // break;
     }
 
     private void opAnyCharStarPeekNext() {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java	Fri Jun 08 09:40:28 2018 -0700
@@ -45,6 +45,7 @@
 
     final int NREGION                   = 10;
     final int MAX_BACKREF_NUM           = 1000;
+    final int MAX_CAPTURE_GROUP_NUM     = 0x8000;
     final int MAX_REPEAT_NUM            = 100000;
     final int MAX_MULTI_BYTE_RANGES_NUM = 10000;
 
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/ScanEnvironment.java	Fri Jun 08 09:40:28 2018 -0700
@@ -62,6 +62,9 @@
     }
 
     public int addMemEntry() {
+        if (numMem >= Config.MAX_CAPTURE_GROUP_NUM) {
+            throw new InternalException(ErrorMessages.ERR_TOO_MANY_CAPTURE_GROUPS);
+        }
         if (numMem++ == 0) {
             memNodes = new Node[SCANENV_MEMNODES_SIZE];
         } else if (numMem >= memNodes.length) {
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/exception/ErrorMessages.java	Fri Jun 08 09:40:28 2018 -0700
@@ -31,6 +31,7 @@
     final String ERR_PARSER_BUG = "internal parser error (bug)";
     final String ERR_UNDEFINED_BYTECODE = "undefined bytecode (bug)";
     final String ERR_UNEXPECTED_BYTECODE = "unexpected bytecode (bug)";
+    final String ERR_TOO_MANY_CAPTURE_GROUPS = "too many capture groups";
 
     /* syntax error */
     final String ERR_END_PATTERN_AT_LEFT_BRACE = "end pattern at left brace";
--- a/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -265,6 +265,40 @@
   delete cht;
 }
 
+struct ChtCountScan {
+  size_t _count;
+  ChtCountScan() : _count(0) {}
+  bool operator()(uintptr_t* val) {
+    _count++;
+    return true; /* continue scan */
+  }
+};
+
+static void cht_move_to(Thread* thr) {
+  uintptr_t val1 = 0x2;
+  uintptr_t val2 = 0xe0000002;
+  uintptr_t val3 = 0x3;
+  SimpleTestLookup stl1(val1), stl2(val2), stl3(val3);
+  SimpleTestTable* from_cht = new SimpleTestTable();
+  EXPECT_TRUE(from_cht->insert(thr, stl1, val1)) << "Insert unique value failed.";
+  EXPECT_TRUE(from_cht->insert(thr, stl2, val2)) << "Insert unique value failed.";
+  EXPECT_TRUE(from_cht->insert(thr, stl3, val3)) << "Insert unique value failed.";
+
+  SimpleTestTable* to_cht = new SimpleTestTable();
+  EXPECT_TRUE(from_cht->try_move_nodes_to(thr, to_cht)) << "Moving nodes to new table failed";
+
+  ChtCountScan scan_old;
+  EXPECT_TRUE(from_cht->try_scan(thr, scan_old)) << "Scanning table should work.";
+  EXPECT_EQ(scan_old._count, (size_t)0) << "All items should be moved";
+
+  ChtCountScan scan_new;
+  EXPECT_TRUE(to_cht->try_scan(thr, scan_new)) << "Scanning table should work.";
+  EXPECT_EQ(scan_new._count, (size_t)3) << "All items should be moved";
+  EXPECT_TRUE(to_cht->get_copy(thr, stl1) == val1) << "Getting an inserted value should work.";
+  EXPECT_TRUE(to_cht->get_copy(thr, stl2) == val2) << "Getting an inserted value should work.";
+  EXPECT_TRUE(to_cht->get_copy(thr, stl3) == val3) << "Getting an inserted value should work.";
+}
+
 static void cht_grow(Thread* thr) {
   uintptr_t val = 0x2;
   uintptr_t val2 = 0x22;
@@ -371,6 +405,10 @@
   nomt_test_doer(cht_scan);
 }
 
+TEST_VM(ConcurrentHashTable, basic_move_to) {
+  nomt_test_doer(cht_move_to);
+}
+
 TEST_VM(ConcurrentHashTable, basic_grow) {
   nomt_test_doer(cht_grow);
 }
--- a/test/hotspot/gtest/utilities/test_globalCounter.cpp	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/gtest/utilities/test_globalCounter.cpp	Fri Jun 08 09:40:28 2018 -0700
@@ -23,7 +23,7 @@
 
 #include "precompiled.hpp"
 #include "runtime/atomic.hpp"
-#include "runtime/orderAccess.inline.hpp"
+#include "runtime/orderAccess.hpp"
 #include "runtime/os.hpp"
 #include "utilities/globalCounter.hpp"
 #include "utilities/globalCounter.inline.hpp"
--- a/test/hotspot/jtreg/ProblemList-graal.txt	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/ProblemList-graal.txt	Fri Jun 08 09:40:28 2018 -0700
@@ -95,49 +95,8 @@
 vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/TestDescription.java                         8191047   generic-all
 vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn009/forceEarlyReturn009.java   8191047   generic-all
 
-vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod012/TestDescription.java                     8195600   generic-all
-vmTestbase/nsk/jdi/ClassType/setValue/setvalue006/TestDescription.java                             8195600   generic-all
-vmTestbase/nsk/jdi/ListeningConnector/listennosuspend/listennosuspend001/TestDescription.java      8195600   generic-all
-vmTestbase/nsk/jdi/Location/lineNumber_s/lineNumber_s002/lineNumber_s002.java                      8195600   generic-all
-vmTestbase/nsk/jdi/Location/sourcePath_s/sourcePath_s002/sourcePath_s002.java                      8195600   generic-all
-vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java   8195600   generic-all
-vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java   8195600   generic-all
-vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod011/TestDescription.java               8195600   generic-all
-vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod012/TestDescription.java               8195600   generic-all
-vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects001/referringObjects001.java   8195600   generic-all
-vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects002/referringObjects002.java   8195600   generic-all
-vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects004/referringObjects004.java   8195600   generic-all
-vmTestbase/nsk/jdi/ObjectReference/setValue/setvalue005/TestDescription.java                       8195600   generic-all
 vmTestbase/nsk/jdi/ReferenceType/instances/instances001/instances001.java                          8195600   generic-all
-vmTestbase/nsk/jdi/ReferenceType/instances/instances002/instances002.java                          8195600   generic-all
-vmTestbase/nsk/jdi/ReferenceType/instances/instances005/instances005.java                          8195600   generic-all
 vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn007/TestDescription.java       8195600   generic-all
-vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames001/ownedMonitorsAndFrames001.java 8195600   generic-all
-vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001.java 8195600   generic-all
-vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts003/instancecounts003.java          8195600   generic-all
-vmTestbase/nsk/jdi/stress/serial/ownedMonitorsAndFrames002/TestDescription.java                    8195600   generic-all
-vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn003/forceEarlyReturn003.java   8195600   generic-all
-vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn004/forceEarlyReturn004.java   8195600   generic-all
-
-vmTestbase/nsk/jdi/Location/sourceName_s/sourceName_s002/sourceName_s002.java                            8200387  generic-all
-vmTestbase/nsk/jdi/Method/allLineLocations_ss/allLineLocations_ss002/allLineLocations_ss002.java         8200387  generic-all
-vmTestbase/nsk/jdi/Method/locationsOfLine_ssi/locationsOfLine_ssi002/locationsOfLine_ssi002.java         8200387  generic-all
-vmTestbase/nsk/jdi/ObjectReference/referringObjects/referringObjects003/referringObjects003.java         8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss003/allLineLocations_ss003.java  8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/allLineLocations_ss/allLineLocations_ss004/allLineLocations_ss004.java  8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/availableStrata/availableStrata002/availableStrata002.java              8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/defaultStratum/defaultStratum002/defaultStratum002.java                 8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi003/locationsOfLine_ssi003.java  8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/locationsOfLine_ssi/locationsOfLine_ssi004/locationsOfLine_ssi004.java  8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/sourceNames/sourceNames003/sourceNames003.java                          8200387  generic-all
-vmTestbase/nsk/jdi/ReferenceType/sourcePaths/sourcePaths003/sourcePaths003.java                          8200387  generic-all
-vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues002/getArgumentValues002.java           8200387  generic-all
-vmTestbase/nsk/jdi/StackFrame/getArgumentValues/getArgumentValues003/getArgumentValues003.java           8200387  generic-all
-vmTestbase/nsk/jdi/stress/serial/heapwalking001/TestDescription.java                                     8200387  generic-all
-vmTestbase/nsk/jdi/ThreadReference/ownedMonitorsAndFrames/ownedMonitorsAndFrames004/ownedMonitorsAndFrames004.java  8200387  generic-all
-vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts001/instancecounts001.java                8200387  generic-all
-vmTestbase/nsk/jdi/VirtualMachine/instanceCounts/instancecounts002/TestDescription.java                  8200387  generic-all
-vmTestbase/nsk/jdi/VirtualMachine/setDefaultStratum/setDefaultStratum002/setDefaultStratum002.java       8200387  generic-all
 
 vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance001/TestDescription.java                              8203174   generic-all
 vmTestbase/nsk/jdi/ArrayType/newInstance/newinstance002/TestDescription.java                              8203174   generic-all
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/c2/TestUnsignedByteCompare.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2018, Red Hat Inc. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8204479
+ * @summary Bitwise AND on byte value sometimes produces wrong result
+ *
+ * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-TieredCompilation
+ *      -XX:-UseOnStackReplacement -XX:-BackgroundCompilation -Xcomp -XX:-Inline
+ *      compiler.c2.TestUnsignedByteCompare
+ */
+
+package compiler.c2;
+
+public class TestUnsignedByteCompare {
+
+    static int p, n;
+
+    static void report(byte[] ba, int i, boolean failed) {
+        // Enable for debugging:
+        // System.out.println((failed ? "Failed" : "Passed") + " with: " + ba[i] + " at " + i);
+    }
+
+    static void m1(byte[] ba) {
+        for (int i = 0; i < ba.length; i++) {
+            if ((ba[i] & 0xFF) < 0x10) {
+               p++;
+               report(ba, i, true);
+            } else {
+               n++;
+               report(ba, i, false);
+            }
+        }
+    }
+
+    static void m2(byte[] ba) {
+        for (int i = 0; i < ba.length; i++) {
+            if (((ba[i] & 0xFF) & 0x80) < 0) {
+               p++;
+               report(ba, i, true);
+            } else {
+               n++;
+               report(ba, i, false);
+            }
+        }
+    }
+
+    static public void main(String[] args) {
+        final int tries = 1_000;
+        final int count = 1_000;
+
+        byte[] ba = new byte[count];
+
+        for (int i = 0; i < count; i++) {
+            int v = -(i % 126 + 1);
+            ba[i] = (byte)v;
+        }
+
+        for (int t = 0; t < tries; t++) {
+            m1(ba);
+            if (p != 0) {
+                throw new IllegalStateException("m1 error: p = " + p + ", n = " + n);
+            }
+        }
+
+        for (int t = 0; t < tries; t++) {
+            m2(ba);
+            if (p != 0) {
+                throw new IllegalStateException("m2 error: p = " + p + ", n = " + n);
+            }
+        }
+    }
+}
--- a/test/hotspot/jtreg/compiler/jsr292/NonInlinedCall/InvokeTest.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/compiler/jsr292/NonInlinedCall/InvokeTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -52,10 +52,12 @@
 public class InvokeTest {
     static MethodHandles.Lookup LOOKUP = MethodHandleHelper.IMPL_LOOKUP;
 
-    static final MethodHandle virtualMH;  // invokevirtual   T.f1
-    static final MethodHandle staticMH;   // invokestatic    T.f2
-    static final MethodHandle intfMH;     // invokeinterface I.f1
-    static final MethodHandle specialMH;  // invokespecial   T.f4 T
+    static final MethodHandle virtualMH; // invokevirtual   T.f1
+    static final MethodHandle staticMH;  // invokestatic    T.f2
+    static final MethodHandle intfMH;    // invokeinterface I.f3
+    static final MethodHandle defaultMH; // invokevirtual   T.f3
+    static final MethodHandle specialMH; // invokespecial   T.f4 T
+    static final MethodHandle privateMH; // invokespecial   I.f4 T
     static final MethodHandle basicMH;
 
     static final WhiteBox WB = WhiteBox.getWhiteBox();
@@ -69,7 +71,9 @@
             virtualMH  = LOOKUP.findVirtual(T.class, "f1", mtype);
             staticMH   = LOOKUP.findStatic (T.class, "f2", mtype);
             intfMH     = LOOKUP.findVirtual(I.class, "f3", mtype);
+            defaultMH  = LOOKUP.findVirtual(T.class, "f3", mtype);
             specialMH  = LOOKUP.findSpecial(T.class, "f4", mtype, T.class);
+            privateMH  = LOOKUP.findSpecial(I.class, "f4", mtype, I.class);
             basicMH    = NonInlinedReinvoker.make(staticMH);
         } catch (Exception e) {
             throw new Error(e);
@@ -92,24 +96,51 @@
         @DontInline public Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return P2.class; }
     }
 
-    static interface I {
+    interface I {
         @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return I.class; }
+        @DontInline private Class<?> f4() { if (doDeopt) WB.deoptimizeAll(); return I.class; }
     }
 
+    interface J1 extends I {
+        @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return J1.class; }
+    }
+
+    interface J2 extends I {
+        @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return J2.class; }
+    }
+
+    interface J3 extends I {
+        @DontInline default Class<?> f3() { if (doDeopt) WB.deoptimizeAll(); return J3.class; }
+    }
+
+    static class Q1 extends T implements J1 {}
+    static class Q2 extends T implements J2 {}
+    static class Q3 extends T implements J3 {}
+
     @DontInline
-    static void linkToVirtual(Object obj, Class<?> extecpted) {
+    static void linkToVirtual(T recv, Class<?> expected) {
         try {
-            Class<?> cls = (Class<?>)virtualMH.invokeExact((T)obj);
-            assertEquals(cls, obj.getClass());
+            Class<?> cls = (Class<?>)virtualMH.invokeExact(recv);
+            assertEquals(cls, expected);
         } catch (Throwable e) {
             throw new Error(e);
         }
     }
 
     @DontInline
-    static void linkToInterface(Object obj, Class<?> expected) {
+    static void linkToVirtualDefault(T recv, Class<?> expected) {
         try {
-            Class<?> cls = (Class<?>)intfMH.invokeExact((I)obj);
+            Class<?> cls = (Class<?>)defaultMH.invokeExact(recv);
+            assertEquals(cls, expected);
+        } catch (Throwable e) {
+            throw new Error(e);
+        }
+    }
+
+    @DontInline
+    static void linkToInterface(I recv, Class<?> expected) {
+        try {
+            Class<?> cls = (Class<?>)intfMH.invokeExact(recv);
             assertEquals(cls, expected);
         } catch (Throwable e) {
             throw new Error(e);
@@ -127,9 +158,9 @@
     }
 
     @DontInline
-    static void linkToSpecial(Object obj, Class<?> expected) {
+    static void linkToSpecial(T recv, Class<?> expected) {
         try {
-            Class<?> cls = (Class<?>)specialMH.invokeExact((T)obj);
+            Class<?> cls = (Class<?>)specialMH.invokeExact(recv);
             assertEquals(cls, expected);
         } catch (Throwable e) {
             throw new Error(e);
@@ -137,6 +168,17 @@
     }
 
     @DontInline
+    static void linkToSpecialIntf(I recv, Class<?> expected) {
+        try {
+            Class<?> cls = (Class<?>)privateMH.invokeExact(recv);
+            assertEquals(cls, expected);
+        } catch (Throwable e) {
+            throw new Error(e);
+        }
+    }
+
+
+    @DontInline
     static void invokeBasic() {
         try {
             Class<?> cls = (Class<?>)MethodHandleHelper.invokeBasicL(basicMH);
@@ -171,13 +213,33 @@
 
         // Monomorphic case (optimized virtual call)
         run(() -> linkToVirtual(new T(), T.class));
+        run(() -> linkToVirtualDefault(new T(), I.class));
 
-        // Megamorphic case (virtual call)
-        Object[] recv = new Object[] { new T(), new P1(), new P2() };
+        // Megamorphic case (optimized virtual call)
+        run(() -> {
+            linkToVirtual(new T() {}, T.class);
+            linkToVirtual(new T() {}, T.class);
+            linkToVirtual(new T() {}, T.class);
+        });
+
         run(() -> {
-            for (Object r : recv) {
-                linkToVirtual(r, r.getClass());
-            }});
+            linkToVirtualDefault(new T(){}, I.class);
+            linkToVirtualDefault(new T(){}, I.class);
+            linkToVirtualDefault(new T(){}, I.class);
+        });
+
+        // Megamorphic case (virtual call), multiple implementations
+        run(() -> {
+            linkToVirtual(new T(),  T.class);
+            linkToVirtual(new P1(), P1.class);
+            linkToVirtual(new P2(), P2.class);
+        });
+
+        run(() -> {
+            linkToVirtualDefault(new Q1(), J1.class);
+            linkToVirtualDefault(new Q2(), J2.class);
+            linkToVirtualDefault(new Q3(), J3.class);
+        });
     }
 
     static void testInterface() {
@@ -190,17 +252,18 @@
         run(() -> linkToInterface(new T(), I.class));
 
         // Megamorphic case (virtual call)
-        Object[][] recv = new Object[][] {{new T(), I.class}, {new P1(), P1.class}, {new P2(), P2.class}};
         run(() -> {
-            for (Object[] r : recv) {
-                linkToInterface(r[0], (Class<?>)r[1]);
-            }});
+            linkToInterface(new T(),  I.class);
+            linkToInterface(new P1(), P1.class);
+            linkToInterface(new P2(), P2.class);
+        });
     }
 
     static void testSpecial() {
         System.out.println("linkToSpecial");
         // Monomorphic case (optimized virtual call)
         run(() -> linkToSpecial(new T(), T.class));
+        run(() -> linkToSpecialIntf(new T(), I.class));
     }
 
     static void testStatic() {
--- a/test/hotspot/jtreg/gc/TestAgeOutput.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/TestAgeOutput.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,8 +32,20 @@
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -XX:+UseSerialGC TestAgeOutput UseSerialGC
+ * @run main/othervm -XX:+UseG1GC TestAgeOutput UseG1GC
+ */
+
+/*
+ * @test TestAgeOutputCMS
+ * @bug 8164936
+ * @key gc
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -XX:+UseConcMarkSweepGC TestAgeOutput UseConcMarkSweepGC
- * @run main/othervm -XX:+UseG1GC TestAgeOutput UseG1GC
  */
 
 import sun.hotspot.WhiteBox;
--- a/test/hotspot/jtreg/gc/TestGenerationPerfCounter.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/TestGenerationPerfCounter.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,8 +38,21 @@
  * @run main/othervm -XX:+UsePerfData -XX:+UseSerialGC TestGenerationPerfCounter
  * @run main/othervm -XX:+UsePerfData -XX:+UseParallelGC TestGenerationPerfCounter
  * @run main/othervm -XX:+UsePerfData -XX:+UseG1GC TestGenerationPerfCounter
+ */
+
+/* @test TestGenerationPerfCounterCMS
+ * @bug 8080345
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
+ * @library /test/lib /
+ * @summary Tests that the sun.gc.policy.generations returns 2 for all GCs.
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ *          java.management/sun.management
+ *          jdk.internal.jvmstat/sun.jvmstat.monitor
  * @run main/othervm -XX:+UsePerfData -XX:+UseConcMarkSweepGC TestGenerationPerfCounter
  */
+
 public class TestGenerationPerfCounter {
     public static void main(String[] args) throws Exception {
         long numGenerations =
--- a/test/hotspot/jtreg/gc/TestMemoryInitializationWithCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/TestMemoryInitializationWithCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,6 +1,5 @@
-
 /*
- * Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018 Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +25,7 @@
  * @test TestMemoryInitializationWithCMS
  * @key gc
  * @bug 4668531
- * @requires vm.debug & vm.gc.ConcMarkSweep
+ * @requires vm.debug & vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Simple test for -XX:+CheckMemoryInitialization doesn't crash VM
  * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+CheckMemoryInitialization TestMemoryInitializationWithCMS
  */
--- a/test/hotspot/jtreg/gc/TestMemoryMXBeansAndPoolsPresence.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/TestMemoryMXBeansAndPoolsPresence.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -35,11 +35,20 @@
  *          java.management
  * @requires vm.gc == null
  * @run main/othervm -XX:+UseG1GC TestMemoryMXBeansAndPoolsPresence G1
- * @run main/othervm -XX:+UseConcMarkSweepGC TestMemoryMXBeansAndPoolsPresence CMS
  * @run main/othervm -XX:+UseParallelGC TestMemoryMXBeansAndPoolsPresence Parallel
  * @run main/othervm -XX:+UseSerialGC TestMemoryMXBeansAndPoolsPresence Serial
  */
 
+/* @test TestMemoryMXBeansAndPoolsPresenceCMS
+ * @bug 8191564
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @comment Graal does not support CMS
+ * @requires vm.gc == null & !vm.graal.enabled
+ * @run main/othervm -XX:+UseConcMarkSweepGC TestMemoryMXBeansAndPoolsPresence CMS
+ */
+
 class GCBeanDescription {
     public String name;
     public String[] poolNames;
--- a/test/hotspot/jtreg/gc/TestNumWorkerOutput.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/TestNumWorkerOutput.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,8 +31,20 @@
  * @library /test/lib
  * @build sun.hotspot.WhiteBox
  * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm -XX:+UseG1GC TestNumWorkerOutput UseG1GC
+ */
+
+/*
+ * @test TestNumWorkerOutputCMS
+ * @bug 8165292
+ * @key gc
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
+ * @modules java.base/jdk.internal.misc
+ * @library /test/lib
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -XX:+UseConcMarkSweepGC TestNumWorkerOutput UseConcMarkSweepGC
- * @run main/othervm -XX:+UseG1GC TestNumWorkerOutput UseG1GC
  */
 
 import sun.hotspot.WhiteBox;
--- a/test/hotspot/jtreg/gc/TestSystemGC.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/TestSystemGC.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,14 +30,21 @@
  * @run main/othervm -XX:+UseSerialGC TestSystemGC
  * @run main/othervm -XX:+UseParallelGC TestSystemGC
  * @run main/othervm -XX:+UseParallelGC -XX:-UseParallelOldGC TestSystemGC
- * @run main/othervm -XX:+UseConcMarkSweepGC TestSystemGC
- * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
  * @run main/othervm -XX:+UseG1GC TestSystemGC
  * @run main/othervm -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
  * @run main/othervm -XX:+UseLargePages TestSystemGC
  * @run main/othervm -XX:+UseLargePages -XX:+UseLargePagesInMetaspace TestSystemGC
  */
 
+/*
+ * @test TestSystemGCCMS
+ * @key gc
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
+ * @run main/othervm -XX:+UseConcMarkSweepGC TestSystemGC
+ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
+ */
+
 public class TestSystemGC {
   public static void main(String args[]) throws Exception {
     System.gc();
--- a/test/hotspot/jtreg/gc/arguments/TestAlignmentToUseLargePages.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/arguments/TestAlignmentToUseLargePages.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,10 +34,18 @@
  * @run main/othervm -Xms71M -Xmx91M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
  * @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:+UseLargePages TestAlignmentToUseLargePages
  * @run main/othervm -Xms71M -Xmx91M -XX:+UseSerialGC -XX:-UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
+ * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
+ */
+
+/**
+ * @test TestAlignmentToUseLargePagesCMS
+ * @key gc regression
+ * @bug 8024396
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
  * @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:+UseLargePages TestAlignmentToUseLargePages
  * @run main/othervm -Xms71M -Xmx91M -XX:+UseConcMarkSweepGC -XX:-UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:+UseLargePages TestAlignmentToUseLargePages
- * @run main/othervm -Xms71M -Xmx91M -XX:+UseG1GC -XX:-UseLargePages TestAlignmentToUseLargePages
  */
 
 public class TestAlignmentToUseLargePages {
--- a/test/hotspot/jtreg/gc/arguments/TestCMSHeapSizeFlags.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/arguments/TestCMSHeapSizeFlags.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test TestCMSHeapSizeFlags
  * @key gc
  * @bug 8006088
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Tests argument processing for initial and maximum heap size for the CMS collector
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/arguments/TestMaxNewSize.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,16 +27,28 @@
  * @bug 7057939
  * @summary Make sure that MaxNewSize always has a useful value after argument
  * processing.
+ * @requires vm.gc=="null"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
  * @run main TestMaxNewSize -XX:+UseSerialGC
  * @run main TestMaxNewSize -XX:+UseParallelGC
- * @run main TestMaxNewSize -XX:+UseConcMarkSweepGC
  * @run main TestMaxNewSize -XX:+UseG1GC
  * @author thomas.schatzl@oracle.com, jesper.wilhelmsson@oracle.com
  */
 
+/*
+ * @test TestMaxNewSizeCMS
+ * @key gc
+ * @bug 7057939
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @run main TestMaxNewSize -XX:+UseConcMarkSweepGC
+ */
+
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
--- a/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgo.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/arguments/TestUseCompressedOopsErgo.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @key gc
  * @bug 8010722
  * @summary Tests ergonomics for UseCompressedOops.
+ * @requires vm.gc=="null"
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management/sun.management
@@ -35,8 +36,22 @@
  * @run main/othervm TestUseCompressedOopsErgo -XX:+UseG1GC
  * @run main/othervm TestUseCompressedOopsErgo -XX:+UseParallelGC
  * @run main/othervm TestUseCompressedOopsErgo -XX:+UseParallelGC -XX:-UseParallelOldGC
+ * @run main/othervm TestUseCompressedOopsErgo -XX:+UseSerialGC
+ */
+
+/*
+ * @test TestUseCompressedOopsErgoCMS
+ * @key gc
+ * @bug 8010722
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management/sun.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm TestUseCompressedOopsErgo -XX:+UseConcMarkSweepGC
- * @run main/othervm TestUseCompressedOopsErgo -XX:+UseSerialGC
  */
 
 public class TestUseCompressedOopsErgo {
--- a/test/hotspot/jtreg/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * 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
  * @key gc
  * @bug 8049831
+ * @requires !vm.graal.enabled
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/gc/class_unloading/TestClassUnloadingDisabled.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/class_unloading/TestClassUnloadingDisabled.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,22 @@
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:-ClassUnloading -XX:+UseParallelGC TestClassUnloadingDisabled
  *
+ */
+
+/*
+ * @test
+ * @key gc
+ * @bug 8114823
+ * @comment Graal does not support CMS
+ * @requires vm.gc=="null" & !vm.graal.enabled
+ * @requires vm.opt.ExplicitGCInvokesConcurrent != true
+ * @requires vm.opt.ClassUnloading != true
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
  *                   -XX:-ClassUnloading -XX:+UseConcMarkSweepGC TestClassUnloadingDisabled
  */
--- a/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/cms/DisableResizePLAB.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * 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 @@
  * @key gc
  * @bug 8060467
  * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize
  * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -Xlog:gc=debug DisableResizePLAB
  */
--- a/test/hotspot/jtreg/gc/cms/GuardShrinkWarning.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/cms/GuardShrinkWarning.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @key gc regression
  * @summary Remove warning about CMS generation shrinking.
  * @bug 8012111
+ * @requires !vm.graal.enabled
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
--- a/test/hotspot/jtreg/gc/cms/TestBubbleUpRef.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/cms/TestBubbleUpRef.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
 
 /*
  * @test
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @key cte_test
  * @bug 4950157
  * @summary Stress the behavior of ergonomics when the heap is nearly full and
--- a/test/hotspot/jtreg/gc/cms/TestCMSScavengeBeforeRemark.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/cms/TestCMSScavengeBeforeRemark.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @test TestCMSScavengeBeforeRemark
  * @key gc
  * @bug 8139868
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Run CMS with CMSScavengeBeforeRemark
  * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+CMSScavengeBeforeRemark -XX:+ExplicitGCInvokesConcurrent -Xmx256m -Xlog:gc=debug TestCMSScavengeBeforeRemark
  */
--- a/test/hotspot/jtreg/gc/cms/TestMBeanCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/cms/TestMBeanCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test TestMBeanCMS.java
  * @bug 6581734
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @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 TestMBeanCMS
--- a/test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/concurrent_phase_control/TestConcurrentPhaseControlCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
  * @test TestConcurrentPhaseControlCMS
  * @bug 8169517
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Verify CMS GC doesn't support WhiteBox concurrent phase control.
  * @key gc
  * @modules java.base
--- a/test/hotspot/jtreg/gc/metaspace/TestMetaspaceCMSCancel.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/metaspace/TestMetaspaceCMSCancel.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
 /* @test TestMetaspaceCMSCancel
  * @bug 8026752
  * @summary Tests cancel of CMS concurrent cycle for Metaspace after a full GC
+ * @requires !vm.graal.enabled
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  * @build sun.hotspot.WhiteBox
--- a/test/hotspot/jtreg/gc/startup_warnings/TestCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/startup_warnings/TestCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,14 +22,15 @@
  */
 
 /*
-* @test TestCMS
-* @key gc
-* @bug 8006398 8155948 8179013
-* @summary Test that CMS prints a warning message
-* @library /test/lib
-* @modules java.base/jdk.internal.misc
-*          java.management
-*/
+ * @test TestCMS
+ * @key gc
+ * @bug 8006398 8155948 8179013
+ * @summary Test that CMS prints a warning message
+ * @requires !vm.graal.enabled
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.management
+ */
 
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
--- a/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/stress/TestReclaimStringsLeaksMemory.java	Fri Jun 08 09:40:28 2018 -0700
@@ -25,8 +25,7 @@
  * @test TestReclaimStringsLeaksMemory
  * @bug 8180048
  * @summary Ensure that during a Full GC interned string memory is reclaimed completely.
- * @requires vm.gc=="null"
- * @requires !vm.debug
+ * @requires vm.gc=="null" & !vm.graal.enabled & !vm.debug
  * @key gc
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
--- a/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/stress/gcbasher/TestGCBasherWithCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@
  * @test TestGCBasherWithCMS
  * @key gc stress
  * @requires vm.gc.ConcMarkSweep
- * @requires vm.flavor == "server" & !vm.emulatedClient
+ * @requires vm.flavor == "server" & !vm.emulatedClient & !vm.graal.enabled
  * @summary Stress the CMS GC by trying to make old objects more likely to be garbage than young objects.
  * @run main/othervm/timeout=200 -Xlog:gc*=info -Xmx256m -server -XX:+UseConcMarkSweepGC TestGCBasherWithCMS 120000
  */
--- a/test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/stress/gclocker/TestGCLockerWithCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 /*
  * @test TestGCLockerWithCMS
  * @key gc
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Stress CMS' GC locker by calling GetPrimitiveArrayCritical while concurrently filling up old gen.
  * @run main/native/othervm/timeout=200 -Xlog:gc*=info -Xms1500m -Xmx1500m -XX:+UseConcMarkSweepGC TestGCLockerWithCMS
  */
--- a/test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/stress/gcold/TestGCOldWithCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 /*
  * @test TestGCOldWithCMS
  * @key gc
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Stress the CMS GC by trying to make old objects more likely to be garbage than young objects.
  * @run main/othervm -Xmx384M -XX:+UseConcMarkSweepGC TestGCOldWithCMS 50 1 20 10 10000
  */
--- a/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/gc/stress/systemgc/TestSystemGCWithCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @test TestSystemGCWithCMS
  * @key gc stress
  * @bug 8190703
- * @requires vm.gc.ConcMarkSweep
+ * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled
  * @summary Stress the CMS GC full GC by allocating objects of different lifetimes concurrently with System.gc().
  * @run main/othervm/timeout=300 -Xlog:gc*=info -Xmx512m -XX:+UseConcMarkSweepGC TestSystemGCWithCMS 270
  */
--- a/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/CompressedOops/UseCompressedOops.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,9 @@
  * @library /test/lib
  * @modules java.base/jdk.internal.misc
  *          java.management
- * @run main UseCompressedOops
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. UseCompressedOops
  */
 import java.util.ArrayList;
 import java.util.Collections;
@@ -36,6 +38,8 @@
 import jdk.test.lib.process.ProcessTools;
 import jdk.test.lib.process.OutputAnalyzer;
 
+import sun.hotspot.code.Compiler;
+
 public class UseCompressedOops {
 
     public static void main(String[] args) throws Exception {
@@ -51,7 +55,9 @@
         testCompressedOopsModes(args);
         // Test GCs.
         testCompressedOopsModes(args, "-XX:+UseG1GC");
-        testCompressedOopsModes(args, "-XX:+UseConcMarkSweepGC");
+        if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+            testCompressedOopsModes(args, "-XX:+UseConcMarkSweepGC");
+        }
         testCompressedOopsModes(args, "-XX:+UseSerialGC");
         testCompressedOopsModes(args, "-XX:+UseParallelGC");
         testCompressedOopsModes(args, "-XX:+UseParallelOldGC");
--- a/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/MemberName/MemberNameLeak.java	Fri Jun 08 09:40:28 2018 -0700
@@ -26,13 +26,17 @@
  * @bug 8174749
  * @summary MemberNameTable should reuse entries
  * @library /test/lib
- * @run main MemberNameLeak
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. MemberNameLeak
  */
 
 import java.lang.invoke.*;
 import jdk.test.lib.process.OutputAnalyzer;
 import jdk.test.lib.process.ProcessTools;
 
+import sun.hotspot.code.Compiler;
+
 public class MemberNameLeak {
     static class Leak {
       public void callMe() {
@@ -69,6 +73,8 @@
         test("-XX:+UseG1GC");
         test("-XX:+UseParallelGC");
         test("-XX:+UseSerialGC");
-        test("-XX:+UseConcMarkSweepGC");
+        if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+            test("-XX:+UseConcMarkSweepGC");
+        }
     }
 }
--- a/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/CommandLineFlagCombo.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,14 +32,18 @@
  * @modules java.base/jdk.internal.misc
  *          java.management
  *          jdk.jartool/sun.tools.jar
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  * @compile test-classes/Hello.java
- * @run main/timeout=240 CommandLineFlagCombo
+ * @run main/othervm/timeout=240 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. CommandLineFlagCombo
  */
 
 import jdk.test.lib.BuildHelper;
 import jdk.test.lib.Platform;
 import jdk.test.lib.process.OutputAnalyzer;
 
+import sun.hotspot.code.Compiler;
+
 public class CommandLineFlagCombo {
 
     // shared base address test table
@@ -122,6 +126,11 @@
             System.out.println("Test case not applicable on non-commercial builds");
             return true;
         }
+        if (Compiler.isGraalEnabled() && testEntry.equals("-XX:+UseConcMarkSweepGC"))
+        {
+            System.out.println("Graal does not support CMS");
+            return true;
+        }
 
         return false;
     }
--- a/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/appcds/sharedStrings/IncompatibleOptions.java	Fri Jun 08 09:40:28 2018 -0700
@@ -32,13 +32,17 @@
  * @modules java.base/jdk.internal.misc
  * @modules java.management
  *          jdk.jartool/sun.tools.jar
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
  * @build HelloString
- * @run main IncompatibleOptions
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. IncompatibleOptions
  */
 
 import jdk.test.lib.Asserts;
 import jdk.test.lib.process.OutputAnalyzer;
 
+import sun.hotspot.code.Compiler;
+
 public class IncompatibleOptions {
     static final String COOPS_DUMP_WARNING =
         "Cannot dump shared archive when UseCompressedOops or UseCompressedClassPointers is off";
@@ -62,7 +66,9 @@
         // incompatible GCs
         testDump(2, "-XX:+UseParallelGC", "", GC_WARNING, false);
         testDump(3, "-XX:+UseSerialGC", "", GC_WARNING, false);
-        testDump(4, "-XX:+UseConcMarkSweepGC", "", GC_WARNING, false);
+        if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+            testDump(4, "-XX:+UseConcMarkSweepGC", "", GC_WARNING, false);
+        }
 
         // ======= archive with compressed oops, run w/o
         testDump(5, "-XX:+UseG1GC", "-XX:+UseCompressedOops", null, false);
@@ -73,7 +79,9 @@
         // Still run, to ensure no crash or exception
         testExec(6, "-XX:+UseParallelGC", "", "", false);
         testExec(7, "-XX:+UseSerialGC", "", "", false);
-        testExec(8, "-XX:+UseConcMarkSweepGC", "", "", false);
+        if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+            testExec(8, "-XX:+UseConcMarkSweepGC", "", "", false);
+        }
 
         // Test various oops encodings, by varying ObjectAlignmentInBytes and heap sizes
         testDump(9, "-XX:+UseG1GC", "-XX:ObjectAlignmentInBytes=8", null, false);
--- a/test/hotspot/jtreg/runtime/signal/TestSigalrm.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigalrm.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigalrm01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigbus.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigbus.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigbus01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigcld.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigcld.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigcld01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigcont.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigcont.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigcont01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigemt.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigemt.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigemt01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigfpe.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigfpe.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigfpe01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigfreeze.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigfreeze.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigfreeze01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSighup.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSighup.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sighup01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigill.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigill.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigill01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigint.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigint.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigint01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigiot.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigiot.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigiot01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSiglost.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSiglost.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/siglost01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSiglwp.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSiglwp.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/siglwp01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigpipe.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigpipe.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigpipe01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigpoll.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigpoll.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigpoll01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigprof.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigprof.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigprof01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigpwr.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigpwr.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigpwr01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigquit.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigquit.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigquit01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigsegv.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigsegv.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigsegv01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigstop.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigstop.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigstop01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigsys.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigsys.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigsys01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigterm.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigterm.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigterm01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigthaw.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigthaw.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigthaw01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigtrap.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigtrap.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigtrap01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigtstp.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigtstp.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigtstp01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigttin.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigttin.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigttin01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigttou.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigttou.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigttou01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigurg.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigurg.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigurg01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigusr1.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigusr1.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigusr101.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigusr2.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigusr2.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigusr201.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigvtalrm.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigvtalrm.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigvtalrm01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigwinch.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigwinch.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigwinch01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigxcpu.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigxcpu.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigxcpu01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigxfsz.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigxfsz.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigxfsz01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- a/test/hotspot/jtreg/runtime/signal/TestSigxres.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/runtime/signal/TestSigxres.java	Fri Jun 08 09:40:28 2018 -0700
@@ -24,7 +24,7 @@
 
 /*
  * @test
- * @requires os.family != "windows"
+ * @requires os.family != "windows" & os.family != "aix"
  *
  * @summary converted from VM testbase runtime/signal/sigxres01.
  * VM testbase keywords: [signal, runtime, linux, solaris, macosx]
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/dcmd/vm/ClassLoaderHierarchyTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, SAP SE. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Test of diagnostic command VM.classloaders
+ * @library /test/lib
+ * @modules java.base/jdk.internal.misc
+ *          java.compiler
+ *          java.management
+ *          jdk.internal.jvmstat/sun.jvmstat.monitor
+ * @run testng ClassLoaderHierarchyTest
+ */
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import jdk.test.lib.process.OutputAnalyzer;
+import jdk.test.lib.dcmd.CommandExecutor;
+import jdk.test.lib.dcmd.JMXExecutor;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+
+public class ClassLoaderHierarchyTest {
+
+//+-- <bootstrap>
+//      |
+//      +-- "platform", jdk.internal.loader.ClassLoaders$PlatformClassLoader
+//      |     |
+//      |     +-- "app", jdk.internal.loader.ClassLoaders$AppClassLoader
+//      |
+//      +-- jdk.internal.reflect.DelegatingClassLoader
+//      |
+//      +-- "Kevin", ClassLoaderHierarchyTest$TestClassLoader
+//      |
+//      +-- ClassLoaderHierarchyTest$TestClassLoader
+//            |
+//            +-- "Bill", ClassLoaderHierarchyTest$TestClassLoader
+
+    public void run(CommandExecutor executor) throws ClassNotFoundException {
+
+        ClassLoader unnamed_cl = new TestClassLoader(null, null);
+        Class<?> c1 = Class.forName("TestClass2", true, unnamed_cl);
+        if (c1.getClassLoader() != unnamed_cl) {
+            Assert.fail("TestClass defined by wrong classloader: " + c1.getClassLoader());
+        }
+
+        ClassLoader named_cl = new TestClassLoader("Kevin", null);
+        Class<?> c2 = Class.forName("TestClass2", true, named_cl);
+        if (c2.getClassLoader() != named_cl) {
+            Assert.fail("TestClass defined by wrong classloader: " + c2.getClassLoader());
+        }
+
+        ClassLoader named_child_cl = new TestClassLoader("Bill", unnamed_cl);
+        Class<?> c3 = Class.forName("TestClass2", true, named_child_cl);
+        if (c3.getClassLoader() != named_child_cl) {
+            Assert.fail("TestClass defined by wrong classloader: " + c3.getClassLoader());
+        }
+
+        // First test: simple output, no classes displayed
+        OutputAnalyzer output = executor.execute("VM.classloaders");
+        output.shouldContain("<bootstrap>");
+        output.shouldMatch(".*TestClassLoader");
+        output.shouldMatch("Kevin.*TestClassLoader");
+        output.shouldMatch("Bill.*TestClassLoader");
+
+        // Second test: print with classes.
+        output = executor.execute("VM.classloaders show-classes");
+        output.shouldContain("<bootstrap>");
+        output.shouldContain("java.lang.Object");
+        output.shouldMatch(".*TestClassLoader");
+        output.shouldMatch("Kevin.*TestClassLoader");
+        output.shouldMatch("Bill.*TestClassLoader");
+        output.shouldContain("TestClass2");
+    }
+
+    static class TestClassLoader extends ClassLoader {
+
+        public TestClassLoader() {
+            super();
+        }
+
+        public TestClassLoader(String name, ClassLoader parent) {
+            super(name, parent);
+        }
+
+        public static final String CLASS_NAME = "TestClass2";
+
+        static ByteBuffer readClassFile(String name)
+        {
+            File f = new File(System.getProperty("test.classes", "."),
+                              name);
+            try (FileInputStream fin = new FileInputStream(f);
+                 FileChannel fc = fin.getChannel())
+            {
+                return fc.map(FileChannel.MapMode.READ_ONLY, 0, fc.size());
+            } catch (IOException e) {
+                Assert.fail("Can't open file: " + name, e);
+            }
+
+            /* Will not reach here as Assert.fail() throws exception */
+            return null;
+        }
+
+        protected Class<?> loadClass(String name, boolean resolve)
+            throws ClassNotFoundException
+        {
+            Class<?> c;
+            if (!CLASS_NAME.equals(name)) {
+                c = super.loadClass(name, resolve);
+            } else {
+                // should not delegate to the system class loader
+                c = findClass(name);
+                if (resolve) {
+                    resolveClass(c);
+                }
+            }
+            return c;
+        }
+
+        protected Class<?> findClass(String name)
+            throws ClassNotFoundException
+        {
+            if (!CLASS_NAME.equals(name)) {
+                throw new ClassNotFoundException("Unexpected class: " + name);
+            }
+            return defineClass(name, readClassFile(name + ".class"), null);
+        }
+
+    }
+
+    @Test
+    public void jmx() throws ClassNotFoundException {
+        run(new JMXExecutor());
+    }
+
+}
+
+class TestClass2 {
+    static {
+        Runnable r = () -> System.out.println("Hello");
+        r.run();
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/jvmti/GetSystemProperty/JvmtiGetSystemPropertyTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8203329
+ * @summary Verifies the JVMTI GetSystemProperty API returns the updated java.vm.info value
+ * @library /test/lib
+ * @run main/othervm/native -agentlib:JvmtiGetSystemPropertyTest JvmtiGetSystemPropertyTest
+ *
+ */
+
+public class JvmtiGetSystemPropertyTest {
+    private static native String getSystemProperty();
+
+    public static void main(String[] args) throws Exception {
+        String vm_info = System.getProperty("java.vm.info");
+        String vm_info_jvmti = getSystemProperty();
+        System.out.println("java.vm.info from java:  " + vm_info);
+        System.out.println("java.vm.info from jvmti: " + vm_info_jvmti);
+        if (!vm_info.equals(vm_info_jvmti)) {
+            throw new RuntimeException("java.vm.info poperties not equal: \"" +
+                                       vm_info + "\" != \"" + vm_info_jvmti + "\"");
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/serviceability/jvmti/GetSystemProperty/libJvmtiGetSystemPropertyTest.c	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 <stdio.h>
+#include <string.h>
+#include <jvmti.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+static jvmtiEnv *jvmti = NULL;
+
+JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) {
+  int err = (*jvm)->GetEnv(jvm, (void**) &jvmti, JVMTI_VERSION_9);
+  if (err != JNI_OK) {
+    return JNI_ERR;
+  }
+  return JNI_OK;
+}
+
+JNIEXPORT jstring JNICALL
+Java_JvmtiGetSystemPropertyTest_getSystemProperty(JNIEnv *env, jclass cls) {
+  jvmtiError err;
+  char* prop_value;
+
+  err = (*jvmti)->GetSystemProperty(jvmti, "java.vm.info", &prop_value);
+  if (err != JVMTI_ERROR_NONE) {
+    return NULL;
+  }
+
+  return (*env)->NewStringUTF(env, prop_value);
+}
+
+#ifdef __cplusplus
+}
+#endif
--- a/test/hotspot/jtreg/serviceability/sa/TestUniverse.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/serviceability/sa/TestUniverse.java	Fri Jun 08 09:40:28 2018 -0700
@@ -21,6 +21,8 @@
  * questions.
  */
 
+import sun.hotspot.code.Compiler;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.io.IOException;
@@ -37,7 +39,9 @@
  * @bug 8190307
  * @library /test/lib
  * @build jdk.test.lib.apps.*
- * @run main/othervm TestUniverse
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. TestUniverse
  */
 
 public class TestUniverse {
@@ -132,7 +136,9 @@
             test("-XX:+UseG1GC");
             test("-XX:+UseParallelGC");
             test("-XX:+UseSerialGC");
-            test("-XX:+UseConcMarkSweepGC");
+            if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+              test("-XX:+UseConcMarkSweepGC");
+            }
         } catch (Exception e) {
             throw new Error("Test failed with " + e);
         }
--- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TestsGenerator.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,6 +37,7 @@
 import jdk.test.lib.jittester.utils.PseudoRandom;
 
 public abstract class TestsGenerator implements BiConsumer<IRNode, IRNode> {
+    private static final int DEFAULT_JTREG_TIMEOUT = 120;
     protected static final String JAVA_BIN = getJavaPath();
     protected static final String JAVAC = Paths.get(JAVA_BIN, "javac").toString();
     protected static final String JAVA = Paths.get(JAVA_BIN, "java").toString();
@@ -73,15 +74,17 @@
         pb.redirectError(new File(name + ".err"));
         pb.redirectOutput(new File(name + ".out"));
         Process process = pb.start();
-        if (process.waitFor(Automatic.MINUTES_TO_WAIT, TimeUnit.MINUTES)) {
-            try (FileWriter file = new FileWriter(name + ".exit")) {
-                file.write(Integer.toString(process.exitValue()));
+        try {
+            if (process.waitFor(DEFAULT_JTREG_TIMEOUT, TimeUnit.SECONDS)) {
+                try (FileWriter file = new FileWriter(name + ".exit")) {
+                    file.write(Integer.toString(process.exitValue()));
+                }
+                return process.exitValue();
             }
-            return process.exitValue();
-        } else {
+        } finally {
             process.destroyForcibly();
-            return -1;
         }
+        return -1;
     }
 
     protected static void compilePrinter() {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002.java	Fri Jun 08 09:40:28 2018 -0700
@@ -33,55 +33,16 @@
 import java.io.*;
 
 public class issynthetic002 {
-    final static String METHOD_NAME[] = {
-        "<init>",
-        "Mv",
-        "Mz", "Mz1", "Mz2",
-        "Mb", "Mb1", "Mb2",
-        "Mc", "Mc1", "Mc2",
-        "Md", "Md1", "Md2",
-        "Mf", "Mf1", "Mf2",
-        "Mi", "Mi1", "Mi2",
-        "Ml", "Ml1", "Ml2",
-        "Mr", "Mr1", "Mr2",
 
-        "MvF", "MlF", "MlF1", "MlF2",
-        "MvN", "MlN", "MlN1", "MlN2",
-        "MvS", "MlS", "MlS1", "MlS2",
-        "MvI", "MlI", "MlI1", "MlI2",
-        "MvY", "MlY", "MlY1", "MlY2",
-        "MvU", "MlU", "MlU1", "MlU2",
-        "MvR", "MlR", "MlR1", "MlR2",
-        "MvP", "MlP", "MlP1", "MlP2",
 
-        "MX", "MX1", "MX2",
-        "MO", "MO1", "MO2",
-
-        "MLF", "MLF1", "MLF2",
-        "MLN", "MLN1", "MLN2",
-        "MLS", "MLS1", "MLS2",
-        "MLI", "MLI1", "MLI2",
-        "MLY", "MLY1", "MLY2",
-        "MLU", "MLU1", "MLU2",
-        "MLR", "MLR1", "MLR2",
-        "MLP", "MLP1", "MLP2",
-
-        "ME", "ME1", "ME2",
-        "MEF", "MEF1", "MEF2",
-        "MEN", "MEN1", "MEN2",
-        "MES", "ME1S", "ME2S",
-        "MEI", "MEI1", "MEI2",
-        "MEY", "MEY1", "MEY2",
-        "MEU", "MEU1", "MEU2",
-        "MER", "MER1", "MER2",
-        "MEP", "MEP1", "MEP2"
-    };
+    final static String SYNTHETIC_METHOD_NAME = "test";
+    final static String SYNTHETIC_METHOD_SIGNATURE = "(Ljava/lang/Object;)Ljava/lang/Object;";
 
     private static Log log;
     private final static String prefix = "nsk.jdi.TypeComponent.isSynthetic.";
     private final static String className = "issynthetic002";
-    private final static String debugerName = prefix + className;
-    private final static String debugeeName = debugerName + "a";
+    private final static String debuggerName = prefix + className;
+    private final static String debuggeeName = debuggerName + "a";
     private final static String classToCheckName = prefix + "issynthetic002aClassToCheck";
 
     public static void main(String argv[]) {
@@ -92,38 +53,38 @@
         ArgumentHandler argHandler = new ArgumentHandler(argv);
         log = new Log(out, argHandler);
         Binder binder = new Binder(argHandler, log);
-        Debugee debugee = binder.bindToDebugee(debugeeName
+        Debugee debuggee = binder.bindToDebugee(debuggeeName
                               + (argHandler.verbose() ? " -verbose" : ""));
-        VirtualMachine vm = debugee.VM();
+        VirtualMachine vm = debuggee.VM();
         boolean canGetSynthetic = vm.canGetSyntheticAttribute();
-        IOPipe pipe = new IOPipe(debugee);
+        IOPipe pipe = new IOPipe(debuggee);
         boolean testFailed = false;
         List methods;
         int totalSyntheticMethods = 0;
 
-        log.display("debuger> Value of canGetSyntheticAttribute in current "
+        log.display("debugger> Value of canGetSyntheticAttribute in current "
                   + "VM is " + canGetSynthetic);
 
-        // Connect with debugee and resume it
-        debugee.redirectStderr(out);
-        debugee.resume();
+        // Connect with debuggee and resume it
+        debuggee.redirectStderr(out);
+        debuggee.resume();
         String line = pipe.readln();
         if (line == null) {
-            log.complain("debuger FAILURE> UNEXPECTED debugee's signal - null");
+            log.complain("debugger FAILURE> UNEXPECTED debuggee's signal - null");
             return 2;
         }
         if (!line.equals("ready")) {
-            log.complain("debuger FAILURE> UNEXPECTED debugee's signal - "
+            log.complain("debugger FAILURE> UNEXPECTED debuggee's signal - "
                       + line);
             return 2;
         }
         else {
-            log.display("debuger> debugee's \"ready\" signal recieved.");
+            log.display("debugger> debuggee's \"ready\" signal received.");
         }
 
-        ReferenceType refType = debugee.classByName(classToCheckName);
+        ReferenceType refType = debuggee.classByName(classToCheckName);
         if (refType == null) {
-            log.complain("debuger FAILURE> Class " + classToCheckName
+            log.complain("debugger FAILURE> Class " + classToCheckName
                        + " not found.");
             return 2;
         }
@@ -132,51 +93,50 @@
         try {
             methods = refType.methods();
         } catch (Exception e) {
-            log.complain("debuger FAILURE> Can't get methods from "
+            log.complain("debugger FAILURE> Can't get methods from "
                        + classToCheckName);
-            log.complain("debuger FAILURE> Exception: " + e);
+            log.complain("debugger FAILURE> Exception: " + e);
             return 2;
         }
         int totalMethods = methods.size();
         if (totalMethods < 1) {
-            log.complain("debuger FAILURE> Total number of methods in debuggee "
+            log.complain("debugger FAILURE> Total number of methods in debuggee "
                        + "read " + totalMethods);
             return 2;
         }
-        log.display("debuger> Total methods in debuggee read: "
-                  + totalMethods + " total methods in debuger: "
-                  + METHOD_NAME.length);
+        log.display("debugger> Total methods in debuggee read: "
+                  + totalMethods);
         for (int i = 0; i < totalMethods; i++) {
             Method method = (Method)methods.get(i);
             String name = method.name();
+            String signature = method.signature();
             boolean isSynthetic;
-            boolean isRealSynthetic = true;
 
             try {
                 isSynthetic = method.isSynthetic();
 
                 if (!canGetSynthetic) {
-                    log.complain("debuger FAILURE 1> Value of "
+                    log.complain("debugger FAILURE 1> Value of "
                                + "canGetSyntheticAttribute in current VM is "
                                + "false, so UnsupportedOperationException was "
                                + "expected for " + i + " method " + name);
                     testFailed = true;
                     continue;
                 } else {
-                    log.display("debuger> " + i + " method " + name + " with "
+                    log.display("debugger> " + i + " method " + name + " with "
                               + "synthetic value " + isSynthetic + " read "
                               + "without UnsupportedOperationException");
                 }
             } catch (UnsupportedOperationException e) {
                 if (canGetSynthetic) {
-                    log.complain("debuger FAILURE 2> Value of "
+                    log.complain("debugger FAILURE 2> Value of "
                                + "canGetSyntheticAttribute in current VM is "
                                + "true, but cannot get synthetic for method "
                                + "name.");
-                    log.complain("debuger FAILURE 2> Exception: " + e);
+                    log.complain("debugger FAILURE 2> Exception: " + e);
                     testFailed = true;
                 } else {
-                    log.display("debuger> UnsupportedOperationException was "
+                    log.display("debugger> UnsupportedOperationException was "
                               + "thrown while getting isSynthetic for " + i
                               + " method " + name + " because value "
                               + "canGetSynthetic is false.");
@@ -184,49 +144,39 @@
                 continue;
             }
 
-            // Find out if method exists in list of methods
-            for (int j = 0; j < METHOD_NAME.length; j++) {
-                String nameFromList = METHOD_NAME[j];
-
-                if (nameFromList.equals(name)) {
-                    // Method found in list - is not synthetic
-
-                    isRealSynthetic = false;
-                    break;
-                }
-            }
-
-            if (isRealSynthetic != isSynthetic) {
-                log.complain("debuger FAILURE 3> Method's " + name
-                           + " synthetic is " + isSynthetic + ", but expected "
-                           + "is " + isRealSynthetic);
-                testFailed = true;
-                continue;
-            }
 
             if (isSynthetic) {
-                totalSyntheticMethods++;
+                if (SYNTHETIC_METHOD_NAME.equals(name) && SYNTHETIC_METHOD_SIGNATURE.equals(signature)) {
+                    totalSyntheticMethods++;
+                } else {
+                    testFailed = true;
+                    log.complain("debugger FAILURE 3> Found unexpected synthetic method " + name
+                            + signature);
+                }
             }
         }
 
         if (totalSyntheticMethods == 0) {
-            log.complain("debuger FAILURE 4> Synthetic methods not found.");
+            log.complain("debugger FAILURE 4> Synthetic methods not found.");
+            testFailed = true;
+        } else if (totalSyntheticMethods > 1 ) {
+            log.complain("debugger FAILURE 5> More than one Synthetic method is found.");
             testFailed = true;
         }
 
         pipe.println("quit");
-        debugee.waitFor();
-        int status = debugee.getStatus();
+        debuggee.waitFor();
+        int status = debuggee.getStatus();
         if (testFailed) {
-            log.complain("debuger FAILURE> TEST FAILED");
+            log.complain("debugger FAILURE> TEST FAILED");
             return 2;
         } else {
             if (status == 95) {
-                log.display("debuger> expected Debugee's exit "
+                log.display("debugger> expected Debuggee's exit "
                           + "status - " + status);
                 return 0;
             } else {
-                log.complain("debuger FAILURE> UNEXPECTED Debugee's exit "
+                log.complain("debugger FAILURE> UNEXPECTED Debuggee's exit "
                            + "status (not 95) - " + status);
                 return 2;
             }
--- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002a.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/TypeComponent/isSynthetic/issynthetic002a.java	Fri Jun 08 09:40:28 2018 -0700
@@ -51,7 +51,11 @@
     }
 }
 
-class issynthetic002aClassToCheck {
+interface issynthetic002aClassToCheckIntf<T> {
+    T test(T t);
+}
+
+class issynthetic002aClassToCheck implements issynthetic002aClassToCheckIntf<String> {
     // Not-synthetic methods
 
     // User class and interface
@@ -178,26 +182,13 @@
     private      Inter[]   MEP1(Inter[] E)   { return E; };
     private      Inter[][] MEP2(Inter[][] E) { return E; };
 
-    // Synthetic methods
-
-    private int i;
-    private String s;
-
-    class NestedClass {
-        boolean MS(String str) {
-            // Method uses private variable s from ClassToCheck,
-            // so two synthetic methods must appear in ClassToCheck
 
-            s = s + "NestedClass";
-            return s.equals(str);
-        };
+   // The implementation of the parametrized interface issynthetic002aClassToCheckIntf
+   // triggers the compiler to create the synthetic bridge method
+   // "test(Ljava/lang/Object;)Ljava/lang/Object;".
+    public String test(String s) {
+        return s;
+    }
 
-        boolean Mi(int j) {
-            // Method uses private variable i from ClassToCheck,
-            // so two synthetic methods must appear in ClassToCheck
 
-            i = i + 1;
-            return (i == j);
-        };
-    }
 }
--- a/test/jdk/ProblemList-graal.txt	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/ProblemList-graal.txt	Fri Jun 08 09:40:28 2018 -0700
@@ -68,3 +68,9 @@
 java/lang/ref/OOMEInReferenceHandler.java                               8196611   generic-all
 java/lang/Runtime/exec/LotsOfOutput.java                                8196611   generic-all
 java/util/concurrent/ScheduledThreadPoolExecutor/BasicCancelTest.java   8196611   generic-all
+
+# Next JFR tests fail with Graal. Assuming 8193210.
+jdk/jfr/event/compiler/TestCodeSweeper.java              8193210   generic-all
+jdk/jfr/event/compiler/TestCompilerInlining.java         8193210   generic-all
+jdk/jfr/event/compiler/TestCompilerPhase.java            8193210   generic-all
+
--- a/test/jdk/ProblemList.txt	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/ProblemList.txt	Fri Jun 08 09:40:28 2018 -0700
@@ -545,7 +545,6 @@
 
 com/sun/management/OperatingSystemMXBean/GetProcessCpuLoad.java 8030957 aix-all
 com/sun/management/OperatingSystemMXBean/GetSystemCpuLoad.java  8030957 aix-all
-sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java    8174734 generic-all
 
 ############################################################################
 
@@ -823,6 +822,8 @@
 
 # core_tools
 
+tools/launcher/SourceMode.java                                  8204588 linux-all,macosx-all
+
 tools/pack200/CommandLineTests.java                             8059906 generic-all
 
 tools/jimage/JImageExtractTest.java                             8198405,8198819 generic-all
--- a/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/com/sun/management/HotSpotDiagnosticMXBean/CheckOrigin.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
  * @test
  * @bug 8028994
  * @author Staffan Larsen
+ * @comment Graal does not support CMS
+ * @requires !vm.graal.enabled
  * @library /lib/testlibrary
  * @modules jdk.attach/sun.tools.attach
  *          jdk.management
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/lang/String/concat/ImplicitStringConcatAssignLHS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary "+=" applied to String operands can provoke side effects
+ * @bug 8204322
+ *
+ * @compile ImplicitStringConcatAssignLHS.java
+ * @run main/othervm -Xverify:all ImplicitStringConcatAssignLHS
+ *
+ * @compile -XDstringConcat=inline ImplicitStringConcatAssignLHS.java
+ * @run main/othervm -Xverify:all ImplicitStringConcatAssignLHS
+ *
+ * @compile -XDstringConcat=indy ImplicitStringConcatAssignLHS.java
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                                                              ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                                                        ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                                                        ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT                                                  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT                                                  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT                                              ImplicitStringConcatAssignLHS
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                  -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                                                              -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                                                        -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                                                        -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT                                                  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT                                                  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT                                              -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                  -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ *
+ * @compile -XDstringConcat=indyWithConstants ImplicitStringConcatAssignLHS.java
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                                                              ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                                                        ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                                                        ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT                                                  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT                                                  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT                                              ImplicitStringConcatAssignLHS
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                  -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  -Djava.lang.invoke.stringConcat.debug=true  ImplicitStringConcatAssignLHS
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                                                              -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED                                                        -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED                                                        -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT                                                  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT                                                  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT                                              -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ *
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB                  -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED            -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=BC_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_SB_SIZED_EXACT      -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+ * @run main/othervm -Xverify:all -Djava.lang.invoke.stringConcat=MH_INLINE_SIZED_EXACT  -Djava.lang.invoke.stringConcat.debug=true  -Djava.lang.invoke.stringConcat.cache=true  ImplicitStringConcatAssignLHS
+*/
+import java.lang.StringBuilder;
+
+public class ImplicitStringConcatAssignLHS {
+
+    static final int ARR_SIZE = 10; // enough padding to capture ill offsets
+
+    static int x;
+
+    public static void main(String[] args) throws Exception {
+        {
+          x = 0;
+            Object[] arr = new Object[ARR_SIZE];
+            arr[x++] += "foo";
+            check(1, "plain-plain Object[]");
+        }
+
+        {
+          x = 0;
+            getObjArray()[x++] += "foo";
+            check(2, "method-plain Object[]");
+        }
+
+        {
+          x = 0;
+            getObjArray()[getIndex()] += "foo";
+            check(2, "method-method Object[]");
+        }
+
+        {
+            x = 0;
+            String[] arr = new String[ARR_SIZE];
+            arr[x++] += "foo";
+            check(1, "plain-plain String[]");
+    }
+
+        {
+            x = 0;
+            getStringArray()[x++] += "foo";
+            check(2, "method-plain String[]");
+        }
+
+        {
+            x = 0;
+            getStringArray()[getIndex()] += "foo";
+            check(2, "method-method String[]");
+        }
+
+        {
+            x = 0;
+            CharSequence[] arr = new CharSequence[ARR_SIZE];
+            arr[x++] += "foo";
+            check(1, "plain-plain CharSequence[]");
+        }
+
+        {
+            x = 0;
+            getCharSequenceArray()[x++] += "foo";
+            check(2, "method-plain CharSequence[]");
+        }
+
+        {
+            x = 0;
+            getCharSequenceArray()[getIndex()] += "foo";
+            check(2, "method-method CharSequence[]");
+        }
+
+        {
+            x = 0;
+            new MyClass().s += "foo";
+            check(1, "MyClass::new (String)");
+        }
+
+        {
+            x = 0;
+            getMyClass().s += "foo";
+            check(1, "method MyClass::new (String)");
+        }
+
+        {
+            x = 0;
+            new MyClass().o += "foo";
+            check(1, "MyClass::new (object)");
+        }
+
+        {
+            x = 0;
+            getMyClass().o += "foo";
+            check(1, "method MyClass::new (object)");
+        }
+    }
+
+    public static void check(int expected, String label) {
+        if (x != expected) {
+           StringBuilder sb = new StringBuilder();
+           sb.append(label);
+           sb.append(": ");
+           sb.append("Expected = ");
+           sb.append(expected);
+           sb.append("actual = ");
+           sb.append(x);
+           throw new IllegalStateException(sb.toString());
+        }
+    }
+
+    public static int getIndex() {
+       return x++;
+    }
+
+    public static class MyClass {
+        Object o;
+        String s;
+
+        public MyClass() {
+       x++;
+        }
+    }
+
+    public static MyClass getMyClass() {
+        return new MyClass();
+}
+
+    public static Object[] getObjArray() {
+        x++;
+        return new Object[ARR_SIZE];
+    }
+
+    public static String[] getStringArray() {
+        x++;
+        return new String[ARR_SIZE];
+    }
+
+    public static CharSequence[] getCharSequenceArray() {
+        x++;
+        return new String[ARR_SIZE];
+    }
+
+}
+
--- a/test/jdk/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/lang/management/MemoryMXBean/CollectionUsageThreshold.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,11 +30,13 @@
  *
  * @author  Mandy Chung
  *
- * @library /lib/testlibrary/
+ * @library /lib/testlibrary/ /test/lib
  * @modules jdk.management
  * @build jdk.testlibrary.* CollectionUsageThreshold MemoryUtil RunUtil
  * @requires vm.opt.ExplicitGCInvokesConcurrent == "false" | vm.opt.ExplicitGCInvokesConcurrent == "null"
- * @run main/timeout=300 CollectionUsageThreshold
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/timeout=300 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. CollectionUsageThreshold
  */
 
 import java.util.*;
@@ -46,6 +48,8 @@
 import static java.lang.management.MemoryNotificationInfo.*;;
 import static java.lang.management.ManagementFactory.*;
 
+import sun.hotspot.code.Compiler;
+
 public class CollectionUsageThreshold {
     private static final MemoryMXBean mm = getMemoryMXBean();
     private static final Map<String, PoolRecord> result = new HashMap<>();
@@ -72,7 +76,9 @@
         RunUtil.runTestClearGcOpts(main, "-XX:+UseSerialGC");
         RunUtil.runTestClearGcOpts(main, "-XX:+UseParallelGC");
         RunUtil.runTestClearGcOpts(main, "-XX:+UseG1GC");
-        RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
+        if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+            RunUtil.runTestClearGcOpts(main, "-XX:+UseConcMarkSweepGC");
+        }
     }
 
     static class PoolRecord {
--- a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,10 +32,12 @@
  * @requires vm.gc == "null"
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
- * @library /lib/testlibrary/
+ * @library /lib/testlibrary/ /test/lib
  *
  * @build jdk.testlibrary.* LowMemoryTest MemoryUtil RunUtil
- * @run main/timeout=600 LowMemoryTest
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/timeout=600 -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LowMemoryTest
  */
 
 import java.lang.management.*;
@@ -47,6 +49,8 @@
 import jdk.testlibrary.JDKToolFinder;
 import jdk.testlibrary.Utils;
 
+import sun.hotspot.code.Compiler;
+
 public class LowMemoryTest {
     private static final MemoryMXBean mm = ManagementFactory.getMemoryMXBean();
     private static final List<MemoryPoolMXBean> pools = ManagementFactory.getMemoryPoolMXBeans();
@@ -80,7 +84,9 @@
         traceTest(classMain + ", -XX:+UseSerialGC", nmFlag, lpFlag, "-XX:+UseSerialGC");
         traceTest(classMain + ", -XX:+UseParallelGC", nmFlag, lpFlag, "-XX:+UseParallelGC");
         traceTest(classMain + ", -XX:+UseG1GC", nmFlag, lpFlag, "-XX:+UseG1GC", g1Flag);
-        traceTest(classMain + ", -XX:+UseConcMarkSweepGC", nmFlag, lpFlag, "-XX:+UseConcMarkSweepGC");
+        if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+            traceTest(classMain + ", -XX:+UseConcMarkSweepGC", nmFlag, lpFlag, "-XX:+UseConcMarkSweepGC");
+        }
     }
 
     /*
--- a/test/jdk/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,7 +27,7 @@
 # @summary Run MemoryManagement test with concurrent mark sweep GC
 # @author  Mandy Chung
 #
-# @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
+# @requires (vm.gc=="ConcMarkSweep" | vm.gc=="null") & !vm.graal.enabled
 #
 # @run build MemoryManagement
 # @run shell/timeout=600 MemoryManagementConcMarkSweepGC.sh
--- a/test/jdk/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/lang/management/MemoryMXBean/ResetPeakMemoryUsage.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,17 +34,21 @@
  *
  * @requires vm.opt.ExplicitGCInvokesConcurrent != "true"
  * @requires vm.opt.DisableExplicitGC != "true"
- * @library /lib/testlibrary/
+ * @library /lib/testlibrary/ /test/lib
  * @modules jdk.management
  *
  * @build jdk.testlibrary.* ResetPeakMemoryUsage MemoryUtil RunUtil
- * @run main ResetPeakMemoryUsage
+ * @build sun.hotspot.WhiteBox
+ * @run driver ClassFileInstaller sun.hotspot.WhiteBox sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. ResetPeakMemoryUsage
  */
 
 import java.lang.management.*;
 import java.lang.ref.WeakReference;
 import java.util.*;
 
+import sun.hotspot.code.Compiler;
+
 public class ResetPeakMemoryUsage {
     private static MemoryMXBean mbean = ManagementFactory.getMemoryMXBean();
     // make public so that it can't be optimized away easily
@@ -59,7 +63,9 @@
         final String main = "ResetPeakMemoryUsage$TestMain";
         final String ms = "-Xms256m";
         final String mn = "-Xmn8m";
-        RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseConcMarkSweepGC");
+        if (!Compiler.isGraalEnabled()) { // Graal does not support CMS
+            RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseConcMarkSweepGC");
+        }
         RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseParallelGC");
         RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseG1GC", "-XX:G1HeapRegionSize=1m");
         RunUtil.runTestClearGcOpts(main, ms, mn, "-XX:+UseSerialGC",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/Socket/ReadAfterReset.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @requires (os.family == "linux" | os.family == "mac")
+ * @bug 8203937
+ * @summary Test reading bytes from a socket after the connection has been
+ *          reset by the peer
+ */
+
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+
+/**
+ * This test exercises platform specific and unspecified behavior. It exists
+ * only to ensure that the behavior doesn't change between JDK releases.
+ */
+
+public class ReadAfterReset {
+    private static final PrintStream out = System.out;
+
+    // number of bytes to write before the connection reset
+    private static final int NUM_BYTES_TO_WRITE = 1000;
+
+    public static void main(String[] args) throws IOException {
+        try (ServerSocket ss = new ServerSocket()) {
+            ss.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0));
+
+            /**
+             * Connect to the server which will write some bytes and reset the
+             * connection. The client then attempts to read the bytes sent by
+             * the server before it closed the connection.
+             */
+            out.println("Test connection ...");
+            try (Socket s = new Socket()) {
+                s.connect(ss.getLocalSocketAddress());
+                int nwrote = acceptAndResetConnection(ss);
+                int nread = readUntilIOException(s);
+                if (nread != nwrote) {
+                    throw new RuntimeException("Client read " + nread + ", expected " + nwrote);
+                }
+            }
+
+            /**
+             * Connect to the server which will write some bytes and reset the
+             * connection. The client then writes to its end of the connection,
+             * failing as the connection is reset. It then attempts to read the
+             * bytes sent by the server before it closed the connection.
+             */
+            out.println();
+            out.println("Test connection ...");
+            try (Socket s = new Socket()) {
+                s.connect(ss.getLocalSocketAddress());
+                int nwrote = acceptAndResetConnection(ss);
+                writeUntilIOException(s);
+                int nread = readUntilIOException(s);
+                if (nread != nwrote) {
+                    throw new RuntimeException("Client read " + nread + ", expected " + nwrote);
+                }
+            }
+        }
+    }
+
+    /**
+     * Accept a connection, write bytes, and then reset the connection
+     */
+    static int acceptAndResetConnection(ServerSocket ss) throws IOException {
+        int count = NUM_BYTES_TO_WRITE;
+        try (Socket peer = ss.accept()) {
+            peer.getOutputStream().write(new byte[count]);
+            peer.setSoLinger(true, 0);
+            out.format("Server wrote %d bytes and reset connection%n", count);
+        }
+        return count;
+    }
+
+    /**
+     * Write bytes to a socket until I/O exception is thrown
+     */
+    static void writeUntilIOException(Socket s) {
+        try {
+            byte[] bytes = new byte[100];
+            while (true) {
+                s.getOutputStream().write(bytes);
+                out.format("Client wrote %d bytes%n", bytes.length);
+            }
+        } catch (IOException ioe) {
+            out.format("Client write failed: %s (expected)%n", ioe);
+        }
+    }
+
+    /**
+     * Read bytes from a socket until I/O exception is thrown.
+     *
+     * @return the number of bytes read before the I/O exception was thrown
+     */
+    static int readUntilIOException(Socket s) {
+        int nread = 0;
+        try {
+            byte[] bytes = new byte[100];
+            while (true) {
+                int n = s.getInputStream().read(bytes);
+                if (n < 0) {
+                    out.println("Client read EOF");
+                    break;
+                } else {
+                    out.format("Client read %s bytes%n", n);
+                    nread += n;
+                }
+            }
+        } catch (IOException ioe) {
+            out.format("Client read failed: %s (expected)%n", ioe);
+        }
+        return nread;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/nio/channels/SelectionKey/AtomicUpdates.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+ * @bug 6350055
+ * @run testng AtomicUpdates
+ * @summary Unit test for SelectionKey interestOpsOr and interestOpsAnd
+ */
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.nio.channels.CancelledKeyException;
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+import org.testng.annotations.Test;
+
+import static java.nio.channels.SelectionKey.OP_READ;
+import static java.nio.channels.SelectionKey.OP_WRITE;
+import static java.nio.channels.SelectionKey.OP_CONNECT;
+import static java.nio.channels.SelectionKey.OP_ACCEPT;
+import static org.testng.Assert.*;
+
+@Test
+public class AtomicUpdates {
+
+    private SelectionKey keyFor(SocketChannel sc) {
+        return new SelectionKey() {
+            private int ops;
+            private boolean invalid;
+            private void ensureValid() {
+                if (!isValid())
+                    throw new CancelledKeyException();
+            }
+            @Override
+            public SelectableChannel channel() {
+                return sc;
+            }
+            @Override
+            public Selector selector() {
+                throw new RuntimeException();
+            }
+            @Override
+            public boolean isValid() {
+                return !invalid;
+            }
+            @Override
+            public void cancel() {
+                invalid = true;
+            }
+            @Override
+            public int interestOps() {
+                ensureValid();
+                return ops;
+            }
+            @Override
+            public SelectionKey interestOps(int ops) {
+                ensureValid();
+                if ((ops & ~channel().validOps()) != 0)
+                    throw new IllegalArgumentException();
+                this.ops = ops;
+                return this;
+            }
+            @Override
+            public int readyOps() {
+                ensureValid();
+                return 0;
+            }
+        };
+    }
+
+    private void test(SelectionKey key) {
+        assertTrue(key.channel() instanceof SocketChannel);
+        key.interestOps(0);
+
+        // 0 -> 0
+        int previous = key.interestOpsOr(0);
+        assertTrue(previous == 0);
+        assertTrue(key.interestOps() == 0);
+
+        // 0 -> OP_CONNECT
+        previous = key.interestOpsOr(OP_CONNECT);
+        assertTrue(previous == 0);
+        assertTrue(key.interestOps() == OP_CONNECT);
+
+        // OP_CONNECT -> OP_CONNECT
+        previous = key.interestOpsOr(0);
+        assertTrue(previous == OP_CONNECT);
+        assertTrue(key.interestOps() == OP_CONNECT);
+
+        // OP_CONNECT -> OP_CONNECT | OP_READ | OP_WRITE
+        previous = key.interestOpsOr(OP_READ | OP_WRITE);
+        assertTrue(previous == OP_CONNECT);
+        assertTrue(key.interestOps() == (OP_CONNECT | OP_READ | OP_WRITE));
+
+        // OP_CONNECT | OP_READ | OP_WRITE -> OP_CONNECT
+        previous = key.interestOpsAnd(~(OP_READ | OP_WRITE));
+        assertTrue(previous == (OP_CONNECT | OP_READ | OP_WRITE));
+        assertTrue(key.interestOps() == OP_CONNECT);
+
+        // OP_CONNECT -> 0
+        previous = key.interestOpsAnd(~OP_CONNECT);
+        assertTrue(previous == OP_CONNECT);
+        assertTrue(key.interestOps() == 0);
+
+        // OP_READ | OP_WRITE -> OP_READ | OP_WRITE
+        key.interestOps(OP_READ | OP_WRITE);
+        previous = key.interestOpsAnd(~OP_ACCEPT);
+        assertTrue(previous == (OP_READ | OP_WRITE));
+        assertTrue(key.interestOps() == (OP_READ | OP_WRITE));
+
+        // OP_READ | OP_WRITE -> 0
+        previous = key.interestOpsAnd(0);
+        assertTrue(previous == (OP_READ | OP_WRITE));
+        assertTrue(key.interestOps() == 0);
+
+        // 0 -> 0
+        previous = key.interestOpsAnd(0);
+        assertTrue(previous == 0);
+        assertTrue(key.interestOps() == 0);
+
+        try {
+            key.interestOpsOr(OP_ACCEPT);
+            fail("IllegalArgumentException expected");
+        } catch (IllegalArgumentException expected) { }
+
+        key.cancel();
+        try {
+            key.interestOpsOr(OP_READ);
+            fail("CancelledKeyException expected");
+        } catch (CancelledKeyException expected) { }
+        try {
+            key.interestOpsAnd(~OP_READ);
+            fail("CancelledKeyException expected");
+        } catch (CancelledKeyException expected) { }
+    }
+
+    /**
+     * Test default implementation of interestOpsOr/interestOpsAnd
+     */
+    public void testDefaultImplementation() throws Exception {
+        try (SocketChannel sc = SocketChannel.open()) {
+            SelectionKey key = keyFor(sc);
+            test(key);
+        }
+    }
+
+    /**
+     * Test the default provider implementation of SelectionKey.
+     */
+    public void testNioImplementation() throws Exception {
+        try (SocketChannel sc = SocketChannel.open();
+             Selector sel = Selector.open()) {
+            sc.configureBlocking(false);
+            SelectionKey key = sc.register(sel, 0);
+            test(key);
+        }
+    }
+}
+
--- a/test/jdk/java/nio/file/Files/CopyAndMove.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/nio/file/Files/CopyAndMove.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,24 +22,25 @@
  */
 
 /* @test
- * @bug 4313887 6838333 6917021 7006126 6950237 8006645
+ * @bug 4313887 6838333 6917021 7006126 6950237 8006645 8201407
  * @summary Unit test for java.nio.file.Files copy and move methods (use -Dseed=X to set PRNG seed)
  * @library .. /test/lib
- * @build jdk.test.lib.RandomFactory
+ * @build jdk.test.lib.Platform jdk.test.lib.RandomFactory
  *        CopyAndMove PassThroughFileSystem
  * @run main/othervm CopyAndMove
  * @key randomness
  */
 
+import java.io.*;
 import java.nio.ByteBuffer;
 import java.nio.file.*;
 import static java.nio.file.Files.*;
 import static java.nio.file.StandardCopyOption.*;
 import static java.nio.file.LinkOption.*;
 import java.nio.file.attribute.*;
-import java.io.*;
 import java.util.*;
 import java.util.concurrent.TimeUnit;
+import jdk.test.lib.Platform;
 import jdk.test.lib.RandomFactory;
 
 public class CopyAndMove {
@@ -169,8 +170,7 @@
         Map<String,ByteBuffer> namedAttributes = null;
 
         // get file attributes of source file
-        String os = System.getProperty("os.name");
-        if (os.startsWith("Windows")) {
+        if (Platform.isWindows()) {
             dosAttributes = readAttributes(source, DosFileAttributes.class, NOFOLLOW_LINKS);
             basicAttributes = dosAttributes;
         } else {
@@ -448,6 +448,10 @@
                 moveAndVerify(source, target);
                 throw new RuntimeException("IOException expected");
             } catch (IOException x) {
+                if (!(x instanceof DirectoryNotEmptyException)) {
+                    throw new RuntimeException
+                        ("DirectoryNotEmptyException expected", x);
+                }
             }
             delete(source.resolve("foo"));
             delete(source);
@@ -653,17 +657,14 @@
             if (source.getFileSystem().provider() == target.getFileSystem().provider()) {
 
                 // check POSIX attributes are copied
-                String os = System.getProperty("os.name");
-                if ((os.equals("SunOS") || os.equals("Linux")) &&
-                    testPosixAttributes)
-                {
+                if (!Platform.isWindows() && testPosixAttributes) {
                     checkPosixAttributes(
                         readAttributes(source, PosixFileAttributes.class, linkOptions),
                         readAttributes(target, PosixFileAttributes.class, linkOptions));
                 }
 
                 // check DOS attributes are copied
-                if (os.startsWith("Windows")) {
+                if (Platform.isWindows()) {
                     checkDosAttributes(
                         readAttributes(source, DosFileAttributes.class, linkOptions),
                         readAttributes(target, DosFileAttributes.class, linkOptions));
@@ -921,9 +922,7 @@
         /**
          * Test: Copy link to UNC (Windows only)
          */
-        if (supportsLinks &&
-            System.getProperty("os.name").startsWith("Windows"))
-        {
+        if (supportsLinks && Platform.isWindows()) {
             Path unc = Paths.get("\\\\rialto\\share\\file");
             link = dir1.resolve("link");
             createSymbolicLink(link, unc);
@@ -1156,12 +1155,14 @@
 
     // "randomize" the file attributes of the given file.
     static void randomizeAttributes(Path file) throws IOException {
-        String os = System.getProperty("os.name");
-        boolean isWindows = os.startsWith("Windows");
-        boolean isUnix = os.equals("SunOS") || os.equals("Linux");
         boolean isDirectory = isDirectory(file, NOFOLLOW_LINKS);
 
-        if (isUnix) {
+        if (Platform.isWindows()) {
+            DosFileAttributeView view =
+                getFileAttributeView(file, DosFileAttributeView.class, NOFOLLOW_LINKS);
+            // only set or unset the hidden attribute
+            view.setHidden(heads());
+        } else {
             Set<PosixFilePermission> perms =
                 getPosixFilePermissions(file, NOFOLLOW_LINKS);
             PosixFilePermission[] toChange = {
@@ -1182,18 +1183,12 @@
             setPosixFilePermissions(file, perms);
         }
 
-        if (isWindows) {
-            DosFileAttributeView view =
-                getFileAttributeView(file, DosFileAttributeView.class, NOFOLLOW_LINKS);
-            // only set or unset the hidden attribute
-            view.setHidden(heads());
-        }
-
         boolean addUserDefinedFileAttributes = heads() &&
             getFileStore(file).supportsFileAttributeView("xattr");
 
         // remove this when copying a direcory copies its named streams
-        if (isWindows && isDirectory) addUserDefinedFileAttributes = false;
+        if (Platform.isWindows() && isDirectory)
+            addUserDefinedFileAttributes = false;
 
         if (addUserDefinedFileAttributes) {
             UserDefinedFileAttributeView view =
--- a/test/jdk/java/util/Currency/ValidateISO4217.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/util/Currency/ValidateISO4217.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 /*
  * @test
  * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759
- *      8039317 8074350 8074351 8145952 8187946
+ *      8039317 8074350 8074351 8145952 8187946 8193552 8202026 8204269
  * @summary Validate ISO 4217 data for Currency class.
  * @modules java.base/java.util:open
  *          jdk.localedata
@@ -96,7 +96,7 @@
     /* Codes that are obsolete, do not have related country */
     static final String otherCodes =
         "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-"
-        + "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LUF-MGF-MTL-MXV-MZM-NLG-"
+        + "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-"
         + "PTE-ROL-RUR-SDD-SIT-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-"
         + "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-"
         + "YUM-ZMK-ZWD-ZWN-ZWR";
--- a/test/jdk/java/util/Currency/tablea1.txt	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/util/Currency/tablea1.txt	Fri Jun 08 09:40:28 2018 -0700
@@ -1,12 +1,12 @@
 #
 #
-# Amendments up until ISO 4217 AMENDMENT NUMBER 164
-#   (As of 22 September 2017)
+# Amendments up until ISO 4217 AMENDMENT NUMBER 167
+#   (As of 4 June 2018)
 #
 
 # Version
 FILEVERSION=3
-DATAVERSION=164
+DATAVERSION=167
 
 # ISO 4217 currency data
 AF	AFN	971	2
@@ -135,14 +135,14 @@
 KW	KWD	414	3
 KG	KGS	417	2
 LA	LAK	418	2
-LV	LVL	428	2	2013-12-31-22-00-00	EUR	978	2
+LV	EUR	978	2
 LB	LBP	422	2
 #LS	ZAR	710	2
 LS	LSL	426	2
 LR	LRD	430	2
 LY	LYD	434	3
 LI	CHF	756	2
-LT	LTL	440	2	2014-12-31-22-00-00	EUR	978	2
+LT	EUR	978	2
 LU	EUR	978	2
 MO	MOP	446	2
 MK	MKD	807	2
@@ -154,7 +154,7 @@
 MT	EUR	978	2
 MH	USD	840	2
 MQ	EUR	978	2
-MR	MRO	478	2
+MR	MRU	929	2
 MU	MUR	480	2
 YT	EUR	978	2
 MX	MXN	484	2
--- a/test/jdk/java/util/Locale/Bug8040211.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/util/Locale/Bug8040211.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 8040211 8191404
- * @summary Checks the IANA language subtag registry data updation
- *          (LSR Revision: 2017-08-15) with Locale and Locale.LanguageRange
+ * @bug 8040211 8191404 8203872
+ * @summary Checks the IANA language subtag registry data update
+ *          (LSR Revision: 2018-04-23) with Locale and Locale.LanguageRange
  *          class methods.
  * @run main Bug8040211
  */
@@ -67,8 +67,8 @@
     private static void test_parse() {
         boolean error = false;
         String str = "Accept-Language: aam, adp, aue, bcg, cqu, ema,"
-                + " en-gb-oed, gti, koj, kwq, kxe, lii, lmm, mtm, ngv,"
-                + " oyb, phr, pub, suj, taj;q=0.9, yug;q=0.5, gfx;q=0.4";
+                + " en-gb-oed, gti, kdz, koj, kwq, kxe, lii, lmm, mtm, ngv,"
+                + " oyb, phr, pub, suj, taj;q=0.9, ar-hyw;q=0.8, yug;q=0.5, gfx;q=0.4";
         ArrayList<LanguageRange> expected = new ArrayList<>();
         expected.add(new LanguageRange("aam", 1.0));
         expected.add(new LanguageRange("aas", 1.0));
@@ -86,6 +86,8 @@
         expected.add(new LanguageRange("en-gb-oxendict", 1.0));
         expected.add(new LanguageRange("gti", 1.0));
         expected.add(new LanguageRange("nyc", 1.0));
+        expected.add(new LanguageRange("kdz", 1.0));
+        expected.add(new LanguageRange("ncp", 1.0));
         expected.add(new LanguageRange("koj", 1.0));
         expected.add(new LanguageRange("kwv", 1.0));
         expected.add(new LanguageRange("kwq", 1.0));
@@ -112,6 +114,8 @@
         expected.add(new LanguageRange("xsj", 1.0));
         expected.add(new LanguageRange("taj", 0.9));
         expected.add(new LanguageRange("tsf", 0.9));
+        expected.add(new LanguageRange("ar-hyw", 0.8));
+        expected.add(new LanguageRange("ar-arevmda", 0.8));
         expected.add(new LanguageRange("yug", 0.5));
         expected.add(new LanguageRange("yuu", 0.5));
         expected.add(new LanguageRange("gfx", 0.4));
@@ -176,15 +180,15 @@
     private static void test_filter() {
         boolean error = false;
 
-        String ranges = "mtm-RU, en-gb-oed, coy";
-        String tags = "de-DE, en, mtm-RU, ymt-RU, en-gb-oxendict, ja-JP, pij, nts";
+        String ranges = "mtm-RU, en-gb-oed, coy, ar-HY";
+        String tags = "de-DE, en, mtm-RU, ymt-RU, en-gb-oxendict, ja-JP, pij, nts, ar-arevela";
         FilteringMode mode = EXTENDED_FILTERING;
 
         List<LanguageRange> priorityList = LanguageRange.parse(ranges);
         List<Locale> tagList = generateLocales(tags);
         String actualLocales
                 = showLocales(Locale.filter(priorityList, tagList, mode));
-        String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij";
+        String expectedLocales = "mtm-RU, ymt-RU, en-GB-oxendict, nts, pij, ar-arevela";
 
         if (!expectedLocales.equals(actualLocales)) {
             error = true;
--- a/test/jdk/java/util/zip/ZipFile/TestCleaner.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/java/util/zip/ZipFile/TestCleaner.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,8 +22,8 @@
  */
 
 /* @test
- * @bug 8185582
- * @modules java.base/java.util.zip:open
+ * @bug 8185582 8197989
+ * @modules java.base/java.util.zip:open java.base/jdk.internal.vm.annotation
  * @summary Check the resources of Inflater, Deflater and ZipFile are always
  *          cleaned/released when the instance is not unreachable
  */
@@ -34,6 +34,7 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.zip.*;
+import jdk.internal.vm.annotation.DontInline;
 import static java.nio.charset.StandardCharsets.US_ASCII;
 
 public class TestCleaner {
@@ -163,10 +164,8 @@
         }
     }
 
-    private static void testZipFile() throws Throwable {
-        File dir = new File(System.getProperty("test.dir", "."));
-        File zip = File.createTempFile("testzf", "zip", dir);
-        Object zsrc = null;
+    @DontInline
+    private static Object openAndCloseZipFile(File zip) throws Throwable {
         try {
             try (var fos = new FileOutputStream(zip);
                  var zos = new ZipOutputStream(fos)) {
@@ -193,12 +192,39 @@
             if (!fieldZsrc.trySetAccessible()) {
                 throw new RuntimeException("'ZipFile.zsrc' is not accesible");
             }
-            zsrc = fieldZsrc.get(zfRes);
-
+            return fieldZsrc.get(zfRes);
         } finally {
             zip.delete();
         }
+    }
 
+    @DontInline
+    private static void openAndCloseSubZipFile(File zip, CountDownLatch closeCountDown)
+        throws Throwable {
+        try {
+            try (var fos = new FileOutputStream(zip);
+                 var zos = new ZipOutputStream(fos)) {
+                zos.putNextEntry(new ZipEntry("hello"));
+                zos.write("hello".getBytes(US_ASCII));
+                zos.closeEntry();
+            }
+            var zf = new SubclassedZipFile(zip, closeCountDown);
+            var es = zf.entries();
+            while (es.hasMoreElements()) {
+                zf.getInputStream(es.nextElement()).read();
+            }
+            es = null;
+            zf = null;
+        } finally {
+            zip.delete();
+        }
+    }
+
+    private static void testZipFile() throws Throwable {
+        File dir = new File(System.getProperty("test.dir", "."));
+        File zip = File.createTempFile("testzf", "zip", dir);
+
+        Object zsrc = openAndCloseZipFile(zip);
         if (zsrc != null) {
             Field zfileField = zsrc.getClass().getDeclaredField("zfile");
             if (!zfileField.trySetAccessible()) {
@@ -219,23 +245,7 @@
         // test subclassed ZipFile, for behavioral compatibility.
         // should be removed if the finalize() method is finally removed.
         var closeCountDown = new CountDownLatch(1);
-        try {
-            try (var fos = new FileOutputStream(zip);
-                 var zos = new ZipOutputStream(fos)) {
-                zos.putNextEntry(new ZipEntry("hello"));
-                zos.write("hello".getBytes(US_ASCII));
-                zos.closeEntry();
-            }
-            var zf = new SubclassedZipFile(zip, closeCountDown);
-            var es = zf.entries();
-            while (es.hasMoreElements()) {
-                zf.getInputStream(es.nextElement()).read();
-            }
-            es = null;
-            zf = null;
-        } finally {
-            zip.delete();
-        }
+        openAndCloseSubZipFile(zip, closeCountDown);
         while (!closeCountDown.await(10, TimeUnit.MILLISECONDS)) {
             System.gc();
         }
--- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithCMSConcurrent.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithCMSConcurrent.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 /*
  * @test
  * @key jfr
- * @requires vm.gc == "ConcMarkSweep" | vm.gc == null
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  * @requires vm.opt.ExplicitGCInvokesConcurrent != false
  * @library /test/lib /test/jdk
  * @run driver jdk.jfr.event.gc.collection.TestGCCauseWithCMSConcurrent
--- a/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithCMSMarkSweep.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCCauseWithCMSMarkSweep.java	Fri Jun 08 09:40:28 2018 -0700
@@ -30,7 +30,7 @@
  * @test
  * @key jfr
  *
- * @requires vm.gc == "ConcMarkSweep" | vm.gc == null
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  * @requires vm.opt.ExplicitGCInvokesConcurrent != true
  * @library /test/lib /test/jdk
  * @run driver jdk.jfr.event.gc.collection.TestGCCauseWithCMSMarkSweep
--- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithCMSConcurrent.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithCMSConcurrent.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
  * @test
  * @key jfr
  *
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != false
  * @library /test/lib /test/jdk
  *
--- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithCMSMarkSweep.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithCMSMarkSweep.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
  * @test
  * @key jfr
  *
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != true
  * @library /test/lib /test/jdk
  *
--- a/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParNew.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestGCEventMixedWithParNew.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
  * @test
  * @key jfr
  *
- * @requires vm.gc == "ConcMarkSweep" | vm.gc == null
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -Xmx32m -Xmn8m -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseConcMarkSweepGC jdk.jfr.event.gc.collection.TestGCEventMixedWithParNew
  * good debug flags: -Xlog:gc*=debug
--- a/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParNew.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/collection/TestYoungGarbageCollectionEventWithParNew.java	Fri Jun 08 09:40:28 2018 -0700
@@ -28,7 +28,7 @@
 /*
  * @test
  * @key jfr
- * @requires vm.gc == "ConcMarkSweep" | vm.gc == null
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -Xmx50m -Xmn2m -XX:+UseConcMarkSweepGC -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc+heap=trace,gc*=debug jdk.jfr.event.gc.collection.TestYoungGarbageCollectionEventWithParNew
  */
--- a/test/jdk/jdk/jfr/event/gc/detailed/TestCMSConcurrentModeFailureEvent.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/detailed/TestCMSConcurrentModeFailureEvent.java	Fri Jun 08 09:40:28 2018 -0700
@@ -42,7 +42,7 @@
  * @test
  * @key jfr
  *
- * @requires vm.gc == "ConcMarkSweep" | vm.gc == null
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  * @library /test/lib /test/jdk
  *
  * @run main jdk.jfr.event.gc.detailed.TestCMSConcurrentModeFailureEvent
--- a/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParNew.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/detailed/TestPromotionFailedEventWithParNew.java	Fri Jun 08 09:40:28 2018 -0700
@@ -27,7 +27,7 @@
 /*
  * @test
  * @key jfr
- * @requires vm.gc == "ConcMarkSweep" | vm.gc == null
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm  jdk.jfr.event.gc.detailed.TestPromotionFailedEventWithParNew
  */
--- a/test/jdk/jdk/jfr/event/gc/detailed/TestStressAllocationGCEventsWithCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/detailed/TestStressAllocationGCEventsWithCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 
 /*
  * @test
- * @requires vm.gc == "null" | vm.gc == "ConcMarkSweep"
+ * @requires (vm.gc == "null" | vm.gc == "ConcMarkSweep") & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UseConcMarkSweepGC -Xmx64m jdk.jfr.event.gc.detailed.TestStressAllocationGCEventsWithCMS
  */
--- a/test/jdk/jdk/jfr/event/gc/detailed/TestStressAllocationGCEventsWithParNew.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/detailed/TestStressAllocationGCEventsWithParNew.java	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 
 /*
  * @test
- * @requires vm.gc == "null"
+ * @requires vm.gc == "null" & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UseConcMarkSweepGC -Xmx64m jdk.jfr.event.gc.detailed.TestStressAllocationGCEventsWithParNew
  */
--- a/test/jdk/jdk/jfr/event/gc/detailed/TestStressBigAllocationGCEventsWithCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/detailed/TestStressBigAllocationGCEventsWithCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 
 /*
  * @test
- * @requires vm.gc == "null" | vm.gc == "ConcMarkSweep"
+ * @requires (vm.gc == "null" | vm.gc == "ConcMarkSweep") & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UseConcMarkSweepGC -Xmx256m jdk.jfr.event.gc.detailed.TestStressBigAllocationGCEventsWithCMS 1048576
  */
--- a/test/jdk/jdk/jfr/event/gc/detailed/TestStressBigAllocationGCEventsWithParNew.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/detailed/TestStressBigAllocationGCEventsWithParNew.java	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
 
 /*
  * @test
- * @requires vm.gc == "null"
+ * @requires vm.gc == "null" & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UseConcMarkSweepGC -Xmx256m jdk.jfr.event.gc.detailed.TestStressBigAllocationGCEventsWithParNew 1048576
  */
--- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventConcurrentCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventConcurrentCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -38,7 +38,7 @@
 /*
  * @test
  * @key jfr
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != false
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventConcurrentCMS
--- a/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventParNewCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/heapsummary/TestHeapSummaryEventParNewCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 /*
  * @test
  * @key jfr
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != true
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseConcMarkSweepGC jdk.jfr.event.gc.heapsummary.TestHeapSummaryEventParNewCMS
--- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithCMSConcurrent.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithCMSConcurrent.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 /*
  * @test
  * @key jfr
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != false
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent -XX:MarkSweepDeadRatio=0 -XX:-UseCompressedOops -XX:+IgnoreUnrecognizedVMOptions jdk.jfr.event.gc.objectcount.TestObjectCountAfterGCEventWithCMSConcurrent
--- a/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithCMSMarkSweep.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/objectcount/TestObjectCountAfterGCEventWithCMSMarkSweep.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 /*
  * @test
  * @key jfr
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != true
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -XX:+UseConcMarkSweepGC -XX:MarkSweepDeadRatio=0 -XX:-UseCompressedOops -XX:+IgnoreUnrecognizedVMOptions jdk.jfr.event.gc.objectcount.TestObjectCountAfterGCEventWithCMSMarkSweep
--- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithCMSConcurrent.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithCMSConcurrent.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 /*
  * @test
  * @key jfr
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != false
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc+heap=trace,gc*=debug -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent jdk.jfr.event.gc.refstat.TestRefStatEventWithCMSConcurrent
--- a/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithCMSMarkSweep.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/refstat/TestRefStatEventWithCMSMarkSweep.java	Fri Jun 08 09:40:28 2018 -0700
@@ -29,7 +29,7 @@
 /*
  * @test
  * @key jfr
- * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null)
+ * @requires (vm.gc == "ConcMarkSweep" | vm.gc == null) & !vm.graal.enabled
  *           & vm.opt.ExplicitGCInvokesConcurrent != true
  * @library /test/lib /test/jdk
  * @run main/othervm  -XX:+UnlockExperimentalVMOptions -XX:-UseFastUnorderedTimeStamps -Xlog:gc+heap=trace,gc*=debug -XX:+UseConcMarkSweepGC jdk.jfr.event.gc.refstat.TestRefStatEventWithCMSMarkSweep
--- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestConcMarkSweepAllocationPendingStackTrace.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestConcMarkSweepAllocationPendingStackTrace.java	Fri Jun 08 09:40:28 2018 -0700
@@ -28,7 +28,7 @@
  * @test
  * @key jfr
  *
- * @requires vm.gc == "null" | vm.gc == "ConcMarkSweep"
+ * @requires (vm.gc == "null" | vm.gc == "ConcMarkSweep") & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:MaxNewSize=10M -Xmx64M -XX:+UseConcMarkSweepGC -Xlog:gc* jdk.jfr.event.gc.stacktrace.TestConcMarkSweepAllocationPendingStackTrace
  */
--- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceConcMarkSweepGCAllocationPendingStackTrace.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestMetaspaceConcMarkSweepGCAllocationPendingStackTrace.java	Fri Jun 08 09:40:28 2018 -0700
@@ -28,7 +28,7 @@
  * @test
  * @key jfr
  *
- * @requires vm.gc == "null" | vm.gc == "ConcMarkSweep"
+ * @requires (vm.gc == "null" | vm.gc == "ConcMarkSweep") & !vm.graal.enabled
  * @requires !(vm.compMode == "Xcomp" & os.arch == "aarch64")
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UseConcMarkSweepGC -XX:MaxMetaspaceSize=64M -Xlog:gc* jdk.jfr.event.gc.stacktrace.TestMetaspaceConcMarkSweepGCAllocationPendingStackTrace
--- a/test/jdk/jdk/jfr/event/gc/stacktrace/TestParNewAllocationPendingStackTrace.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/gc/stacktrace/TestParNewAllocationPendingStackTrace.java	Fri Jun 08 09:40:28 2018 -0700
@@ -28,7 +28,7 @@
  * @test
  * @key jfr
  *
- * @requires vm.gc == "null" | vm.gc == "ConcMarkSweep"
+ * @requires (vm.gc == "null" | vm.gc == "ConcMarkSweep") & !vm.graal.enabled
  * @library /test/lib /test/jdk
  * @run main/othervm -XX:+UseConcMarkSweepGC -Xlog:gc* -XX:+FlightRecorder jdk.jfr.event.gc.stacktrace.TestParNewAllocationPendingStackTrace
  */
--- a/test/jdk/jdk/jfr/event/oldobject/TestCMS.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/oldobject/TestCMS.java	Fri Jun 08 09:40:28 2018 -0700
@@ -37,7 +37,7 @@
 /*
  * @test
  * @key jfr
- * @requires vm.gc == "null"
+ * @requires vm.gc == "null" & !vm.graal.enabled
  * @summary Test leak profiler with CMS GC
  * @library /test/lib /test/jdk
  * @modules jdk.jfr/jdk.jfr.internal.test
--- a/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/jdk/jfr/event/runtime/TestModuleEvents.java	Fri Jun 08 09:40:28 2018 -0700
@@ -40,6 +40,7 @@
  * @test
  * @summary Tests the JFR events related to modules
  * @key jfr
+ * @requires !vm.graal.enabled
  * @library /test/lib
  * @run main/othervm --limit-modules java.base,jdk.jfr jdk.jfr.event.runtime.TestModuleEvents
  */
--- a/test/jdk/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/sun/management/HotspotRuntimeMBean/GetSafepointSyncTime.java	Fri Jun 08 09:40:28 2018 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug     4858522
+ * @bug     4858522 8174734
  * @summary Basic unit test of HotspotRuntimeMBean.getSafepointSyncTime()
  * @author  Steve Bohne
  *
@@ -43,50 +43,71 @@
 
     private static final long NUM_THREAD_DUMPS = 300;
 
-    // Careful with these values.
-    private static final long MIN_VALUE_FOR_PASS = 1;
-    private static final long MAX_VALUE_FOR_PASS = Long.MAX_VALUE;
+    static void checkPositive(long value, String label) {
+        if (value < 0)
+            throw new RuntimeException(label + " had a negative value of "
+                                       + value);
+    }
+
+    static void validate(long count1, long count2, long time1, long time2,
+                         String label) {
+        checkPositive(count1, label + ":count1");
+        checkPositive(count2, label + ":count2");
+        checkPositive(time1, label + ":time1");
+        checkPositive(time2, label + ":time2");
+
+        long countDiff = count2 - count1;
+        long timeDiff = time2 - time1;
+
+        if (countDiff < NUM_THREAD_DUMPS) {
+            throw new RuntimeException(label +
+                                       ": Expected at least " + NUM_THREAD_DUMPS +
+                                       " safepoints but only got " + countDiff);
+        }
+
+        // getSafepointSyncTime is the accumulated time spent getting to a
+        // safepoint, so each safepoint will add a little to this, but the
+        // resolution is only milliseconds so we may not see it.
+        if (timeDiff < 0) {
+            throw new RuntimeException(label + ": Safepoint sync time " +
+                                       "decreased unexpectedly " +
+                                       "(time1 = " + time1 + "; " +
+                                       "time2 = " + time2 + ")");
+        }
+
+        System.out.format("%s: Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
+                          label, count2, countDiff, time2, timeDiff);
+
+    }
 
     public static void main(String args[]) throws Exception {
         long count = mbean.getSafepointCount();
-        long value = mbean.getSafepointSyncTime();
+        long time = mbean.getSafepointSyncTime();
 
-        // Thread.getAllStackTraces() should cause safepoints.
-        // If this test is failing because it doesn't,
-        // MIN_VALUE_FOR_PASS should be reset to 0
+        checkPositive(count, "count");
+        checkPositive(time, "time");
+
+        // Thread.getAllStackTraces() should cause a safepoint.
+
         for (int i = 0; i < NUM_THREAD_DUMPS; i++) {
             Thread.getAllStackTraces();
         }
 
         long count1 = mbean.getSafepointCount();
-        long value1 = mbean.getSafepointSyncTime();
-
-        System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
-                          count1, count1-count, value1, value1-value);
+        long time1 = mbean.getSafepointSyncTime();
 
-        if (value1 < MIN_VALUE_FOR_PASS || value1 > MAX_VALUE_FOR_PASS) {
-            throw new RuntimeException("Safepoint sync time " +
-                                       "illegal value: " + value1 + " ms " +
-                                       "(MIN = " + MIN_VALUE_FOR_PASS + "; " +
-                                       "MAX = " + MAX_VALUE_FOR_PASS + ")");
-        }
+        validate(count, count1, time, time1, "Pass 1");
+
+        // repeat the experiment
 
         for (int i = 0; i < NUM_THREAD_DUMPS; i++) {
             Thread.getAllStackTraces();
         }
 
         long count2 = mbean.getSafepointCount();
-        long value2 = mbean.getSafepointSyncTime();
-
-        System.out.format("Safepoint count=%d (diff=%d), sync time=%d ms (diff=%d)%n",
-                          count2, count2-count1, value2, value2-value1);
+        long time2 = mbean.getSafepointSyncTime();
 
-        if (value2 <= value1) {
-            throw new RuntimeException("Safepoint sync time " +
-                                       "did not increase " +
-                                       "(value1 = " + value1 + "; " +
-                                       "value2 = " + value2 + ")");
-        }
+        validate(count1, count2, time1, time2, "Pass 2");
 
         System.out.println("Test passed.");
     }
--- a/test/jdk/sun/text/resources/LocaleData	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/sun/text/resources/LocaleData	Fri Jun 08 09:40:28 2018 -0700
@@ -8317,3 +8317,6 @@
 CurrencyNames//lak=Lao Kip
 CurrencyNames//php=Philippine Piso
 CurrencyNames//azn=Azerbaijan Manat
+
+# bug $8193552
+CurrencyNames//mru=Mauritanian Ouguiya
--- a/test/jdk/sun/text/resources/LocaleDataTest.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/sun/text/resources/LocaleDataTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -38,7 +38,7 @@
  *      7114053 7074882 7040556 8008577 8013836 8021121 6192407 6931564 8027695
  *      8017142 8037343 8055222 8042126 8074791 8075173 8080774 8129361 8134916
  *      8145136 8145952 8164784 8037111 8081643 7037368 8178872 8185841 8190918
- *      8187946 8195478 8181157 8179071
+ *      8187946 8195478 8181157 8179071 8193552 8202026 8204269
  * @summary Verify locale data
  * @modules java.base/sun.util.resources
  * @modules jdk.localedata
--- a/test/jdk/tools/jmod/JmodNegativeTest.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/tools/jmod/JmodNegativeTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -100,7 +100,7 @@
         jmod("--badOption")
             .assertFailure()
             .resultChecker(r ->
-                assertContains(r.output, "Error: 'badOption' is not a recognized option")
+                assertContains(r.output, "Error: badOption is not a recognized option")
             );
     }
 
--- a/test/jdk/tools/jmod/JmodTest.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jdk/tools/jmod/JmodTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -111,7 +111,7 @@
 
         Path jmod = MODS_DIR.resolve("apa.jmod");
         jmod("create",
-             "--libs=", libDir.toString(),
+             "--libs=" + libDir.toString(),
              "--class-path", classesDir.toString(),
              jmod.toString())
             .assertSuccess();
@@ -310,7 +310,7 @@
         Path lp = EXPLODED_DIR.resolve("foo").resolve("lib");
 
         jmod("create",
-             "--libs=", lp.toString(),
+             "--libs=" + lp.toString(),
              "--class-path", cp.toString(),
              jmod.toString())
             .assertSuccess()
@@ -335,8 +335,8 @@
 
         jmod("create",
              "--conf", cf.toString(),
-             "--cmds=", bp.toString(),
-             "--libs=", lp.toString(),
+             "--cmds=" + bp.toString(),
+             "--libs=" + lp.toString(),
              "--class-path", cp.toString(),
              jmod.toString())
             .assertSuccess()
@@ -361,7 +361,7 @@
         Path lp = EXPLODED_DIR.resolve("foo").resolve("lib");
 
         jmod("create",
-             "--libs=", lp.toString(),
+             "--libs=" + lp.toString(),
              "--class-path", cp.toString(),
              "--exclude", "**internal**",
              "--exclude", "first.so",
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/tools/launcher/SourceMode.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,315 @@
+/*
+ * Copyright (c) 2017, 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please 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 8192920
+ * @summary Test source mode
+ * @modules jdk.compiler
+ * @run main SourceMode
+ */
+
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+public class SourceMode extends TestHelper {
+
+    public static void main(String... args) throws Exception {
+        new SourceMode().run(args);
+    }
+
+    // java Simple.java 1 2 3
+    @Test
+    void testSimpleJava() throws IOException {
+        Path file = getSimpleFile("Simple.java", false);
+        TestResult tr = doExec(javaCmd, file.toString(), "1", "2", "3");
+        if (!tr.isOK())
+            error(tr, "Bad exit code: " + tr.exitValue);
+        if (!tr.contains("[1, 2, 3]"))
+            error(tr, "Expected output not found");
+        System.out.println(tr.testOutput);
+    }
+
+    // java --source 10 simple 1 2 3
+    @Test
+    void testSimple() throws IOException {
+        Path file = getSimpleFile("simple", false);
+        TestResult tr = doExec(javaCmd, "--source", "10", file.toString(), "1", "2", "3");
+        if (!tr.isOK())
+            error(tr, "Bad exit code: " + tr.exitValue);
+        if (!tr.contains("[1, 2, 3]"))
+            error(tr, "Expected output not found");
+        System.out.println(tr.testOutput);
+    }
+
+    // execSimple 1 2 3
+    @Test
+    void testExecSimple() throws IOException {
+        if (isWindows) // Will not work without cygwin, pass silently
+            return;
+        Path file = setExecutable(getSimpleFile("execSimple", true));
+        TestResult tr = doExec(file.toAbsolutePath().toString(), "1", "2", "3");
+        if (!tr.isOK())
+            error(tr, "Bad exit code: " + tr.exitValue);
+        if (!tr.contains("[1, 2, 3]"))
+            error(tr, "Expected output not found");
+        System.out.println(tr.testOutput);
+    }
+
+    // java @simpleJava.at  (contains Simple.java 1 2 3)
+    @Test
+    void testSimpleJavaAtFile() throws IOException {
+        Path file = getSimpleFile("Simple.java", false);
+        Path atFile = Paths.get("simpleJava.at");
+        createFile(atFile.toFile(), List.of(file + " 1 2 3"));
+        TestResult tr = doExec(javaCmd, "@" + atFile);
+        if (!tr.isOK())
+            error(tr, "Bad exit code: " + tr.exitValue);
+        if (!tr.contains("[1, 2, 3]"))
+            error(tr, "Expected output not found");
+        System.out.println(tr.testOutput);
+    }
+
+    // java @simple.at  (contains --source 10 simple 1 2 3)
+    @Test
+    void testSimpleAtFile() throws IOException {
+        Path file = getSimpleFile("simple", false);
+        Path atFile = Paths.get("simple.at");
+        createFile(atFile.toFile(), List.of("--source 10 " + file + " 1 2 3"));
+        TestResult tr = doExec(javaCmd, "@" + atFile);
+        if (!tr.isOK())
+            error(tr, "Bad exit code: " + tr.exitValue);
+        if (!tr.contains("[1, 2, 3]"))
+            error(tr, "Expected output not found");
+        System.out.println(tr.testOutput);
+    }
+
+    // java -cp classes Main.java 1 2 3
+    @Test
+    void testClasspath() throws IOException {
+        Path base = Files.createDirectories(Paths.get("testClasspath"));
+        Path otherJava = base.resolve("Other.java");
+        createFile(otherJava.toFile(), List.of(
+            "public class Other {",
+            "  public static String join(String[] args) {",
+            "    return String.join(\"-\", args);",
+            "  }",
+            "}"
+        ));
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        Path mainJava = base.resolve("Main.java");
+        createFile(mainJava.toFile(), List.of(
+            "class Main {",
+            "  public static void main(String[] args) {",
+            "    System.out.println(Other.join(args));",
+            "  }}"
+        ));
+        compile("-d", classes.toString(), otherJava.toString());
+        TestResult tr = doExec(javaCmd, "-cp", classes.toString(),
+                mainJava.toString(), "1", "2", "3");
+        if (!tr.isOK())
+            error(tr, "Bad exit code: " + tr.exitValue);
+        if (!tr.contains("1-2-3"))
+            error(tr, "Expected output not found");
+        System.out.println(tr.testOutput);
+    }
+
+    // java --add-exports=... Export.java --help
+    @Test
+    void testAddExports() throws IOException {
+        Path exportJava = Paths.get("Export.java");
+        createFile(exportJava.toFile(), List.of(
+            "public class Export {",
+            "  public static void main(String[] args) {",
+            "    new com.sun.tools.javac.main.Main(\"demo\").compile(args);",
+            "  }",
+            "}"
+        ));
+        // verify access fails without --add-exports
+        TestResult tr1 = doExec(javaCmd, exportJava.toString(), "--help");
+        if (tr1.isOK())
+            error(tr1, "Compilation succeeded unexpectedly");
+        // verify access succeeds with --add-exports
+        TestResult tr2 = doExec(javaCmd,
+            "--add-exports", "jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
+            exportJava.toString(), "--help");
+        if (!tr2.isOK())
+            error(tr2, "Bad exit code: " + tr2.exitValue);
+        if (!(tr2.contains("demo") && tr2.contains("Usage")))
+            error(tr2, "Expected output not found");
+    }
+
+    // java -cp ... HelloWorld.java  (for a class "java" in package "HelloWorld")
+    @Test
+    void testClassNamedJava() throws IOException {
+        Path base = Files.createDirectories(Paths.get("testClassNamedJava"));
+        Path src = Files.createDirectories(base.resolve("src"));
+        Path srcfile = src.resolve("java.java");
+        createFile(srcfile.toFile(), List.of(
+                "package HelloWorld;",
+                "class java {",
+                "    public static void main(String... args) {",
+                "        System.out.println(HelloWorld.java.class.getName());",
+                "    }",
+                "}"
+        ));
+        Path classes = base.resolve("classes");
+        compile("-d", classes.toString(), srcfile.toString());
+        TestResult tr =
+            doExec(javaCmd, "-cp", classes.toString(), "HelloWorld.java");
+        if (!tr.isOK())
+            error(tr, "Command failed");
+        if (!tr.contains("HelloWorld.java"))
+            error(tr, "Expected output not found");
+    }
+
+    // java --source
+    @Test
+    void testSourceNoArg() throws IOException {
+        TestResult tr = doExec(javaCmd, "--source");
+        if (tr.isOK())
+            error(tr, "Command succeeded unexpectedly");
+        System.err.println(tr);
+        if (!tr.contains("--source requires source version"))
+            error(tr, "Expected output not found");
+    }
+
+    // java --source 10 -jar simple.jar
+    @Test
+    void testSourceJarConflict() throws IOException {
+        Path base = Files.createDirectories(Paths.get("testSourceJarConflict"));
+        Path file = getSimpleFile("Simple.java", false);
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        compile("-d", classes.toString(), file.toString());
+        Path simpleJar = base.resolve("simple.jar");
+        createJar("cf", simpleJar.toString(), "-C", classes.toString(), ".");
+        TestResult tr =
+            doExec(javaCmd, "--source", "10", "-jar", simpleJar.toString());
+        if (tr.isOK())
+            error(tr, "Command succeeded unexpectedly");
+        if (!tr.contains("Option -jar is not allowed with --source"))
+            error(tr, "Expected output not found");
+    }
+
+    // java --source 10 -m jdk.compiler
+    @Test
+    void testSourceModuleConflict() throws IOException {
+        TestResult tr = doExec(javaCmd, "--source", "10", "-m", "jdk.compiler");
+        if (tr.isOK())
+            error(tr, "Command succeeded unexpectedly");
+        if (!tr.contains("Option -m is not allowed with --source"))
+            error(tr, "Expected output not found");
+    }
+
+    // #!.../java --source 10 -version
+    @Test
+    void testTerminalOptionInShebang() throws IOException {
+        if (isWindows) // Will not work without cygwin, pass silently
+            return;
+        Path base = Files.createDirectories(
+            Paths.get("testTerminalOptionInShebang"));
+        Path bad = base.resolve("bad");
+        createFile(bad.toFile(), List.of(
+            "#!" + javaCmd + " --source 10 -version"));
+        setExecutable(bad);
+        TestResult tr = doExec(bad.toString());
+        if (!tr.contains("Option -version is not allowed in this context"))
+            error(tr, "Expected output not found");
+    }
+
+    // #!.../java --source 10 @bad.at  (contains -version)
+    @Test
+    void testTerminalOptionInShebangAtFile() throws IOException {
+        if (isWindows) // Will not work without cygwin, pass silently
+            return;
+        // Use a short directory name, to avoid line length limitations
+        Path base = Files.createDirectories(Paths.get("testBadAtFile"));
+        Path bad_at = base.resolve("bad.at");
+        createFile(bad_at.toFile(), List.of("-version"));
+        Path bad = base.resolve("bad");
+        createFile(bad.toFile(), List.of(
+            "#!" + javaCmd + " --source 10 @" + bad_at));
+        setExecutable(bad);
+        TestResult tr = doExec(bad.toString());
+        System.err.println("JJG JJG " + tr);
+        if (!tr.contains("Option -version in @testBadAtFile/bad.at is "
+                + "not allowed in this context"))
+            error(tr, "Expected output not found");
+    }
+
+    // #!.../java --source 10 HelloWorld
+    @Test
+    void testMainClassInShebang() throws IOException {
+        if (isWindows) // Will not work without cygwin, pass silently
+            return;
+        Path base = Files.createDirectories(Paths.get("testMainClassInShebang"));
+        Path bad = base.resolve("bad");
+        createFile(bad.toFile(), List.of(
+            "#!" + javaCmd + " --source 10 HelloWorld"));
+        setExecutable(bad);
+        TestResult tr = doExec(bad.toString());
+        if (!tr.contains("Cannot specify main class in this context"))
+            error(tr, "Expected output not found");
+    }
+
+    //--------------------------------------------------------------------------
+
+    private Map<String,String> getLauncherDebugEnv() {
+        return Map.of("_JAVA_LAUNCHER_DEBUG", "1");
+    }
+
+    private Path getSimpleFile(String name, boolean shebang) throws IOException {
+        Path file = Paths.get(name);
+        if (!Files.exists(file)) {
+            createFile(file.toFile(), List.of(
+                (shebang ? "#!" + javaCmd + " --source 10" : ""),
+                "public class Simple {",
+                "  public static void main(String[] args) {",
+                "    System.out.println(java.util.Arrays.toString(args));",
+                "  }}"));
+        }
+        return file;
+    }
+
+    private Path setExecutable(Path file) throws IOException {
+        Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file);
+        perms.add(PosixFilePermission.OWNER_EXECUTE);
+        Files.setPosixFilePermissions(file, perms);
+        return file;
+    }
+
+    private void error(TestResult tr, String message) {
+        System.err.println(tr);
+        throw new RuntimeException(message);
+    }
+}
--- a/test/jtreg-ext/requires/VMProps.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/jtreg-ext/requires/VMProps.java	Fri Jun 08 09:40:28 2018 -0700
@@ -36,6 +36,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import sun.hotspot.code.Compiler;
 import sun.hotspot.cpuinfo.CPUInfo;
 import sun.hotspot.gc.GC;
 import sun.hotspot.WhiteBox;
@@ -344,33 +345,7 @@
      * @return true if Graal is used as JIT compiler.
      */
     protected String isGraalEnabled() {
-        // Graal is enabled if following conditions are true:
-        // - we are not in Interpreter mode
-        // - UseJVMCICompiler flag is true
-        // - jvmci.Compiler variable is equal to 'graal'
-        // - TieredCompilation is not used or TieredStopAtLevel is greater than 3
-
-        Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
-        if (useCompiler == null || !useCompiler)
-            return "false";
-
-        Boolean useJvmciComp = WB.getBooleanVMFlag("UseJVMCICompiler");
-        if (useJvmciComp == null || !useJvmciComp)
-            return "false";
-
-        // This check might be redundant but let's keep it for now.
-        String jvmciCompiler = System.getProperty("jvmci.Compiler");
-        if (jvmciCompiler == null || !jvmciCompiler.equals("graal")) {
-            return "false";
-        }
-
-        Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
-        Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel");
-        // if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used
-        if (tieredCompilation != null && tieredCompilation && compLevel != null && compLevel <= 3)
-            return "false";
-
-        return "true";
+        return Compiler.isGraalEnabled() ? "true" : "false";
     }
 
 
--- a/test/langtools/ProblemList.txt	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/langtools/ProblemList.txt	Fri Jun 08 09:40:28 2018 -0700
@@ -57,6 +57,7 @@
 tools/javac/modules/SourceInSymlinkTest.java                                    8180263    windows-all    fails when run on a subst drive
 tools/javac/options/release/ReleaseOptionUnsupported.java                       8193784    generic-all    temporary until support for --release 11 is worked out
 tools/javac/importscope/T8193717.java                                           8203925    generic-all    the test requires too much memory
+tools/javac/launcher/SourceLauncherTest.java                                    8204588    windows-all    New test needs adjusting for Windows
 
 ###########################################################################
 #
--- a/test/langtools/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testFramesNoFrames/TestFramesNoFrames.java	Fri Jun 08 09:40:28 2018 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 8162353 8164747 8173707 8196202
+ * @bug 8162353 8164747 8173707 8196202 8204303
  * @summary javadoc should provide a way to disable use of frames
  * @library /tools/lib ../lib
  * @modules
@@ -269,6 +269,9 @@
                     break;
             }
 
+            out.println("Checker: " + fKind + " " + oKind + " " + hKind
+                + ": frames:" + frames + " overview:" + overview);
+
             checkAllClassesFiles();
             checkFrameFiles();
             checkOverviewSummary();
@@ -380,10 +383,19 @@
         }
 
         private void checkOverviewSummary() {
-            // the overview-summary.html file only appears if
-            // in frames mode and (overview requested or multiple packages)
-            checkFiles(frames && overview,
+            // To accommodate the historical behavior of generating
+            // overview-summary.html in frames mode, the file
+            // will still be generated in no-frames mode,
+            // but will be a redirect to index.html
+            checkFiles(overview,
                     "overview-summary.html");
+            if (overview) {
+                checkOutput("overview-summary.html",  !frames,
+                        "<link rel=\"canonical\" href=\"index.html\">",
+                        "<script type=\"text/javascript\">window.location.replace('index.html')</script>",
+                        "<meta http-equiv=\"Refresh\" content=\"0;index.html\">",
+                        "<p><a href=\"index.html\">index.html</a></p>");
+            }
         }
 
         private void checkWarning() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testIndexWithModules/TestIndexWithModules.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8190875
+ * @summary modules not listed in overview/index page
+ * @library /tools/lib ../lib
+ * @modules
+ *      jdk.javadoc/jdk.javadoc.internal.tool
+ *      jdk.compiler/com.sun.tools.javac.api
+ *      jdk.compiler/com.sun.tools.javac.main
+ * @build JavadocTester
+ * @run main TestIndexWithModules
+ */
+
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+import builder.ClassBuilder;
+import toolbox.ModuleBuilder;
+import toolbox.ToolBox;
+
+
+public class TestIndexWithModules extends JavadocTester {
+
+    final ToolBox tb;
+    private final Path src;
+
+    public static void main(String... args) throws Exception {
+        TestIndexWithModules tester = new TestIndexWithModules();
+        tester.runTests(m -> new Object[]{Paths.get(m.getName())});
+    }
+
+    TestIndexWithModules() throws Exception{
+        tb = new ToolBox();
+        src = Paths.get("src");
+        initModules();
+    }
+
+    @Test
+    void testIndexWithOverviewPath(Path base) throws Exception {
+        Path out = base.resolve("out");
+
+        tb.writeFile("overview.html",
+                "<html><body>The overview summary page header</body></html>");
+
+        javadoc("-d", out.toString(),
+                "-overview", "overview.html",
+                "--module-source-path", src.toString(),
+                "--module", "m1");
+
+        checkExit(Exit.OK);
+        checkOrder("index.html",
+                "The overview summary page header",
+                "Modules",
+                "<a href=\"m1/module-summary.html\">m1</a>");
+
+    }
+
+    //multiple modules with frames
+    @Test
+    void testIndexWithMultipleModules1(Path base) throws Exception {
+        Path out = base.resolve("out");
+        javadoc("-d", out.toString(),
+                "--module-source-path", src.toString(),
+                "--module", "m1,m3,m4",
+                "--frames");
+
+        checkExit(Exit.OK);
+
+        checkOutput("index.html", true,
+                "window.location.replace('overview-summary.html')");
+        checkOrder("overview-summary.html",
+                "Modules",
+                "<a href=\"m1/module-summary.html\">m1</a>",
+                "<a href=\"m3/module-summary.html\">m3</a>",
+                "<a href=\"m4/module-summary.html\">m4</a>");
+    }
+
+    //multiple modules with out frames
+    @Test
+    void testIndexWithMultipleModules2(Path base) throws Exception {
+        Path out = base.resolve("out");
+        javadoc("-d", out.toString(),
+                "--module-source-path", src.toString(),
+                "--module", "m1,m3,m4",
+                "--no-frames");
+
+        checkExit(Exit.OK);
+        checkOrder("index.html",
+                "Modules",
+                "<a href=\"m1/module-summary.html\">m1</a>",
+                "<a href=\"m3/module-summary.html\">m3</a>",
+                "<a href=\"m4/module-summary.html\">m4</a>");
+    }
+
+    @Test
+    void testIndexWithSingleModule(Path base) throws Exception {
+        Path out = base.resolve("out");
+        javadoc("-d", out.toString(),
+                "--module-source-path", src.toString(),
+                "--module", "m2");
+
+        checkExit(Exit.OK);
+        checkOutput("index.html", true,
+                "window.location.replace('m2/module-summary.html')");
+    }
+
+    //no modules and multiple packages
+    @Test
+    void testIndexWithNoModules1(Path base) throws Exception{
+        Path out = base.resolve("out");
+        new ClassBuilder(tb, "P1.A1")
+                .setModifiers("public","class")
+                .write(src);
+
+        new ClassBuilder(tb, "P2.A2")
+                .setModifiers("public","class")
+                .write(src);
+
+        javadoc("-d", out.toString(),
+                "--no-frames",
+                "-sourcepath", src.toString(),
+                "P1","P2");
+
+        checkExit(Exit.OK);
+        checkOrder("index.html",
+                "Packages",
+                "<a href=\"P1/package-summary.html\">P1</a>",
+                "<a href=\"P2/package-summary.html\">P2</a>");
+
+    }
+
+    //no modules and one package
+    @Test
+    void testIndexWithNoModules2(Path base) throws Exception{
+        Path out = base.resolve("out");
+        new ClassBuilder(tb, "P1.A1")
+                .setModifiers("public","class")
+                .write(src);
+
+        javadoc("-d", out.toString(),
+                "--no-frames",
+                "-sourcepath", src.toString(),
+                "P1");
+
+        checkExit(Exit.OK);
+        checkOrder("index.html",
+                "window.location.replace('P1/package-summary.html')");
+    }
+
+    void initModules() throws Exception {
+        new ModuleBuilder(tb, "m1")
+                .exports("p1")
+                .classes("package p1; public class c1{}")
+                .write(src);
+
+        new ModuleBuilder(tb, "m2")
+                .exports("p1")
+                .exports("p2")
+                .classes("package p1; public class c1{}")
+                .classes("package p2; public class c2{}")
+                .write(src);
+
+        new ModuleBuilder(tb, "m3").write(src);
+
+        new ModuleBuilder(tb, "m4").write(src);
+    }
+}
--- a/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testModules/TestModules.java	Fri Jun 08 09:40:28 2018 -0700
@@ -26,7 +26,7 @@
  * @bug 8154119 8154262 8156077 8157987 8154261 8154817 8135291 8155995 8162363
  *      8168766 8168688 8162674 8160196 8175799 8174974 8176778 8177562 8175218
  *      8175823 8166306 8178043 8181622 8183511 8169819 8074407 8183037 8191464
-        8164407 8192007 8182765 8196200 8196201 8196202
+        8164407 8192007 8182765 8196200 8196201 8196202 8196202
  * @summary Test modules support in javadoc.
  * @author bpatel
  * @library ../lib
@@ -1574,23 +1574,13 @@
     }
 
     void checkGroupOptionSingleModule() {
-        checkOutput("overview-summary.html", true,
-                "<div class=\"contentContainer\">\n"
-                + "<table class=\"overviewSummary\">\n"
-                + "<caption><span>Module Group B</span><span class=\"tabEnd\">&nbsp;</span></caption>");
-        checkOutput("overview-summary.html", false,
-                "<table class=\"overviewSummary\">\n"
-                + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
+        checkOutput("index.html", true,
+                "window.location.replace('moduleB/module-summary.html')");
     }
 
     void checkGroupOptionSingleModule_html4() {
-        checkOutput("overview-summary.html", true,
-                "<div class=\"contentContainer\">\n"
-                + "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
-                + "<caption><span>Module Group B</span><span class=\"tabEnd\">&nbsp;</span></caption>");
-        checkOutput("overview-summary.html", false,
-                "<table class=\"overviewSummary\" summary=\"Module Summary table, listing modules, and an explanation\">\n"
-                + "<caption><span>Modules</span><span class=\"tabEnd\">&nbsp;</span></caption>");
+        checkOutput("index.html", true,
+                "window.location.replace('moduleB/module-summary.html')");
     }
 
     void checkModuleName(boolean found) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/DefiniteAssignment/T8204610.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8204610
+ * @summary Compiler confused by parenthesized "this" in final fields assignments
+ * @library /tools/javac/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.code
+ *          jdk.compiler/com.sun.tools.javac.comp
+ *          jdk.compiler/com.sun.tools.javac.main
+ *          jdk.compiler/com.sun.tools.javac.tree
+ *          jdk.compiler/com.sun.tools.javac.util
+ * @build combo.ComboTestHelper
+
+ * @run main T8204610
+ */
+
+import combo.ComboInstance;
+import combo.ComboParameter;
+import combo.ComboTask.Result;
+import combo.ComboTestHelper;
+
+public class T8204610 extends ComboInstance<T8204610> {
+
+    enum ParenKind implements ComboParameter {
+        NONE(""),
+        ONE("#P"),
+        TWO("#P#P"),
+        THREE("#P#P#P");
+
+        String parensTemplate;
+
+        ParenKind(String parensTemplate) {
+            this.parensTemplate = parensTemplate;
+        }
+
+        @Override
+        public String expand(String optParameter) {
+            return parensTemplate.replaceAll("#P", optParameter.equals("OPEN") ? "(" : ")");
+        }
+    }
+
+    public static void main(String... args) {
+        new ComboTestHelper<T8204610>()
+                .withArrayDimension("PAREN", (x, pk, idx) -> x.parenKinds[idx] = pk, 3, ParenKind.values())
+                .run(T8204610::new);
+    }
+
+    ParenKind[] parenKinds = new ParenKind[3];
+
+    @Override
+    public void doWork() {
+        newCompilationTask()
+                .withSourceFromTemplate(bodyTemplate)
+                .analyze(this::check);
+    }
+
+    String bodyTemplate = "class Test {\n" +
+                          "   final int x;\n" +
+                          "   Test() {\n" +
+                          "      #{PAREN[0].OPEN} #{PAREN[1].OPEN} this #{PAREN[1].CLOSE} . #{PAREN[2].OPEN} x #{PAREN[2].CLOSE} #{PAREN[0].CLOSE} = 1;\n" +
+                          "   } }";
+
+    void check(Result<?> res) {
+        boolean expectedFail = parenKinds[2] != ParenKind.NONE;
+        if (expectedFail != res.hasErrors()) {
+            fail("unexpected compilation result for source:\n" +
+                res.compilationInfo());
+        }
+    }
+}
--- a/test/langtools/tools/javac/diags/CheckResourceKeys.java	Thu Jun 07 23:12:35 2018 -0700
+++ b/test/langtools/tools/javac/diags/CheckResourceKeys.java	Fri Jun 08 09:40:28 2018 -0700
@@ -118,7 +118,8 @@
     void findDeadKeys(Set<String> codeStrings, Set<String> resourceKeys) {
         String[] prefixes = {
             "compiler.err.", "compiler.warn.", "compiler.note.", "compiler.misc.",
-            "javac."
+            "javac.",
+            "launcher.err."
         };
         for (String rk: resourceKeys) {
             // some keys are used directly, without a prefix.
@@ -395,7 +396,7 @@
     Set<String> getResourceKeys() {
         Module jdk_compiler = ModuleLayer.boot().findModule("jdk.compiler").get();
         Set<String> results = new TreeSet<String>();
-        for (String name : new String[]{"javac", "compiler"}) {
+        for (String name : new String[]{"javac", "compiler", "launcher"}) {
             ResourceBundle b =
                     ResourceBundle.getBundle("com.sun.tools.javac.resources." + name, jdk_compiler);
             results.addAll(b.keySet());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/tools/javac/launcher/SourceLauncherTest.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,542 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8192920
+ * @summary Test source launcher
+ * @library /tools/lib
+ * @modules jdk.compiler/com.sun.tools.javac.api
+ *          jdk.compiler/com.sun.tools.javac.launcher
+ *          jdk.compiler/com.sun.tools.javac.main
+ * @build toolbox.JavaTask toolbox.JavacTask toolbox.TestRunner toolbox.ToolBox
+ * @run main SourceLauncherTest
+ */
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.lang.reflect.InvocationTargetException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Properties;
+
+import com.sun.tools.javac.launcher.Main;
+
+import toolbox.JavaTask;
+import toolbox.JavacTask;
+import toolbox.Task;
+import toolbox.TestRunner;
+import toolbox.TestRunner;
+import toolbox.ToolBox;
+
+public class SourceLauncherTest extends TestRunner {
+    public static void main(String... args) throws Exception {
+        SourceLauncherTest t = new SourceLauncherTest();
+        t.runTests(m -> new Object[] { Paths.get(m.getName()) });
+    }
+
+    SourceLauncherTest() {
+        super(System.err);
+        tb = new ToolBox();
+        System.err.println("version: " + thisVersion);
+    }
+
+    private final ToolBox tb;
+    private static final String thisVersion = System.getProperty("java.specification.version");
+
+    /*
+     * Positive tests.
+     */
+
+    @Test
+    public void testHelloWorld(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+        testSuccess(base.resolve("HelloWorld.java"), "Hello World! [1, 2, 3]\n");
+    }
+
+    @Test
+    public void testHelloWorldInPackage(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "package hello;\n" +
+            "import java.util.Arrays;\n" +
+            "class World {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+        testSuccess(base.resolve("hello").resolve("World.java"), "Hello World! [1, 2, 3]\n");
+    }
+
+    @Test
+    public void testHelloWorldWithAux(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        Aux.write(args);\n" +
+            "    }\n" +
+            "}\n" +
+            "class Aux {\n" +
+            "    static void write(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+        testSuccess(base.resolve("HelloWorld.java"), "Hello World! [1, 2, 3]\n");
+    }
+
+    @Test
+    public void testHelloWorldWithShebang(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "#!/usr/bin/java --source 11\n" +
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+        Files.copy(base.resolve("HelloWorld.java"), base.resolve("HelloWorld"));
+        testSuccess(base.resolve("HelloWorld"), "Hello World! [1, 2, 3]\n");
+    }
+
+    @Test
+    public void testNoAnnoProcessing(Path base) throws IOException {
+        Path annoSrc = base.resolve("annoSrc");
+        tb.writeJavaFiles(annoSrc,
+            "import java.util.*;\n" +
+            "import javax.annotation.processing.*;\n" +
+            "import javax.lang.model.element.*;\n" +
+            "@SupportedAnnotationTypes(\"*\")\n" +
+            "public class AnnoProc extends AbstractProcessor {\n" +
+            "    public boolean process(Set<? extends TypeElement> annos, RoundEnvironment rEnv) {\n" +
+            "        throw new Error(\"Annotation processor should not be invoked\");\n" +
+            "    }\n" +
+            "}\n");
+        Path annoClasses = Files.createDirectories(base.resolve("classes"));
+        new JavacTask(tb)
+                .outdir(annoClasses)
+                .files(annoSrc.resolve("AnnoProc.java").toString())
+                .run();
+        Path serviceFile = annoClasses.resolve("META-INF").resolve("services")
+                .resolve("javax.annotation.processing.Processor");
+        tb.writeFile(serviceFile, "AnnoProc");
+
+        Path mainSrc = base.resolve("mainSrc");
+        tb.writeJavaFiles(mainSrc,
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+
+        List<String> javacArgs = List.of("-classpath", annoClasses.toString());
+        List<String> classArgs = List.of("1", "2", "3");
+        String expect = "Hello World! [1, 2, 3]\n";
+        Result r = run(mainSrc.resolve("HelloWorld.java"), javacArgs, classArgs);
+        checkEqual("stdout", r.stdOut, expect);
+        checkEmpty("stderr", r.stdErr);
+        checkNull("exception", r.exception);
+    }
+
+    @Test
+    public void testEnablePreview(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+
+        String log = new JavaTask(tb)
+                .vmOptions("--enable-preview", "--source", thisVersion)
+                .className(base.resolve("HelloWorld.java").toString())
+                .classArgs("1", "2", "3")
+                .run(Task.Expect.SUCCESS)
+                .getOutput(Task.OutputKind.STDOUT);
+        checkEqual("stdout", log.trim(), "Hello World! [1, 2, 3]");
+    }
+
+    void testSuccess(Path file, String expect) throws IOException {
+        Result r = run(file, Collections.emptyList(), List.of("1", "2", "3"));
+        checkEqual("stdout", r.stdOut, expect);
+        checkEmpty("stderr", r.stdErr);
+        checkNull("exception", r.exception);
+    }
+
+    /*
+     * Negative tests: such as cannot find or execute main method.
+     */
+
+    @Test
+    public void testHelloWorldWithShebangJava(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "#!/usr/bin/java --source 11\n" +
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+        Path file = base.resolve("HelloWorld.java");
+        testError(file,
+            file + ":1: error: illegal character: '#'\n" +
+            "#!/usr/bin/java --source 11\n" +
+            "^\n" +
+            file + ":1: error: class, interface, or enum expected\n" +
+            "#!/usr/bin/java --source 11\n" +
+            "  ^\n" +
+            "2 errors\n",
+            "error: compilation failed");
+    }
+
+    @Test
+    public void testNoClass(Path base) throws IOException {
+        Files.createDirectories(base);
+        Path file = base.resolve("NoClass.java");
+        Files.write(file, List.of("package p;"));
+        testError(file, "", "error: no class declared in file");
+    }
+
+    @Test
+    public void testWrongClass(Path base) throws IOException {
+        Path src = base.resolve("src");
+        Path file = src.resolve("WrongClass.java");
+        tb.writeJavaFiles(src, "class WrongClass { }");
+        Path classes = Files.createDirectories(base.resolve("classes"));
+        new JavacTask(tb)
+                .outdir(classes)
+                .files(file)
+                .run();
+        String log = new JavaTask(tb)
+                .classpath(classes.toString())
+                .className(file.toString())
+                .run(Task.Expect.FAIL)
+                .getOutput(Task.OutputKind.STDERR);
+        checkEqual("stderr", log.trim(),
+                "error: class found on application class path: WrongClass");
+    }
+
+    @Test
+    public void testSyntaxErr(Path base) throws IOException {
+        tb.writeJavaFiles(base, "class SyntaxErr {");
+        Path file = base.resolve("SyntaxErr.java");
+        testError(file,
+                file + ":1: error: reached end of file while parsing\n" +
+                "class SyntaxErr {\n" +
+                "                 ^\n" +
+                "1 error\n",
+                "error: compilation failed");
+    }
+
+    @Test
+    public void testNoSourceOnClassPath(Path base) throws IOException {
+        Path auxSrc = base.resolve("auxSrc");
+        tb.writeJavaFiles(auxSrc,
+            "public class Aux {\n" +
+            "    static final String MESSAGE = \"Hello World\";\n" +
+            "}\n");
+
+        Path mainSrc = base.resolve("mainSrc");
+        tb.writeJavaFiles(mainSrc,
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(Aux.MESSAGE + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+
+        List<String> javacArgs = List.of("-classpath", auxSrc.toString());
+        List<String> classArgs = List.of("1", "2", "3");
+        String expectStdErr =
+            "testNoSourceOnClassPath/mainSrc/HelloWorld.java:4: error: cannot find symbol\n" +
+            "        System.out.println(Aux.MESSAGE + Arrays.toString(args));\n" +
+            "                           ^\n" +
+            "  symbol:   variable Aux\n" +
+            "  location: class HelloWorld\n" +
+            "1 error\n";
+        Result r = run(mainSrc.resolve("HelloWorld.java"), javacArgs, classArgs);
+        checkEmpty("stdout", r.stdOut);
+        checkEqual("stderr", r.stdErr, expectStdErr);
+        checkFault("exception", r.exception, "error: compilation failed");
+
+    }
+
+    // For any source file that is invoked through the OS shebang mechanism, invalid shebang
+    // lines will be caught and handled by the OS, before the launcher is even invoked.
+    // However, if such a file is passed directly to the launcher, perhaps using the --source
+    // option, a well-formed shebang line will be removed but a badly-formed one will be not be
+    // removed and will cause compilation errors.
+    @Test
+    public void testBadShebang(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "#/usr/bin/java --source 11\n" +
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+        Path file = base.resolve("HelloWorld.java");
+        testError(file,
+            file + ":1: error: illegal character: '#'\n" +
+            "#/usr/bin/java --source 11\n" +
+            "^\n" +
+            file + ":1: error: class, interface, or enum expected\n" +
+            "#/usr/bin/java --source 11\n" +
+            "  ^\n" +
+            "2 errors\n",
+            "error: compilation failed");
+    }
+
+    @Test
+    public void testBadSourceOpt(Path base) throws IOException {
+        Files.createDirectories(base);
+        Path file = base.resolve("DummyClass.java");
+        Files.write(file, List.of("class DummyClass { }"));
+        Properties sysProps = System.getProperties();
+        Properties p = new Properties(sysProps);
+        p.setProperty("jdk.internal.javac.source", "<BAD>");
+        System.setProperties(p);
+        try {
+            testError(file, "", "error: invalid value for --source option: <BAD>");
+        } finally {
+            System.setProperties(sysProps);
+        }
+    }
+
+    @Test
+    public void testEnablePreviewNoSource(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "import java.util.Arrays;\n" +
+            "class HelloWorld {\n" +
+            "    public static void main(String... args) {\n" +
+            "        System.out.println(\"Hello World! \" + Arrays.toString(args));\n" +
+            "    }\n" +
+            "}");
+
+        String log = new JavaTask(tb)
+                .vmOptions("--enable-preview")
+                .className(base.resolve("HelloWorld.java").toString())
+                .run(Task.Expect.FAIL)
+                .getOutput(Task.OutputKind.STDERR);
+        checkEqual("stderr", log.trim(),
+                "error: --enable-preview must be used with --source");
+    }
+
+    @Test
+    public void testNoMain(Path base) throws IOException {
+        tb.writeJavaFiles(base, "class NoMain { }");
+        testError(base.resolve("NoMain.java"), "",
+                "error: can't find main(String[]) method in class: NoMain");
+    }
+
+    @Test
+    public void testMainBadParams(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+                "class BadParams { public static void main() { } }");
+        testError(base.resolve("BadParams.java"), "",
+                "error: can't find main(String[]) method in class: BadParams");
+    }
+
+    @Test
+    public void testMainNotPublic(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+                "class NotPublic { static void main(String... args) { } }");
+        testError(base.resolve("NotPublic.java"), "",
+                "error: 'main' method is not declared 'public static'");
+    }
+
+    @Test
+    public void testMainNotStatic(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+                "class NotStatic { public void main(String... args) { } }");
+        testError(base.resolve("NotStatic.java"), "",
+                "error: 'main' method is not declared 'public static'");
+    }
+
+    @Test
+    public void testMainNotVoid(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+                "class NotVoid { public static int main(String... args) { return 0; } }");
+        testError(base.resolve("NotVoid.java"), "",
+                "error: 'main' method is not declared with a return type of 'void'");
+    }
+
+    @Test
+    public void testClassInModule(Path base) throws IOException {
+        tb.writeJavaFiles(base, "package java.net; class InModule { }");
+        Path file = base.resolve("java").resolve("net").resolve("InModule.java");
+        testError(file,
+                file + ":1: error: package exists in another module: java.base\n" +
+                "package java.net; class InModule { }\n" +
+                "^\n" +
+                "1 error\n",
+                "error: compilation failed");
+    }
+
+    void testError(Path file, String expectStdErr, String expectFault) throws IOException {
+        Result r = run(file, Collections.emptyList(), List.of("1", "2", "3"));
+        checkEmpty("stdout", r.stdOut);
+        checkEqual("stderr", r.stdErr, expectStdErr);
+        checkFault("exception", r.exception, expectFault);
+    }
+
+    /*
+     * Tests in which main throws an exception.
+     */
+    @Test
+    public void testTargetException1(Path base) throws IOException {
+        tb.writeJavaFiles(base,
+            "import java.util.Arrays;\n" +
+            "class Thrower {\n" +
+            "    public static void main(String... args) {\n" +
+            "        throwWhenZero(Integer.parseInt(args[0]));\n" +
+            "    }\n" +
+            "    static void throwWhenZero(int arg) {\n" +
+            "        if (arg == 0) throw new Error(\"zero!\");\n" +
+            "        throwWhenZero(arg - 1);\n" +
+            "    }\n" +
+            "}");
+        Path file = base.resolve("Thrower.java");
+        Result r = run(file, Collections.emptyList(), List.of("3"));
+        checkEmpty("stdout", r.stdOut);
+        checkEmpty("stderr", r.stdErr);
+        checkTrace("exception", r.exception,
+                "java.lang.Error: zero!",
+                "at Thrower.throwWhenZero(Thrower.java:7)",
+                "at Thrower.throwWhenZero(Thrower.java:8)",
+                "at Thrower.throwWhenZero(Thrower.java:8)",
+                "at Thrower.throwWhenZero(Thrower.java:8)",
+                "at Thrower.main(Thrower.java:4)");
+    }
+
+    Result run(Path file, List<String> runtimeArgs, List<String> appArgs) {
+        List<String> args = new ArrayList<>();
+        args.add(file.toString());
+        args.addAll(appArgs);
+
+        PrintStream prev = System.out;
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        try (PrintStream out = new PrintStream(baos, true)) {
+            System.setOut(out);
+            StringWriter sw = new StringWriter();
+            try (PrintWriter err = new PrintWriter(sw, true)) {
+                Main m = new Main(err);
+                m.run(toArray(runtimeArgs), toArray(args));
+                return new Result(baos.toString(), sw.toString(), null);
+            } catch (Throwable t) {
+                return new Result(baos.toString(), sw.toString(), t);
+            }
+        } finally {
+            System.setOut(prev);
+        }
+    }
+
+    void checkEqual(String name, String found, String expect) {
+        expect = expect.replace("\n", tb.lineSeparator);
+        out.println(name + ": " + found);
+        out.println(name + ": " + found);
+        if (!expect.equals(found)) {
+            error("Unexpected output; expected: " + expect);
+        }
+    }
+
+    void checkEmpty(String name, String found) {
+        out.println(name + ": " + found);
+        if (!found.isEmpty()) {
+            error("Unexpected output; expected empty string");
+        }
+    }
+
+    void checkNull(String name, Throwable found) {
+        out.println(name + ": " + found);
+        if (found != null) {
+            error("Unexpected exception; expected null");
+        }
+    }
+
+    void checkFault(String name, Throwable found, String expect) {
+        expect = expect.replace("\n", tb.lineSeparator);
+        out.println(name + ": " + found);
+        if (found == null) {
+            error("No exception thrown; expected Main.Fault");
+        } else {
+            if (!(found instanceof Main.Fault)) {
+                error("Unexpected exception; expected Main.Fault");
+            }
+            if (!(found.getMessage().equals(expect))) {
+                error("Unexpected detail message; expected: " + expect);
+            }
+        }
+    }
+
+    void checkTrace(String name, Throwable found, String... expect) {
+        if (!(found instanceof InvocationTargetException)) {
+            error("Unexpected exception; expected InvocationTargetException");
+            out.println("Found:");
+            found.printStackTrace(out);
+        }
+        StringWriter sw = new StringWriter();
+        try (PrintWriter pw = new PrintWriter(sw)) {
+            ((InvocationTargetException) found).getTargetException().printStackTrace(pw);
+        }
+        String trace = sw.toString();
+        out.println(name + ":\n" + trace);
+        String[] traceLines = trace.trim().split("[\r\n]+\\s+");
+        try {
+            tb.checkEqual(List.of(traceLines), List.of(expect));
+        } catch (Error e) {
+            error(e.getMessage());
+        }
+    }
+
+    String[] toArray(List<String> list) {
+        return list.toArray(new String[list.size()]);
+    }
+
+    class Result {
+        private final String stdOut;
+        private final String stdErr;
+        private final Throwable exception;
+
+        Result(String stdOut, String stdErr, Throwable exception) {
+            this.stdOut = stdOut;
+            this.stdErr = stdErr;
+            this.exception = exception;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/lib/sun/hotspot/code/Compiler.java	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.hotspot.code;
+
+import sun.hotspot.WhiteBox;
+
+/**
+ * API to obtain information about enabled JIT compilers
+ * retrieved from the VM with the WhiteBox API.
+ */
+public class Compiler {
+
+    private static final WhiteBox WB = WhiteBox.getWhiteBox();
+
+    /**
+     * Check if Graal is used as JIT compiler.
+     *
+     * Graal is enabled if following conditions are true:
+     * - we are not in Interpreter mode
+     * - UseJVMCICompiler flag is true
+     * - jvmci.Compiler variable is equal to 'graal'
+     * - TieredCompilation is not used or TieredStopAtLevel is greater than 3
+     * No need to check client mode because it set UseJVMCICompiler to false.
+     *
+     * @return true if Graal is used as JIT compiler.
+     */
+    public static boolean isGraalEnabled() {
+        Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
+        if (useCompiler == null || !useCompiler) {
+            return false;
+        }
+        Boolean useJvmciComp = WB.getBooleanVMFlag("UseJVMCICompiler");
+        if (useJvmciComp == null || !useJvmciComp) {
+            return false;
+        }
+        // This check might be redundant but let's keep it for now.
+        String jvmciCompiler = System.getProperty("jvmci.Compiler");
+        if (jvmciCompiler == null || !jvmciCompiler.equals("graal")) {
+            return false;
+        }
+
+        Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
+        Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel");
+        // if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used
+        if (tieredCompilation != null && tieredCompilation &&
+            compLevel != null && compLevel <= 3) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
+     * Check if C2 is used as JIT compiler.
+     *
+     * C2 is enabled if following conditions are true:
+     * - we are not in Interpreter mode
+     * - we are in Server compilation mode
+     * - TieredCompilation is not used or TieredStopAtLevel is greater than 3
+     * - Graal is not used
+     *
+     * @return true if C2 is used as JIT compiler.
+     */
+    public static boolean isC2Enabled() {
+        Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
+        if (useCompiler == null || !useCompiler) {
+            return false;
+        }
+        Boolean serverMode = WB.getBooleanVMFlag("ProfileInterpreter");
+        if (serverMode == null || !serverMode) {
+            return false;
+        }
+
+        Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
+        Long compLevel = WB.getIntxVMFlag("TieredStopAtLevel");
+        // if TieredCompilation is enabled and compilation level is <= 3 then no Graal is used
+        if (tieredCompilation != null && tieredCompilation &&
+            compLevel != null && compLevel <= 3) {
+            return false;
+        }
+
+        if (isGraalEnabled()) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /*
+     * Check if C1 is used as JIT compiler.
+     *
+     * C1 is enabled if following conditions are true:
+     * - we are not in Interpreter mode
+     * - we are not in Server compilation mode
+     * - TieredCompilation is used in Server mode
+     *
+     * @return true if C1 is used as JIT compiler.
+     */
+    public static boolean isC1Enabled() {
+        Boolean useCompiler = WB.getBooleanVMFlag("UseCompiler");
+        if (useCompiler == null || !useCompiler) {
+            return false;
+        }
+        Boolean serverMode = WB.getBooleanVMFlag("ProfileInterpreter");
+        if (serverMode == null || !serverMode) {
+            return true; // Client mode
+        }
+
+        Boolean tieredCompilation = WB.getBooleanVMFlag("TieredCompilation");
+        // C1 is not used in server mode if TieredCompilation is off.
+        if (tieredCompilation != null && !tieredCompilation) {
+            return false;
+        }
+        return true;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8204288.js	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8204288: Matching the end of a string followed by an empty greedy regex and a word boundary fails
+ *
+ * @test
+ * @run
+ */
+
+
+Assert.assertEquals(new RegExp("c.*\\b").exec("abc")[0], "c");
+Assert.assertEquals(new RegExp("abc.*\\b").exec("abc")[0], "abc");
+Assert.assertEquals(new RegExp("\\b.*abc.*\\b").exec("abc")[0], "abc");
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/nashorn/script/basic/JDK-8204290.js	Fri Jun 08 09:40:28 2018 -0700
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ * 
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ * 
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ * 
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * JDK-8204290: Add check to limit number of capture groups
+ *
+ * @test
+ * @run
+ */
+
+try {
+    new RegExp("()".repeat(0x8001));
+    fail("Expected exception");
+} catch (e) {
+    Assert.assertTrue(e instanceof SyntaxError);
+    Assert.assertEquals(e.message, "too many capture groups");
+}
+